# HG changeset patch # User Steve Losh # Date 1448930795 0 # Node ID e7931486f06bc13ad3116dc2bc44732c14529251 # Parent c68485e8d84b1d0a0f225b48e0d76bfe01e40195 Vim stuff diff -r c68485e8d84b -r e7931486f06b .hgsubstate --- a/.hgsubstate Sat Nov 28 21:52:21 2015 +0000 +++ b/.hgsubstate Tue Dec 01 00:46:35 2015 +0000 @@ -12,7 +12,7 @@ c1646e3c28d75bcc834af4836f4c6e12296ba891 vim/bundle/ctrlp 38487bbec8ba50834e257940b357de03991fa8f9 vim/bundle/delimitmate ffbd5eb50c9daf67657b87fd767d1801ac9a15a7 vim/bundle/dispatch -3a843cb1b183bd853b843fbaef89af27b726ac25 vim/bundle/fireplace +86e03d6b632426399b666ec994307d7e07e91961 vim/bundle/fireplace 935a2cccd3065b1322fb2235285d42728600afdf vim/bundle/fugitive 6e9f52a160e3d15060848a8f453bd1b5bfa70db2 vim/bundle/gnupg 0d57b080f9fae8573c688b6679b31eb1666edc4c vim/bundle/gnuplot diff -r c68485e8d84b -r e7931486f06b vim/vimrc --- a/vim/vimrc Sat Nov 28 21:52:21 2015 +0000 +++ b/vim/vimrc Tue Dec 01 00:46:35 2015 +0000 @@ -462,8 +462,6 @@ " Pushing nnoremap Go :Start! git push origin nnoremap Gu :Start! git push upstream -nnoremap Hd :Start! hg push default -nnoremap Hu :Start! hg push upstream " Zip Right " @@ -1040,6 +1038,35 @@ augroup END " }}} +" Diff {{{ + +" This is from https://github.com/sgeb/vim-diff-fold/ without the extra +" settings crap. Just the folding expr. + +function! DiffFoldLevel() + let l:line=getline(v:lnum) + + if l:line =~# '^\(diff\|Index\)' " file + return '>1' + elseif l:line =~# '^\(@@\|\d\)' " hunk + return '>2' + elseif l:line =~# '^\*\*\* \d\+,\d\+ \*\*\*\*$' " context: file1 + return '>2' + elseif l:line =~# '^--- \d\+,\d\+ ----$' " context: file2 + return '>2' + else + return '=' + endif +endfunction + +augroup ft_diff + au! + + autocmd FileType diff setlocal foldmethod=expr + autocmd FileType diff setlocal foldexpr=DiffFoldLevel() +augroup END + +" }}} " Django {{{ augroup ft_django @@ -2109,6 +2136,14 @@ " }}} " Text objects ------------------------------------------------------------ {{{ +" Folds {{{ + +onoremap if :normal! [zv]z +onoremap af :normal! [zV]z +vnoremap if :normal! ]zv[z +vnoremap af :normal! ]zV[z + +" }}} " Shortcut for [] {{{ onoremap ir i[ @@ -2480,6 +2515,23 @@ " }}} " Hg {{{ +" +" \hc - hg commit +" \hd - hg diff +" \hs - hg status +" +" \hpd - hg push default +" \hpu - hg push upstream +" +" \hB - hg blame (current file) +" \hD - hg diff (current file) +" +" \h - raw hg commands + +nnoremap hc :Start hg commit + +nnoremap hpd :Start! hg push default +nnoremap hpu :Start! hg push upstream function! s:HgDiff() " {{{ diffthis @@ -2504,10 +2556,10 @@ command! -nargs=0 HgDiff call s:HgDiff() " Diff the current file -nnoremap hd :HgDiff +nnoremap hD :HgDiff " Diff the entire repo -nnoremap hD :Clam hg diff:set ft=diff nowrap +nnoremap hd :Clam hg diff:set ft=diff nowrap function! s:HgBlame() " {{{ let fn = expand('%:p') @@ -2529,7 +2581,7 @@ syncbind endfunction " }}} command! -nargs=0 HgBlame call s:HgBlame() -nnoremap hb :HgBlame +nnoremap hB :HgBlame function! s:HgStatus() " {{{ Clam hg status