Vim | 2012-12-08 18:59:59 | 阅读 1885 次 | 评论(0)
runtime! debian.vim

call pathogen#infect()

if has("syntax")
  syntax on

set nu
set ts=4
set softtabstop=4
set shiftwidth=4
set expandtab
set autoindent
set hlsearch
colorscheme molokai

au BufNewFile,BufRead *.rb,*.html,*.htm,*.erb,*.yaml,*.yml,*.sass,*.scss set softtabstop=2 | set shiftwidth=2
au BufNewFile,BufRead *.html.erb set filetype=html
au BufNewFile,BufRead *.scss set filetype=css
au BufNewFile,BufRead *.go set filetype=go
au BufRead *.c,*.cpp,*.py,*.rb,*.go nmap <F5> :call CompileRun()<CR>
func! CompileRun()
    exec "w"
    if &filetype == 'c'
        exec "!gcc % -o %<"
        exec "! ./%<"
    elseif &filetype == 'cpp'
        exec "!g++ % -o %<"
        exec "! ./%<"
    elseif &filetype == 'python'
        exec "!python %"
    elseif &filetype == 'ruby'
        exec "!ruby %"
    elseif &filetype == 'go'
        exec "!go run %"

let g:user_zen_expandabbr_key = '<c-space>'

map <a-x> :CtrlP<CR>
map <a-e> :CtrlPMRU<CR>
set wildignore+=*/doc/*,*.so,*.swp,*.zip

imap <a-h> <Left>
imap <a-j> <Down>
imap <a-k> <Up>
imap <a-l> <Right>
imap <c-h> <Home>
imap <c-l> <End>
imap <S-CR> <Esc>o
imap <C-CR> <Esc><S-o>

if has("autocmd")
  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
"  filetype plugin indent on

" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd		" Show (partial) command in status line.
"set showmatch		" Show matching brackets.
"set ignorecase		" Do case insensitive matching
"set smartcase		" Do smart case matching
"set incsearch		" Incremental search
"set autowrite		" Automatically save before commands like :next and :make
"set hidden             " Hide buffers when they are abandoned
"set mouse=a		" Enable mouse usage (all modes)

" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local