Created
October 30, 2012 20:29
-
-
Save ryane/3982805 to your computer and use it in GitHub Desktop.
my current vimrc ( 2012-10-30 )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " Must come first because it changes other options. | |
filetype off " required! (for vundle) | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" let vundle manage vundle | |
" required! | |
Bundle 'gmarik/vundle' | |
" my bundles | |
Bundle "jeffkreeftmeijer/vim-numbertoggle" | |
Bundle "tpope/vim-fugitive" | |
Bundle "tpope/vim-rails" | |
Bundle "tpope/vim-surround" | |
Bundle "tpope/vim-endwise" | |
Bundle "mileszs/ack.vim" | |
Bundle "kien/ctrlp.vim" | |
Bundle "scrooloose/nerdtree" | |
Bundle "ZoomWin" | |
Bundle "Lokaltog/vim-powerline" | |
Bundle "kana/vim-textobj-user" | |
Bundle "nelstrom/vim-textobj-rubyblock" | |
Bundle "benmills/vimux" | |
Bundle "nanotech/jellybeans.vim" | |
Bundle "tComment" | |
Bundle "pangloss/vim-javascript" | |
Bundle "ryane/snipmate-snippets" | |
Bundle "msanders/snipmate.vim" | |
" testing... | |
Bundle "jiangmiao/auto-pairs" | |
Bundle "Shougo/neocomplcache" | |
filetype plugin indent on " Turn on file type detection. | |
syntax enable " Turn on syntax highlighting. | |
runtime macros/matchit.vim " Load the matchit plugin. | |
set showcmd " Display incomplete commands. | |
set showmode " Display the mode you're in. | |
set backspace=indent,eol,start " Intuitive backspacing. | |
set hidden " Handle multiple buffers better. | |
set wildmenu " Enhanced command line completion. | |
set wildmode=list:longest " Complete files like a shell. | |
set ignorecase " Case-insensitive searching. | |
set smartcase " But case-sensitive if expression contains a capital letter. | |
set number " Show line numbers. | |
set ruler " Show cursor position. | |
set incsearch " Highlight matches as you type. | |
set hlsearch " Highlight matches. | |
set wrap " Turn on line wrapping. | |
set scrolloff=3 " Show 3 lines of context around the cursor. | |
set title " Set the terminal's title | |
set visualbell " No beeping. | |
set nobackup " Don't make a backup before overwriting a file. | |
set nowritebackup " And again. | |
set directory=$HOME/.vim/tmp//,. " Keep swap files in one location | |
" whitespace settings | |
set list " Show invisible characters | |
" List chars | |
set listchars="" " Reset the listchars | |
set listchars=tab:\ \ " a tab should display as " ", trailing whitespace as "." | |
set listchars+=trail:. " show trailing spaces as dots | |
set listchars+=extends:> " The character to show in the last column when wrap is | |
" off and the line continues beyond the right of the screen | |
set listchars+=precedes:< " The character to show in the last column when wrap is | |
" off and the line continues beyond the right of the screen | |
" UNCOMMENT TO USE | |
set tabstop=2 " Global tab width. | |
set shiftwidth=2 " And again, related. | |
set expandtab " Use spaces instead of tabs | |
set laststatus=2 " Show the status line all the time | |
" Useful status information at bottom of screen | |
set statusline=[%n]\ %<%.99f\ %h%w%m%r%y\ %{fugitive#statusline()}%{exists('*CapsLockStatusline')?CapsLockStatusline():''}%=%-16(\ %l,%c-%v\ %)%P | |
" font | |
set guifont=Menlo\ for\ Powerline:h14 | |
" Or use vividchalk | |
" colorscheme jellybeans | |
colorscheme Tomorrow-Night | |
" use comma (,) for leader | |
let mapleader = "," | |
" fancy powerline | |
let g:Powerline_symbols = 'fancy' | |
" prevent esc delays | |
" http://ksjoberg.com/vim-esckeys.html | |
set noesckeys | |
" write the file when switching buffers | |
set autowrite | |
" don't use ESC so much | |
inoremap jk <esc> | |
" Tab mappings. | |
map <leader>tt :tabnew<cr> | |
map <leader>te :tabedit | |
map <leader>tc :tabclose<cr> | |
map <leader>to :tabonly<cr> | |
map <leader>tn :tabnext<cr> | |
map <leader>tp :tabprevious<cr> | |
map <leader>tf :tabfirst<cr> | |
map <leader>tl :tablast<cr> | |
map <leader>tm :tabmove | |
" Uncomment to use Jamis Buck's file opening plugin | |
"map <Leader>t :FuzzyFinderTextMate<Enter> | |
" Controversial...swap colon and semicolon for easier commands | |
"nnoremap ; : | |
"nnoremap : ; | |
"vnoremap ; : | |
"vnoremap : ; | |
" Automatic fold settings for specific files. Uncomment to use. | |
" autocmd FileType ruby setlocal foldmethod=syntax | |
" autocmd FileType css setlocal foldmethod=indent shiftwidth=2 tabstop=2 | |
" For the MakeGreen plugin and Ruby RSpec. Uncomment to use. | |
" autocmd BufNewFile,BufRead *_spec.rb compiler rspec | |
" Some helpers to edit mode | |
" http://vimcasts.org/e/14 | |
cnoremap %% <C-R>=expand('%:h').'/'<cr> | |
map <leader>ew :e %% | |
map <leader>es :sp %% | |
map <leader>ev :vsp %% | |
map <leader>et :tabe %% | |
" Adjust viewports to the same size | |
map <Leader>= <C-w>= | |
" better window switching | |
map <C-h> <C-w>h | |
map <C-j> <C-w>j | |
map <C-k> <C-w>k | |
map <C-l> <C-w>l | |
" improve buffer switching | |
nmap <leader>F :CtrlPMRU<CR> | |
nmap <leader>b :CtrlPBuffer<CR> | |
" navigate tags | |
nmap <leader>t :CtrlPBufTag<CR> | |
" fugitive mappings | |
nmap <leader>gb :Gblame<CR> | |
nmap <leader>gs :Gstatus<CR> | |
nmap <leader>gd :Gdiff<CR> | |
nmap <leader>gl :Glog<CR> | |
nmap <leader>gc :Gcommit<CR> | |
nmap <leader>gp :Git push<CR> | |
" nerdtree | |
map <leader>n :NERDTreeToggle<CR> | |
" Ack | |
map <leader>f :Ack<space> | |
" misc functions | |
" clean up whitespace | |
" http://vimcasts.org/episodes/tidying-whitespace/ | |
function! Preserve(command) | |
" Preparation: save last search, and cursor position. | |
let _s=@/ | |
let l = line(".") | |
let c = col(".") | |
" Do the business: | |
execute a:command | |
" Clean up: restore previous search history, and cursor position | |
let @/=_s | |
call cursor(l, c) | |
endfunction | |
nmap _$ :call Preserve("%s/\\s\\+$//e")<CR> | |
nmap _= :call Preserve("normal gg=G")<CR> | |
function! ReformatDocument() | |
execute ':call Preserve("%s/\\s\\+$//e")' | |
execute ':call Preserve("normal gg=G")' | |
execute ':w' | |
execute ':bn' | |
endfunction | |
nmap <leader>fed :call ReformatDocument()<CR> | |
function! FixMixedDosEncoding() | |
execute ':e ++ff=dos' | |
execute ':setlocal ff=unix' | |
execute ':w' | |
endfunction | |
nmap <leader>fee :call FixMixedDosEncoding()<CR> | |
" neocompletecache | |
" | |
" Disable AutoComplPop. | |
let g:acp_enableAtStartup = 0 | |
" Use neocomplcache. | |
let g:neocomplcache_enable_at_startup = 1 | |
" Use smartcase. | |
let g:neocomplcache_enable_smart_case = 1 | |
" Use camel case completion. | |
let g:neocomplcache_enable_camel_case_completion = 1 | |
" Use underbar completion. | |
let g:neocomplcache_enable_underbar_completion = 1 | |
" Set minimum syntax keyword length. | |
let g:neocomplcache_min_syntax_length = 3 | |
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' | |
" Define dictionary. | |
let g:neocomplcache_dictionary_filetype_lists = { | |
\ 'default' : '', | |
\ 'vimshell' : $HOME.'/.vimshell_hist', | |
\ 'scheme' : $HOME.'/.gosh_completions' | |
\ } | |
" Define keyword. | |
if !exists('g:neocomplcache_keyword_patterns') | |
let g:neocomplcache_keyword_patterns = {} | |
endif | |
let g:neocomplcache_keyword_patterns['default'] = '\h\w*' | |
" Plugin key-mappings. | |
imap <C-k> <Plug>(neocomplcache_snippets_expand) | |
smap <C-k> <Plug>(neocomplcache_snippets_expand) | |
inoremap <expr><C-g> neocomplcache#undo_completion() | |
inoremap <expr><C-l> neocomplcache#complete_common_string() | |
" SuperTab like snippets behavior. | |
"imap <expr><TAB> neocomplcache#sources#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : pumvisible() ? "\<C-n>" : "\<TAB>" | |
" Recommended key-mappings. | |
" <CR>: close popup and save indent. | |
" inoremap <expr><CR> neocomplcache#smart_close_popup() . "\<CR>" | |
" " <TAB>: completion. | |
" inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" | |
" " <C-h>, <BS>: close popup and delete backword char. | |
" inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>" | |
" inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>" | |
" inoremap <expr><C-y> neocomplcache#close_popup() | |
" inoremap <expr><C-e> neocomplcache#cancel_popup() | |
" AutoComplPop like behavior. | |
"let g:neocomplcache_enable_auto_select = 1 | |
" Shell like behavior(not recommended). | |
"set completeopt+=longest | |
"let g:neocomplcache_enable_auto_select = 1 | |
"let g:neocomplcache_disable_auto_complete = 1 | |
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<TAB>" | |
"inoremap <expr><CR> neocomplcache#smart_close_popup() . "\<CR>" | |
" Enable omni completion. | |
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS | |
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS | |
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete | |
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags | |
" Enable heavy omni completion. | |
if !exists('g:neocomplcache_omni_patterns') | |
let g:neocomplcache_omni_patterns = {} | |
endif | |
let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::' | |
"autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete | |
let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::' | |
let g:neocomplcache_omni_patterns.c = '\%(\.\|->\)\h\w*' | |
let g:neocomplcache_omni_patterns.cpp = '\h\w*\%(\.\|->\)\h\w*\|\h\w*::' | |
" end neocompletecache |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment