evil - add eshell toggle
[dotfiles.git] / vim / vimrc
index 567d4ca..8687824 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -13,7 +13,8 @@ Bundle 'vim-scripts/FuzzyFinder'
 Bundle 'vim-scripts/L9'
 Bundle 'Valloric/YouCompleteMe'
 Bundle 'octol/vim-cpp-enhanced-highlight'
-Bundle 'bling/vim-airline'
+Bundle 'vim-airline/vim-airline'
+Bundle 'vim-airline/vim-airline-themes'
 Bundle 'payneseu/nerdtree'
 Bundle 'Townk/vim-autoclose'
 Bundle 'majutsushi/tagbar'
@@ -38,6 +39,7 @@ Bundle 'MattesGroeger/vim-bookmarks'
 "Bundle 'kien/ctrlp.vim'
 "disable since some conflicting mapping
 Bundle 'vim-latex/vim-latex'
+Plugin 'vimperator/vimperator.vim'
 
 call vundle#end()
 filetype plugin indent on
@@ -92,7 +94,7 @@ if has("gui_running")
        set macmeta  "" Macvim only
        colorscheme molokai
        set guioptions+=c
-       set guifont=Sauce\ Code\ Powerline\ Light:h11
+       set guifont=Source\ Code\ Pro\ Light:h11
        highlight Cursor guifg=white guibg=green
        set guicursor=a:blinkon0
        set guioptions=eac
@@ -149,7 +151,7 @@ nmap =      <C-w>=
 nnoremap <C-D> <C-D>zz
 nnoremap <C-U> <C-U>zz
 
-nnoremap <SPACE>       <C-F>
+"nnoremap <SPACE>      <C-F>
 nnoremap <S-SPACE>     <C-B>
 nnoremap <BS>  <C-B>
 nnoremap <A-n> gt
@@ -166,12 +168,13 @@ nnoremap \e\19 :tabprevious<CR>
 "nmap <A-SPACE>        :b#<CR>
 "nmap <Leader>d        :bd<CR>
 "" keymappig for register operations
-nnoremap <Leader>r     :registers<CR>
+""TODO check if this already mapping
+"nnoremap <Leader>r    :registers<CR>
 "noremap <Leader>x     :<C-p>
 nnoremap <Leader>a :
 
 nmap <Leader>p "*p
-
+" also works :r !pbpaste<CR>
 
 nmap <A-=> :resize<CR>:vertical resize<CR>
 nmap \e= :resize<CR>:vertical resize<CR>
@@ -294,8 +297,17 @@ nnoremap <silent> sr     :FufRenewCache<CR>
 " YouCompleteMe ----------------------------------------------------------- {{{
 "syntax on, must before the YCM,
 
+" Load YouCompleteMe only on OSX
+if !has("osx")
+    let g:loaded_youcompleteme = 1
+endif
+
 "let g:ycm_collect_identifiers_from_tags_files = 1
-"let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
+let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
+" this is fix youcompleteme python error
+"http://www.cnblogs.com/clivelee/p/4266559.html
+"https://github.com/Valloric/YouCompleteMe/issues/18
+"let g:ycm_path_to_python_interpreter= '/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python'
 let g:ycm_auto_trigger = 1
 let g:ycm_seed_identifiers_with_syntax = 1
 let g:ycm_show_diagnostics_ui = 0
@@ -370,6 +382,8 @@ endfunction
 "endif
 " }}}
 " NerdTree ---------------------------------------------------------------- {{{
+" Fix keymapping conflict
+nmap <unique> <Leader>, <Plug>MarkClear
 nmap <Leader>n :NERDTreeToggle<CR>
 nmap <Leader>N :NERDTreeFind<CR>
 " }}}
@@ -462,6 +476,16 @@ map ew <Plug>(easymotion-w)
 map ee <Plug>(easymotion-w)
 map el <Plug>(easymotion-lineforward)
 map eh <Plug>(easymotion-linebackward)
+
+"map <SPACE>n <Plug>(easymotion-sn)
+"map <SPACE>j <Plug>(easymotion-j)
+"map <SPACE>k <Plug>(easymotion-k)
+"map <SPACE>b <Plug>(easymotion-b)
+"map <SPACE>w <Plug>(easymotion-w)
+"map <SPACE>e <Plug>(easymotion-w)
+"map <SPACE>l <Plug>(easymotion-lineforward)
+"map <SPACE>h <Plug>(easymotion-linebackward)
+
 "" }}}
 " vim-latex --------------------------------------------------------------- {{{
 "set grepprg=grep\ -nH\ $*
@@ -497,9 +521,10 @@ autocmd FileType qf nnoremap <buffer> <silent> q :q<CR> | setlocal nowrap | setl
 autocmd FileType help nnoremap <buffer> <silent> q :q<CR> | vertical resize 85;
 autocmd FileType c,cpp setlocal foldmethod=syntax |
     \ let b:AutoClosePairs = AutoClose#DefaultPairsModified("\"", "{}") |
-       \ inoremap <buffer> { {<CR>}<ESC>kA<CR> |
+       \ inoremap <buffer> { {<CR>}<ESC>kA<CR>|
     \ nnoremap <buffer> <silent> <C-]> :let word=expand("<cword>")<CR>:wincmd o<cr>:vsp<CR>:exec("tag ". word)<cr>zzzr:wincmd w<cr>
-autocmd FileType python setlocal foldmethod=indent
+autocmd FileType python setlocal foldmethod=indent |
+    \ set list
 
 autocmd FileType xml setlocal foldmethod=syntax |
        \ let g:xml_syntax_folding=1
@@ -507,6 +532,10 @@ autocmd FileType vim setlocal foldmethod=marker |
        \ setlocal formatoptions-=c formatoptions-=r formatoptions-=o |
     \ let b:AutoClosePairs = AutoClose#DefaultPairsModified("", "{} \"")
 
+autocmd FileType perl setlocal foldmethod=syntax |
+    \ let b:AutoClosePairs = AutoClose#DefaultPairsModified("\"", "{}") |
+       \ inoremap <buffer> {<CR> {<CR>}<ESC>kA<CR>
+
 autocmd Filetype markdown setlocal textwidth=80
 
 autocmd CmdwinEnter * map <buffer> q :q<CR>
@@ -619,7 +648,7 @@ nnoremap \d :call DiffToggle()<CR>
 " }}}
 
 "nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
-nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
+nnoremap <silent> <cr> @=(foldlevel('.')?'za':"\<Space>")<CR>
 "noremap <Leader>d     @=(&diff)?':diffoff':":VCSVimDiff"<CR><CR>
 
 " https://bitbucket.org/sjl/dotfiles/src/tip/vim/vimrc
@@ -674,3 +703,5 @@ nnoremap <Leader>m  :marks abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<
 "                          \ 'undo', 'line', 'changes', 'mixed', 'bookmarkdir']
 
 
+"" TODO: 
+""