Skip to content

Instantly share code, notes, and snippets.

@microft
Created January 18, 2013 17: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 microft/4566260 to your computer and use it in GitHub Desktop.
Save microft/4566260 to your computer and use it in GitHub Desktop.
Vim function to forget undo history. Very usefull.
" A function to clear the undo history
function! <SID>ForgetUndo()
let old_undolevels = &undolevels
set undolevels=-1
exe "normal a \<BS>\<Esc>"
let &undolevels = old_undolevels
unlet old_undolevels
endfunction
command -nargs=0 ClearUndo call <SID>ForgetUndo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment