comparison plugins/hghelp/hghelp.vim @ 8:9c80955f0c6e

I think I got popups working on the commit
author Luka Sitas <lsitas@avatarasoftware.com>
date Fri, 31 Oct 2025 14:24:31 -0400
parents 34930197e9d4
children 17c557de03e0
comparison
equal deleted inserted replaced
7:34930197e9d4 8:9c80955f0c6e
1 let g:hg_format_command = "" 1 let g:hg_format_command = ""
2 2
3
4 function PopupCommand(command)
5 let buf = term_start(a:command, {'hidden': 1, 'term_finish': 'close'})
6 let winid = popup_create(buf, {'minwidth': 50, 'minheight': 20})
7 endfunction
8
9 function ExecuteCommand(command)
10 return system(a:command . ' 2>&1')
11 endfunction
3 12
4 function! s:CommitWithFormat() 13 function! s:CommitWithFormat()
5 wa 14 wa
6 if exists("g:hg_format_command") && !empty(g:hg_format_command) 15 if exists("g:hg_format_command") && !empty(g:hg_format_command)
7 execute '!'.g:hg_format_command 16 execute '!'.g:hg_format_command
8 endif 17 endif
9 execute '!hg addremove && hg commit' 18 execute
19 call ExecuteCommand('!hg addremove')
20 call PopupCommand('hg commit')
10 endfunction 21 endfunction
11 22
12 function! s:OpenHgDiff(file) 23 function! s:OpenHgDiff(file)
13 let l:current_file = a:file !=# '' ? a:file : expand('%') 24 let l:current_file = a:file !=# '' ? a:file : expand('%')
14 let l:filetype = &filetype 25 let l:filetype = &filetype
15 let l:temp_file = tempname() 26 let l:temp_file = tempname()
16 let l:command = 'hg cat -r . ' . l:current_file . ' > ' . l:temp_file 27 let l:command = 'hg cat -r . ' . l:current_file . ' > ' . l:temp_file
17 let result = system(l:command . ' 2>&1') 28 call ExecuteCommand(l:command)
18 execute 'tabe ' . l:temp_file 29 execute 'tabe ' . l:temp_file
19 execute 'setfiletype' l:filetype 30 execute 'setfiletype' l:filetype
20 setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile 31 setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile
21 execute 'vert diffsplit' l:current_file 32 execute 'vert diffsplit' l:current_file
22 endfunction 33 endfunction