Skip to content

Instantly share code, notes, and snippets.

@soh335
Created August 22, 2009 02:03
Show Gist options
  • Save soh335/172587 to your computer and use it in GitHub Desktop.
Save soh335/172587 to your computer and use it in GitHub Desktop.
"{{{save start state
au BufRead * call <SID>SaveStart()
function! s:SaveStart()
let tmp = @@
silent normal ggyG
let b:start_object = @@
let @@ = tmp
endfunction
function! s:UndoStart()
if !exists("b:start_object")
return
end
let t = getpos('.')
let tmp = @@
silent normal ggdG
call append(0, split(b:start_object, '\n'))
silent normal Gdd
let @@ = tmp
call setpos('.', t)
endfunction
command! UndoStart :call <SID>UndoStart()
"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment