Skip to content

Instantly share code, notes, and snippets.

@svenwin
Created May 12, 2011 16:59
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 svenwin/968940 to your computer and use it in GitHub Desktop.
Save svenwin/968940 to your computer and use it in GitHub Desktop.
vim clean close, preserve my splits
map fc <Esc>:call CleanClose()
function! CleanClose()
let todelbufNr = bufnr("%")
let newbufNr = bufnr("#")
if ((newbufNr != -1) && (newbufNr != todelbufNr) && buflisted(newbufNr))
exe "b".newbufNr
else
bnext
endif
if (bufnr("%") == todelbufNr)
new
endif
exe "confirm :bd".todelbufNr
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment