diff plugins/hghelp/hghelp.vim @ 6:3017fd33ad8b

Better support for db tables. Adding some simple diffing support for hg.
author Luka Sitas <lsitas@avatarasoftware.com>
date Tue, 28 Oct 2025 15:26:12 -0400
parents
children 34930197e9d4
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/hghelp/hghelp.vim	Tue Oct 28 15:26:12 2025 -0400
@@ -0,0 +1,32 @@
+let g:hg_format_command = ""
+
+
+function! s:CommitWithFormat()
+  wa
+  if exists("g:hg_format_command") && !empty(g:hg_format_command)
+    execute '!'.g:hg_format_command
+  endif
+  execute '!hg addremove && hg commit'
+endfunction
+
+function! s:OpenHgDiff(file)
+  let l:current_file = a:file !=# '' ? a:file : expand('%')
+  let l:filetype = &filetype
+  let l:temp_file = tempname()
+  execute 'tabnew'
+  execute 'silent !hg cat -r . ' . l:current_file . ' > ' . l:temp_file
+  execute 'edit ' . l:temp_file
+  execute 'setfiletype' l:filetype
+  setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile 
+  execute 'vert diffsplit' l:current_file
+endfunction
+
+
+
+
+
+command HGDiff call s:OpenHgDiff(expand('%'))
+command Commit call s:CommitWithFormat()
+
+map <C-k> :Commit<CR>
+nnoremap <Leader>df :HGDiff<CR>