diff plugin/lawrencium.vim @ 119:4ca40abecc2a

Add `:Hgremove` command.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 05 Oct 2015 22:56:00 -0700
parents 2e38e754c896
children 5168645017dd
line wrap: on
line diff
--- a/plugin/lawrencium.vim	Sun Mar 15 08:32:45 2015 -0700
+++ b/plugin/lawrencium.vim	Mon Oct 05 22:56:00 2015 -0700
@@ -1726,6 +1726,30 @@
 
 " }}}
 
+" Hgremove {{{
+
+function! s:HgRemove(bang, ...) abort
+    " Get the files to remove.
+    let l:filenames = a:000
+    if a:0 == 0
+        let l:filenames = [ expand('%:p') ]
+    endif
+    if a:bang
+        call insert(l:filenames, '--force', 0)
+    endif
+
+    " Get the repo and run the command.
+    let l:repo = s:hg_repo()
+    call l:repo.RunCommand('rm', l:filenames)
+
+    " Re-edit the file to see the change.
+    edit
+endfunction
+
+call s:AddMainCommand("-bang -nargs=* -complete=customlist,s:ListRepoFiles Hgremove :call s:HgRemove(<bang>0, <f-args>)")
+
+" }}}
+
 " Hglog, Hglogthis {{{
 
 function! s:HgLog(vertical, ...) abort