Commits

Ian Liu Rodrigues  committed 66d06a8

Add Hgdiff and file navigation in Hgstatus

  • Participants
  • Parent commits f4191e4

Comments (0)

Files changed (1)

File plugin/hg2o.vim

 " Hgstatus {{{1
 com! -nargs=0 Hgstatus :execute s:Hgstatus()
 
+fun! s:CRStatus()
+  let line = getline('.')
+  if line =~# '^[MA] '
+    wincmd p
+    execute 'edit '.line[2:]
+  endif
+endf
+
 fun! s:Hgstatus()
   pedit hg2o://status
   wincmd P
+  nnoremap <buffer> <silent> q    :<C-U>bdelete<CR>
+  nnoremap <buffer> <silent> <CR> :<C-U>exe <SID>CRStatus()<CR>
   silent execute '0read !'.s:HG.' status'
-  setlocal nomodifiable nomodified readonly ft=hgstatus
+  setlocal bufhidden=wipe nomodifiable nomodified readonly ft=hgstatus
 endf
 " }}}1
+" Hgdiff {{{1
+com! -nargs=0 Hgdiff :execute s:Hgdiff()
+
+fun! s:Hgdiff()
+  let ft = &ft
+  let path = expand('%')
+  let file = expand('%:t')
+  diffthis
+  execute 'vnew hg2o://diff/'.file
+  silent execute '0read !'.s:HG.' cat '.path
+  execute 'setlocal ft='.ft
+  setlocal bufhidden=wipe readonly nomodified nomodifiable
+  diffthis
+  wincmd p
+endf
+" }}}1