From: Samir Benmendil Date: Wed, 12 Aug 2015 00:24:38 +0000 (+0100) Subject: vim: add some options from dwyatt X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/771eb3ba0503e3a2c34767b4ae8a42da9591a5ae?ds=inline vim: add some options from dwyatt --- diff --git a/vim/vimrc b/vim/vimrc index e125596..1dce66c 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -70,6 +70,7 @@ Plugin 'octol/vim-cpp-enhanced-highlight' Plugin 'vim-scripts/mediawiki.vim' Plugin 'vim-scripts/replacewithregister' Plugin 'tpope/vim-abolish' +Plugin 'derekwyatt/vim-protodef' " remove entries first set runtimepath -=$HOME/.vim @@ -87,6 +88,9 @@ syntax on colorscheme badwolf " options {{{1 +" put $ and the end of text to be replaced with 'cw' and the likes +set cpoptions+=$ + " moving around, searching and patterns {{{2 set incsearch " show match for partly typed search command set ignorecase " ignore case when using a search pattern @@ -180,11 +184,15 @@ set pastetoggle= " key sequence to toggle paste mode set foldmethod=marker " folding type set foldlevelstart=0 " value for 'foldlevel' when starting to edit a file +" open folds when jumping to line +set foldopen+=jump + " save and restore folds set viewoptions=cursor " only save cursor position " diff mode {{{2 -set diffopt=filler,vertical +" vertical splits and ignore white space in diffs +set diffopt=filler,vertical,iwhite " reading and writing files {{{2 set modeline " read modelines @@ -230,7 +238,7 @@ set wildignore+=*.pyc " Python byte code set wildignore+=*.orig " Merge resolution files " various {{{2 -set virtualedit=block " let cursor move past last char in mode +set virtualedit=all " let cursor move past last char in mode set viminfo='100,<50,s10,h,n$XDG_CACHE_HOME/vim/viminfo " viminfo defaults but save file in .cache set viewdir=$XDG_CACHE_HOME/vim/view// @@ -332,10 +340,10 @@ vnoremap H ^ vnoremap L g_ " Heresy, emacs insert bindings -inoremap I -inoremap A -cnoremap -cnoremap +inoremap I +inoremap A +cnoremap +cnoremap " proper movement when lines are wrapped noremap j (v:count == 0 ? 'gj' : 'j') @@ -404,11 +412,18 @@ autocmd BufWinLeave *.* mkview autocmd BufWinEnter *.* silent loadview " save with sudo -cnoremap w!! w !sudo tee % > /dev/null +cabbrev w!! w !sudo tee % > /dev/null " uppercase previous word inoremap gUiwgi +" http://git.io/v3ZeU +nmap qq :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" + +" commands {{{1 +command! Cd lcd %:h +command! Cr execute('lcd ' . FindGitDirOrHome()) + " plugins options {{{1 " airline {{{2 let g:airline#extensions#whitespace#enabled = 1 @@ -593,6 +608,7 @@ nnoremap jd :YcmCompleter GoTo " vim-easy-align {{{2 " start interactive EasyAlign in visual mode vmap (EasyAlign) +nmap ga (EasyAlign) " vim-json {{{2 let g:vim_json_syntax_conceal = 0 @@ -682,3 +698,23 @@ endfunction nnoremap coS :call SwitchSpell() " fix spelling with first choice nnoremap f 1z= + +" gitdir or home {{{2 +" from derek wyatt: +" http://git.io/v3GAV +function! FindGitDirOrHome() + let filedir = expand('%:p:h') + if isdirectory(filedir) + let cmd = 'bash -c "(cd ' . filedir . '; git rev-parse --show-toplevel 2>/dev/null)"' + let gitdir = system(cmd) + if strlen(gitdir) == 0 + return '~' + else + return gitdir[:-2] + endif + else + return '~' + endif +endfunction + +" vim:set et sw=2 ts=2 tw=78: