Mercurial > vim-lawrencium
changeset 119:4ca40abecc2a
Add `:Hgremove` command.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 05 Oct 2015 22:56:00 -0700 |
parents | 7cfe9ba2c7dd |
children | a290dc47e534 |
files | doc/lawrencium.txt plugin/lawrencium.vim |
diffstat | 2 files changed, 34 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/lawrencium.txt Sun Mar 15 08:32:45 2015 -0700 +++ b/doc/lawrencium.txt Mon Oct 05 22:56:00 2015 -0700 @@ -162,13 +162,22 @@ :Hgrevert {files} *:Hgrevert* Reverts the given files (in repo-relative paths). If no - file are given, reverts the current file. + files are given, reverts the current file. :Hgrevert! {files} *:Hgrevert!* Same as |:Hgrevert| but with the --no-backup option given to prevent a .orig backup file from being created. +:Hgremove {files} *:Hgremove* + Removes the given files (in repo-relative paths). If + no files are given, removes the current file. + +:Hgremove! {files} *:Hgremove!* + Same as |:Hgremove| but with the --force option given + to remove the file even if it is currently added or + modified. + *:Hglog* :Hglog Opens the history (log) for the current repository
--- 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