sponsor Vim development Vim logo Vim Book Ad

restore_view.vim : A plugin for automatically restoring file's cursor position and folding

 script karma  Rating 159/82, Downloaded by 5824  Comments, bugs, improvements  Vim wiki

created by
Yichao Zhou
 
script type
utility
 
description
This is plugin for automatically restore one file's cursor position and folding information after restart vim.

This is a simple script to autosave cursor position and fold
information using vim\\'s mkview.  Although you can easily do this job by
just add serveral line to {.,_}vimrc, write a script plugin can make it
more clean and nice.  We assume you use a new enough vim to enjoy
these feature. Hope you love it:)
                                                                        
Views are only be saved when you save/write a file or EXIT VIM.
    
Suggested Setting:
Please put them in you vimrc:
set viewoptions=cursor,folds,slash,unix
" let g:skipview_files = ['*\.vim']
                                                                  
Set it in a plugin file looks dirty to me.  So you\\'d better do it your
self.  This only keywords not in viewoptions is \\\"options\\\". I believe it
does not belong to a view.  If you think you need it, feel free to
put it in.  If you do not want views of some files to be saved, please
set g:loaded_restore_view. The longer time you use, the bigger view
folder you will have.  So if you use UNIX environment, you may need to
use cron to do some clean job.
 
install details
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
restore_view.vim 1.3 2014-11-20 7.0 Yichao Zhou Disable mkview and load view when 'diff' is enabled.

Thanks Enno Nagel for the discussion and suggestion.
restore_view.vim 1.2 2014-07-23 7.0 Yichao Zhou Modify the check function.  Silent both mkview and loadview.  Stop saving view when leaving buffer.

Thanks Enno Nagel for the discussion and suggestion.
restore_view.vim 1.1 2012-04-18 7.0 Yichao Zhou Now g:skipview_files can be regular expression.
restore_view.vim 1.0 2012-04-18 7.0 Yichao Zhou Initial upload
ip used for rating: 44.197.251.102

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github