e7931486f06b

Vim stuff
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 01 Dec 2015 00:46:35 +0000
parents c68485e8d84b
children d1d3411ab22e
branches/tags (none)
files .hgsubstate vim/vimrc

Changes

--- 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
--- 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 <leader>Go :Start! git push origin<cr>
 nnoremap <leader>Gu :Start! git push upstream<cr>
-nnoremap <leader>Hd :Start! hg push default<cr>
-nnoremap <leader>Hu :Start! hg push upstream<cr>
 
 " 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 :<c-u>normal! [zv]z<cr>
+onoremap af :<c-u>normal! [zV]z<cr>
+vnoremap if :<c-u>normal! ]zv[z<cr>
+vnoremap af :<c-u>normal! ]zV[z<cr>
+
+" }}}
 " 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<space> - raw hg commands
+
+nnoremap <leader>hc :Start hg commit<cr> 
+
+nnoremap <leader>hpd :Start! hg push default<cr>
+nnoremap <leader>hpu :Start! hg push upstream<cr>
 
 function! s:HgDiff() " {{{
     diffthis
@@ -2504,10 +2556,10 @@
 command! -nargs=0 HgDiff call s:HgDiff()
 
 " Diff the current file
-nnoremap <leader>hd :HgDiff<cr>
+nnoremap <leader>hD :HgDiff<cr>
 
 " Diff the entire repo
-nnoremap <leader>hD :Clam hg diff<cr>:set ft=diff nowrap<cr>
+nnoremap <leader>hd :Clam hg diff<cr>:set ft=diff nowrap<cr>
 
 function! s:HgBlame() " {{{
     let fn = expand('%:p')
@@ -2529,7 +2581,7 @@
     syncbind
 endfunction " }}}
 command! -nargs=0 HgBlame call s:HgBlame()
-nnoremap <leader>hb :HgBlame<cr>
+nnoremap <leader>hB :HgBlame<cr>
 
 function! s:HgStatus() " {{{
     Clam hg status