Skip to content

Commit

Permalink
Merge commit 'b43ea0e93cdaca3e6c26cdffe48ae5ccf7e3e4e9'
Browse files Browse the repository at this point in the history
  • Loading branch information
avdgaag committed Feb 26, 2015
2 parents efc0d03 + b43ea0e commit f0598b2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
5 changes: 3 additions & 2 deletions home/.vim/bundle/vim-eunuch/README.markdown
Expand Up @@ -3,9 +3,10 @@
Vim sugar for the UNIX shell commands that need it the most. Features
include:

* `:Unlink`: Delete a buffer and the file on disk simultaneously.
* `:Remove`: Like `:Unlink`, but doesn't require a neckbeard.
* `:Remove`: Delete a buffer and the file on disk simultaneously.
* `:Unlink`: Like `:Remove`, but keeps the now empty buffer.
* `:Move`: Rename a buffer and the file on disk simultaneously.
* `:Rename`: Like `:Move`, but relative to the current file's containing directory.
* `:Chmod`: Change the permissions of the current file.
* `:Mkdir`: Create a directory, defaulting to the parent of the current file.
* `:Find`: Run `find` and load the results into the quickfix list.
Expand Down
9 changes: 5 additions & 4 deletions home/.vim/bundle/vim-eunuch/doc/eunuch.txt
Expand Up @@ -21,13 +21,14 @@ based on the original file name.

COMMANDS *eunuch-commands*

*eunuch-:Unlink*
:Unlink[!] |:bdelete|, and, if successful, delete the file from
*eunuch-:Remove*
:Remove[!] |:bdelete|, and, if successful, delete the file from
disk. If a bang is given, it is passed along to
:bdelete.

*eunuch-:Remove*
:Remove[!] Alias for |:Unlink|.
*eunuch-:Unlink*
:Unlink[!] Delete the file from disk and reload the buffer.
If a bang is given, discard unsaved changes.

*eunuch-:Move*
:Move[!] {file} Like |:saveas|, but delete the old file afterwards.
Expand Down
13 changes: 10 additions & 3 deletions home/.vim/bundle/vim-eunuch/plugin/eunuch.vim
Expand Up @@ -21,16 +21,23 @@ function! s:separator()
return !exists('+shellslash') || &shellslash ? '/' : '\\'
endfunction

command! -bar -bang Unlink :
command! -bar -bang Unlink
\ if <bang>1 && &modified |
\ edit |
\ elseif delete(expand('%')) |
\ echoerr 'Failed to delete "'.expand('%').'"' |
\ else |
\ edit! |
\ endif

command! -bar -bang Remove
\ let s:file = fnamemodify(bufname(<q-args>),':p') |
\ execute 'bdelete<bang>' |
\ if !bufloaded(s:file) && delete(s:file) |
\ echoerr 'Failed to delete "'.s:file.'"' |
\ endif |
\ unlet s:file

command! -bar -bang Remove :Unlink<bang>

command! -bar -nargs=1 -bang -complete=file Move :
\ let s:src = expand('%:p') |
\ let s:dst = expand(<q-args>) |
Expand Down

0 comments on commit f0598b2

Please sign in to comment.