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 autoindent
set confirm
set nostartofline " don't jump to first character when paging
-set nowrap
+set wrap
+set expandtab
+"set textwidth, formatoptions for chinese
+set formatoptions+=m
+set colorcolumn=+1
syntax on
" colorscheme {{{
set cursorline
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 <S-SPACE> <C-B>
" 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>
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
-let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
+"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_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 =''
" }}}
" 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 el <Plug>(easymotion-lineforward)
+map eh <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>
+ \ 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 xml setlocal foldmethod=syntax |
\ setlocal formatoptions-=c formatoptions-=r formatoptions-=o |
\ let b:AutoClosePairs = AutoClose#DefaultPairsModified("", "{} \"")
+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
" 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`]
+"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']
+
+