# HG changeset patch # User Ludovic Chabant # Date 1384032017 28800 # Node ID 16e873b2a4a8421fcbcf9a1b57ee0bbfe6bbe358 # Parent 8c9aca0e4322f56bce43204a172f9d18b67f0cc2 Added `Hgvimgrep` command. diff -r 8c9aca0e4322 -r 16e873b2a4a8 doc/lawrencium.txt --- a/doc/lawrencium.txt Wed Sep 25 18:33:33 2013 +0400 +++ b/doc/lawrencium.txt Sat Nov 09 13:20:17 2013 -0800 @@ -178,6 +178,12 @@ are available in this window. See |lawrencium-annotate-window|. + *:Hgvimgrep* +:Hgvimgrep Runs a |:vimgrep| command inside the current + repository. The files in which to search can be + provided with repository-relative names. If no file is + given, the search will be run in the whole repository. + ============================================================================= 3. Status Window *lawrencium-status-window* diff -r 8c9aca0e4322 -r 16e873b2a4a8 plugin/lawrencium.vim --- 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(0, )") + +" }}} + " Hgdiff, Hgvdiff {{{ function! s:HgDiff(filename, vertical, ...) abort