Advertisement
voyeg3r

preserve.vim

Aug 18th, 2021
2,972
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 0.36 KB | None | 0 0
  1. " vim preserve function
  2. if !exists('*Preserve')
  3.     function! Preserve(command)
  4.         try
  5.             let l:win_view = winsaveview()
  6.             "silent! keepjumps keeppatterns execute a:command
  7.             silent! execute 'keeppatterns keepjumps ' . a:command
  8.         finally
  9.             call winrestview(l:win_view)
  10.         endtry
  11.     endfunction
  12. endif
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement