Thursday, June 30, 2011

Re: Saving netrw hide list to session file

* Charles Campbell <Charles.E.Campbell@nasa.gov> [110630 11:18]:
> Tim Johnson wrote:
> >Using vim 7.2 on ubuntu 10.04, huge version.
> >
> >I make use of Dr. Campbell's netrw browse window, which has the
> >ctrl-h feature that allows me to edit the hide list.
> >
> >The hide list is associated with g:netrw_list_hide. I would like to
> >be able to save that variable to my session file. However, when I
> >save the session, I do not see that the g:netrw_list_hide is saved.
> >In fact g:netrw_list_hide is not even defined until netrw is first
> >invoked.
> >
> >Is it possible to save g:netrw_list_hide?
> >
>
> Hello!
Thank you for the quick reply.
> From the vim manual, under :help mks...
Understood.
> 2. Restores global variables that start with an uppercase letter and contain
> at least one lowercase letter, if 'sessionoptions' contains "globals".
>
> So, unfortunately, g:netrw_list_hide does not satisfy that constraint.
>
> I checked into whether this process could be automated;
> unfortunately, there does not appear to be a SessionWritePre autocmd
> event. If there was, something like

> au SessionWritePre * let g:Netrw_list_hide= g:netrw_list_hide
I put let g:Netrw_list_hide= g:netrw_list_hide into
the 'wrapper' function that saves the session.
"" Save session after confirmation
function! TjSaveSession()
let g:Netrw_list_hide = g:netrw_list_hide
let res = input("Save Session: [" . v:this_session ."] (Y/N)")
if res == "y"
exe ':call AutoSaveVimSesn()'
endif
endfunction
"" Global variable saved

> au SessionLoadPost * let g:netrw_list_hide= g:Netrw_list_hide
And the line above in my .vimrc
> might work.
And now it works!

Thanks for the solution.
regards
--
Tim
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment