Skip to content

Instantly share code, notes, and snippets.

@twymer
Created May 20, 2011 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twymer/983131 to your computer and use it in GitHub Desktop.
Save twymer/983131 to your computer and use it in GitHub Desktop.
Move a file to a new location, open this new file, and delete the old buffer.
function! s:movefunction(arg)
let oldnum = bufnr("%")
let newname = a:arg
execute "!mv %" . " " . newname
exe "new " . newname
exe "bd" . oldnum
endfunction
command! -nargs=* Newmv call s:movefunction('<args>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment