Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 5:4a7bc1c8551b | 6:3017fd33ad8b |
|---|---|
| 1 let g:hg_format_command = "" | |
| 2 | |
| 3 | |
| 4 function! s:CommitWithFormat() | |
| 5 wa | |
| 6 if exists("g:hg_format_command") && !empty(g:hg_format_command) | |
| 7 execute '!'.g:hg_format_command | |
| 8 endif | |
| 9 execute '!hg addremove && hg commit' | |
| 10 endfunction | |
| 11 | |
| 12 function! s:OpenHgDiff(file) | |
| 13 let l:current_file = a:file !=# '' ? a:file : expand('%') | |
| 14 let l:filetype = &filetype | |
| 15 let l:temp_file = tempname() | |
| 16 execute 'tabnew' | |
| 17 execute 'silent !hg cat -r . ' . l:current_file . ' > ' . l:temp_file | |
| 18 execute 'edit ' . l:temp_file | |
| 19 execute 'setfiletype' l:filetype | |
| 20 setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile | |
| 21 execute 'vert diffsplit' l:current_file | |
| 22 endfunction | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 command HGDiff call s:OpenHgDiff(expand('%')) | |
| 29 command Commit call s:CommitWithFormat() | |
| 30 | |
| 31 map <C-k> :Commit<CR> | |
| 32 nnoremap <Leader>df :HGDiff<CR> |
