Skip to content

Instantly share code, notes, and snippets.

@saihoooooooo
Created December 8, 2011 06:48
Show Gist options
  • Save saihoooooooo/1446321 to your computer and use it in GitHub Desktop.
Save saihoooooooo/1446321 to your computer and use it in GitHub Desktop.
drop undo info
nnoremap xU :<C-u>call <SID>DropUndoInfo()<CR>
function! s:DropUndoInfo()
if &modified
echoerr "This buffer has been modified!"
return
endif
let l:old_undolevels = &undolevels
set undolevels=-1
execute "normal! aa\<BS>\<ESC>"
let &modified = 0
let &undolevels = l:old_undolevels
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment