Mercurial > vim-lawrencium
diff plugin/lawrencium.vim @ 70:16e873b2a4a8
Added `Hgvimgrep` command.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 09 Nov 2013 13:20:17 -0800 |
parents | 8c9aca0e4322 |
children | 1fbba48019b5 |
line wrap: on
line diff
--- a/plugin/lawrencium.vim Wed Sep 25 18:33:33 2013 +0400 +++ b/plugin/lawrencium.vim Sat Nov 09 13:20:17 2013 -0800 @@ -1016,6 +1016,30 @@ " }}} +" Hgvimgrep {{{ + +function! s:HgVimGrep(bang, pattern, ...) abort + let l:repo = s:hg_repo() + let l:file_paths = [] + if a:0 > 0 + for ff in a:000 + let l:full_ff = l:repo.GetFullPath(ff) + call add(l:file_paths, l:full_ff) + endfor + else + call add(l:file_paths, l:repo.root_dir . "**") + endif + if a:bang + execute "vimgrep! " . a:pattern . " " . join(l:file_paths, " ") + else + execute "vimgrep " . a:pattern . " " . join(l:file_paths, " ") + endif +endfunction + +call s:AddMainCommand("-bang -nargs=+ -complete=customlist,s:ListRepoFiles Hgvimgrep :call s:HgVimGrep(<bang>0, <f-args>)") + +" }}} + " Hgdiff, Hgvdiff {{{ function! s:HgDiff(filename, vertical, ...) abort