Created
January 23, 2018 12:40
-
-
Save matiasfha/761677029ce81ed75af140eabd4da1f4 to your computer and use it in GitHub Desktop.
Delete current file in vim and close the buffer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Delete the current file and close the buffer | |
function! DeleteFileAndCloseBuffer() | |
let b:choice = confirm("Delete file and close buffer?", "&Yes\n&No",1) | |
if b:choice == 1 | |
call delete(expand('%:p')) | bdelete! | |
endif | |
endfunction | |
" Map to ;rm | |
nnoremap <silent> <leader>rm :call DeleteFileAndCloseBuffer()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment