On 02/07/09 19:31, jorges wrote:
>
> Hi,
> I finally spent some time adding some session related stuff into my
> vimrc. It is apparently working OK, but I started noticing some subtle
> problems: at least one plugin has stopped working (EnhancedCommentify)
> and I noticed also that tab completion (activated by wildmenu option)
> seems to have stopped working also.
> With EnhancedCommentify, vim is complaining that some variable don't
> exist. They are b:xxx variables (local to buffers), so I guessed they
> weren't saved? Should I manually save them? Any ideas?
> BTW, the relevant part of my vimrc is (copied from vim wiki, can't
> remember exactly from where, then adapted to my liking):
>
> set sessionoptions+=winpos
> set sessionoptions+=winsize
>
>
> augroup sessions
> " Creates a session
> function! MakeSession()
> if (exists("g:session_file") == 0)
> let b:sessiondir = getcwd()
> let b:filename = b:sessiondir . '/session.vim'
> else
> let b:filename = g:session_file
> endif
> if (filereadable(b:filename))
> let b:answer = input("File session.vim already exists,
> " .
> \ "overwrite(y/[n])?")
> if (tolower(b:answer) != 'y')
> return
> endif
> endif
> exe "mksession! " . b:filename
> let g:session_file = b:filename
> endfunction
>
> " Updates a session, BUT ONLY IF IT ALREADY EXISTS
> function! UpdateSession()
> if (filereadable(g:session_file))
> exe "mksession! " . g:session_file
> endif
> endfunction
>
> " Loads a session if it exists
> function! LoadSession()
> let b:sessionfile = getcwd() . "/session.vim"
> if (filereadable(b:sessionfile))
> let answer = input("Restore previously saved session
> (y/[n])?")
> if (tolower(answer) == 'y')
> let g:session_file = b:sessionfile
> exe 'source ' . b:sessionfile
> endif
> endif
> endfunction
>
> au VimEnter * :call LoadSession()
> au VimLeave * :call UpdateSession()
> map<leader>m :call MakeSession()<CR>
> augroup END
>
> Thanks in advance,
>
> jorge
Global Number and String variables with names of the form
SOME_VARIABLE_NAME (i.e., starting with an uppercase letter and
containing no lowercase letter) are saved in the viminfo file if
'viminfo' includes the ! flag.
Global Number and String variables of the form SomeVariable (starting
with an uppercase letter and containing at least one lowercase letter)
are saved by :mksession if 'sessionoptions' includes "globals".
Other global variables, including all Lists, Dictionaries, Funcrefs and
Floats, are not saved.
IIUC what is said in the help; local variables are not saved. But those
which are set by filetype-plugins (or by autocommands) should be
recreated when the file is reloaded. This includes e.g. the buffer-local
variables used to make matchit jump properly according to the filetype,
if the filetype-plugin is "matchit-aware".
I don't use EnhancedCommentify, but if you need to set buffer-local
variables to make it work properly for a given filetype, you could place
the appropriate "let b:<name> = <expression>" statement(s) in a file
named (on Unix) ~/.vim/after/ftplugin/<filetype>.vim or (on Windows)
~/vimfiles/after/ftplugin/<filetype>.vim where <filetype> is of course
the filetype. Create the files and directories if they don't exist yet.
Best regards,
Tony.
--
"Outside of a dog, a book is a man's best friend: and inside a dog,
it's too dark to read."
-- Groucho Marx
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---