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'
Bundle 'vim-scripts/cmdline-completion'
Bundle 'vim-scripts/vcscommand.vim'
Bundle 'Lokaltog/vim-easymotion'
-Bundle 'vim-scripts/YankRing.vim'
+"Bundle 'vim-scripts/YankRing.vim'
Bundle 'vim-scripts/gtags.vim'
Bundle 'kshenoy/vim-signature'
Bundle 'nathanaelkane/vim-indent-guides'
"Bundle 'vim-scripts/genutils'
"Bundle 'vim-scripts/Marks-Browser'
Bundle 'MattesGroeger/vim-bookmarks'
+"Bundle 'tpope/vim-repeat'
+"Bundle 'kien/ctrlp.vim'
+"disable since some conflicting mapping
+Bundle 'vim-latex/vim-latex'
call vundle#end()
filetype plugin indent on
" }}}
" Basic options ----------------------------------------------------------- {{{
set number
+set relativenumber
set tabstop=4
set softtabstop=4
set shiftwidth=4
set hlsearch
set autoindent
set confirm
+set nostartofline " don't jump to first character when paging
+set wrap
+set expandtab
+"set textwidth, formatoptions for chinese
+set formatoptions+=m
+set colorcolumn=+1
syntax on
" colorscheme {{{
set cursorline
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
nmap <Leader>e :e<Space>
nmap <Leader>W :w !sudo tee %<CR>
nmap <Leader>h :vertical help<Space>
-nmap <Leader>t :tabedit<Space>
+nmap <Leader>t :tabedit %<Space>
"nmap <Leader>x :x<CR>
" windows
nmap > <C-w>3>
nmap = <C-w>=
-nnoremap <C-D> M<C-D>
-nnoremap <C-U> M<C-U>
+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
" map <A-TAB> Alt+TAB
"noremap <A-S-TAB> "input C-V then input key sequence to
"http://vim.wikia.com/wiki/Make_Shift-Tab_work
-nnoremap <ESC><TAB> :bn<CR>
-nnoremap \e\19 :bp<CR>
+"nnoremap <ESC><TAB> :bn<CR>
+nnoremap <ESC><TAB> :tabnext<CR>
+"nnoremap \e\19 :bp<CR>
+nnoremap \e\19 :tabprevious<CR>
"nmap <A-S-TAB> :bp<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>
nnoremap zr zrzz
nnoremap zn znzz
+nnoremap zj zjzz
+nnoremap zh zhzz
+
noremap <Leader>z zmzvzz
nmap \\ :nohlsearch<CR>
" }}}
vmap <C-j> }
"vmap <Leader>y "*y
vmap Y "*y
+"
+"vmap <C-Y> "qy
+"vmap <C-P> "qp
+vnoremap Y "*y
+vnoremap <Leader>p "*p
+"search for visually selectecd text
+vnoremap // y/<C-R>"<CR>
+vnoremap <Leader>a :
" }}}
" }}}
" Plugins Configuration --------------------------------------------------- {{{
nnoremap <silent> sk :FufFileWithCurrentBufferDir<CR>
nnoremap <silent> sK :FufFileWithFullCwd<CR>
nnoremap <silent> s<C-k> :FufFile<CR>
-nnoremap <silent> sl :FufCoverageFileChange<CR>
-nnoremap <silent> sL :FufCoverageFileChange<CR>
-nnoremap <silent> s<C-l> :FufCoverageFileRegister<CR>
+"nnoremap <silent> sl :FufCoverageFileChange<CR>
+"nnoremap <silent> sL :FufCoverageFileChange<CR>
+"nnoremap <silent> s<C-l> :FufCoverageFileRegister<CR>
nnoremap <silent> sd :FufDirWithCurrentBufferDir<CR>
nnoremap <silent> sD :FufDirWithFullCwd<CR>
nnoremap <silent> s<C-d> :FufDir<CR>
nnoremap <silent> sn :FufMruFile<CR>
nnoremap <silent> sN :FufMruFileInCwd<CR>
nnoremap <silent> sm :FufMruCmd<CR>
-nnoremap <silent> su :FufBookmarkFile<CR>
+"nnoremap <silent> su :FufBookmarkFile<CR>
nnoremap <silent> s<C-u> :FufBookmarkFileAdd<CR>
-vnoremap <silent> s<C-u> :FufBookmarkFileAddAsSelectedText<CR>
+"vnoremap <silent> s<C-u> :FufBookmarkFileAddAsSelectedText<CR>
nnoremap <silent> si :FufBookmarkDir<CR>
nnoremap <silent> s<C-i> :FufBookmarkDirAdd<CR>
nnoremap <silent> sT :FufTag<CR>
nnoremap <silent> s<C-]> :FufTagWithCursorWord!<CR>
nnoremap <silent> s, :FufBufferTag<CR>
nnoremap <silent> s< :FufBufferTag!<CR>
-vnoremap <silent> s, :FufBufferTagWithSelectedText!<CR>
-vnoremap <silent> s< :FufBufferTagWithSelectedText<CR>
+"vnoremap <silent> s, :FufBufferTagWithSelectedText!<CR>
+"vnoremap <silent> s< :FufBufferTagWithSelectedText<CR>
nnoremap <silent> s} :FufBufferTagWithCursorWord!<CR>
+nnoremap <silent> sl :FufBufferTagAll<CR>
"nnoremap <silent> s. :FufBufferTagAll<CR>
-"nnoremap <silent> s> :FufBufferTagAll!<CR>
+nnoremap <silent> s> :FufBufferTagAll!<CR>
"vnoremap <silent> s. :FufBufferTagAllWithSelectedText!<CR>
"vnoremap <silent> s> :FufBufferTagAllWithSelectedText<CR>
"nnoremap <silent> s] :FufBufferTagAllWithCursorWord!<CR>
nnoremap <silent> sG :FufTaggedFile<CR>
nnoremap <silent> sg :FufTaggedFile!<CR>
-nnoremap <silent> so :FufJumpList<CR>
-nnoremap <silent> sp :FufChangeList<CR>
-nnoremap <silent> sq :FufQuickfix<CR>
-nnoremap <silent> sy :FufLine<CR>
+"nnoremap <silent> so :FufJumpList<CR>
+"nnoremap <silent> sp :FufChangeList<CR>
+"nnoremap <silent> sq :FufQuickfix<CR>
+"nnoremap <silent> sy :FufLine<CR>
" nnoremap <silent> sh :FufHelp<CR>
-nnoremap <silent> se :FufEditDataFile<CR>
+"nnoremap <silent> se :FufEditDataFile<CR>
nnoremap <silent> sr :FufRenewCache<CR>
" }}}
" YouCompleteMe ----------------------------------------------------------- {{{
"syntax on, must before the YCM,
-let g:ycm_collect_identifiers_from_tags_files = 1
+" 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'
+" 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
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
- let g:airline#extensions#tabline#show_buffers = 1
+" let g:airline#extensions#tabline#show_buffers = 1
+ let g:airline#extensions#tabline#show_buffers = 0
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep =''
"endif
" }}}
" NerdTree ---------------------------------------------------------------- {{{
+" Fix keymapping conflict
+nmap <unique> <Leader>, <Plug>MarkClear
nmap <Leader>n :NERDTreeToggle<CR>
nmap <Leader>N :NERDTreeFind<CR>
" }}}
" }}}
" Marks ------------------------------------------------------------------- {{{
nmap \h <Plug>MarkSet
-nmap * <Plug>MarkSearchNext
-nmap # <Plug>MarkSearchPrev
+"nmap * <Plug>MarkSearchNext
+"nmap # <Plug>MarkSearchPrev
" }}}
" Gundo ------------------------------------------------------------------- {{{
" nnoremap <F5> :GundoToggle<CR>
" nmap ,c <Plug>BookmarkClear
" nmap ,x <Plug>BookmarkClearAll
" }}}
-
+" EasyMotion -------------------------------------------------------------- {{{
+map en <Plug>(easymotion-sn)
+map ej <Plug>(easymotion-j)
+map ek <Plug>(easymotion-k)
+map eb <Plug>(easymotion-b)
+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\ $*
+"let g:tex_flavor='latex'
+"set iskeyword+=:
+"autocmd BufEnter *.tex set sw=2
+"disable default mapping
+imap #$ <Plug>IMAP_JumpForward
+nmap #$ <Plug>IMAP_JumpForward
+vmap #$ <Plug>IMAP_JumpForward
+vmap #$ <Plug>IMAP_DeleteAndJumpForward
+let g:Imap_FreezeImap=1
+" }}}
" }}}
" FileType ---------------------------------------------------------------- {{{
autocmd BufNewFile,BufRead *.log set filetype=logecc
autocmd BufNewFile,BufRead SConstruct set filetype=python
autocmd BufNewFile,BufRead SConscript* set filetype=python
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
+autocmd BufNewFile,BufRead *.c set filetype=cpp
+
" http://vim.wikia.com/wiki/Update_the_diff_view_automatically
autocmd InsertLeave,BufWritePost,CursorHold * if &diff == 1 | diffupdate | endif
" setlocal nomodifiable for svn diff
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>
-autocmd FileType python setlocal foldmethod=indent
+ \ 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 |
+ \ set list
autocmd FileType xml setlocal foldmethod=syntax |
\ let g:xml_syntax_folding=1
\ 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>
" }}}
"endif
function! DiffToggle()
if(&diff)
- diffoff | wincmd h | wincmd o
+ diffoff | wincmd l | :q
else
exec ":VCSVimDiff" | wincmd h
endif
" }}}
"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
" m
nnoremap B ^
nnoremap E $
-nnoremap <C-N> :cn<CR>
-nnoremap <C-P> :cp<CR>
+nnoremap <C-N> :cn<CR>zzzv
+nnoremap <C-P> :cp<CR>zzzv
"http://dougblack.io/words/a-good-vimrc.html
"nnoremap gV `[v`]
-set nostartofline " don't jump to first character when paging
-set nowrap
+"nnoremap <silent> <C-]> :let word=expand("<cword>")<CR>:vsp<CR>:wincmd w<cr>:exec("tag ". word)<cr>
+"nnoremap <silent> <C-]> :let word=expand("<cword>")<CR>:wincmd o<cr>:vsp<CR>:exec("tag ". word)<cr>zz:wincmd w<cr>
+" command in normal mode, and visual mode
+" yiw = viwy
+" diw = viwd
+" gn select search and in visual mode
+" confirm when using :q to quit the last tab page,
+"Alias q if\ winnr('$')>1||tabpagenr('$')>1||confirm('Really\ quit?',\ "&OK\\n&Cancel")==1|quit|endif
+
+
+
+" color of current line
+"let s:marklist = ''
+nnoremap <Leader>m :marks abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<CR>:normal '
+
+"let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'rtscript',
+" \ 'undo', 'line', 'changes', 'mixed', 'bookmarkdir']
+
+
+"" TODO:
+""