Skip to content

Instantly share code, notes, and snippets.

@mallowlabs
Created August 8, 2008 13:13
Show Gist options
  • Save mallowlabs/4566 to your computer and use it in GitHub Desktop.
Save mallowlabs/4566 to your computer and use it in GitHub Desktop.
.vimrc for gvim
"
" .vimrc
" @author mallowlabs
" @update 2007/09/29
"
" - General -
syntax on " enable syntax heilight
set nocompatible " behabe vim intead of vi
"set visualbell " enable visual bell
" - Edit -
set tabstop=4 " tab width
set shiftwidth=4 " Number of spaces to use for each step of (auto)indent.
set expandtab " replace tab to spaces
set autoindent " auto indent
set paste " unable formatting in insert mode
set backspace=indent,eol,start " more powerful backspacing
set nobackup " do not make backup files
set nowritebackup " do not make backup files
set showmatch " heilight braces
set hidden " can open other file on editing
set autoread " auto reload for other edit
" move by display line
nmap j gj
nmap k gk
vmap j gj
vmap k gk
" 16 colors
set t_Co=16
set t_Sf=[3%dm
set t_Sb=[4%dm
" - Search -
set wrapscan " back head of file on search
set ignorecase " ignore case
set smartcase " do not ignore case with both cases
set hlsearch " enable heilight keyword
set incsearch " incremental search
" - View -
set number " view line number
set ruler " view ruler
"set list " viewr tab & newline
"set listchars=tab:>.,trail:.,nbsp:.
set laststatus=2 " always show status bar
set showcmd " show command on statusbar
set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P " statusbar content
set title " show title
colorscheme darkblue " color scheme
" Windwos gvim settings (gvimrc)
if has("win32") && has("gui_running")
set guifont=BDF_M+:h7.5:cSHIFTJIS
set guioptions-=T
set columns=128
set lines=42
set iminsert=0 " IME control
set imsearch=0 " IME control
endif
" - Encoding -
" TODO:research ZunWiki http://www.kawaz.jp/pukiwiki/?vim#content_1_7
if has("win32")
set encoding=sjis
set fileencodings=iso-2022-jp,euc-jp,utf-8
set fileformats=dos,unix,mac
elseif has("mac")
set encoding=utf-8
set fileencodings=iso-2022-jp,sjis,euc-jp
set fileformats=unix,dos,mac
elseif has("unix")
set encoding=euc-jp
set fileencodings=iso-2022-jp,utf-8,sjis
set fileformats=unix,dos,mac
endif
" - Vim7 -
if has("autocmd")
" enable auto completion & auto indent
filetype plugin indent on
set smarttab
au BufNewFile,BufRead *.thtml setfiletype php "cakephp1.1
au BufNewFile,BufRead *.rxml setfiletype ruby "ruby on rails
au BufNewFile,BufRead *.ctp setfiletype php "cakephp1.2
au BufNewFile,BufRead *.rb set tabstop=2 shiftwidth=2
au BufNewFile,BufRead *.html set tabstop=2 shiftwidth=2
au BufNewFile,BufRead *.as :set filetype=actionscript
endif
" color config for Omni Completion
hi Pmenu ctermbg=8
hi PmenuSel ctermbg=12
hi PmenuSbar ctermbg=0
" - Mac OX X -
map <C-[>[H <Home>
map! <C-[>[H <Home>
map <C-[>[F <End>
map! <C-[>[F <End>
"preview interpreter's output(Tip #1244)
"http://blog.blueblack.net/item_150
function! Ruby_eval_vsplit() range
if &filetype == "ruby"
let src = tempname()
let dst = "Ruby Output"
" put current buffer's content in a temp file
silent execute ": " . a:firstline . "," . a:lastline . "w " . src
" open the preview window
silent execute ":pedit! " . dst
" change to preview window
wincmd P
" set options
setlocal buftype=nofile
setlocal noswapfile
setlocal syntax=none
setlocal bufhidden=delete
" replace current buffer with ruby's output
silent execute ":%! ruby " . src . " 2>&1 "
" change back to the source buffer
wincmd p
endif
endfunction
vmap <silent> <F10> :call Ruby_eval_vsplit()<CR>
nmap <silent> <F10> mzggVG<F10>`z
map <silent> <S-F10> :pc<CR>
highlight InvisibleTab ctermbg=blue guibg=blue
2match InvisibleTab "\t"
" autocmd WinEnter * match InvisibleTab "\t"
" http://d.hatena.ne.jp/tasukuchan/20070816/1187246177
highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/
" autocmd WinEnter * match WhitespaceEOL /\s\+$/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment