xolox / vim-session

Extended session management for Vim (:mksession on steroids)
http://peterodding.com/code/vim/session/
961 stars 80 forks source link

Vimrc not correctly loaded #133

Closed KillianKemps closed 9 years ago

KillianKemps commented 9 years ago

I'm encountering this issue on two vim installations with the same vimrc.

For some reason, everything seems to work fine when I open my session but not the following mapping:

vnoremap <Tab> >gv
vnoremap <S-Tab> <gv

However, if I manually source the vimrc file, it works again.

Do you have an idea where the issue relies ? Thank you.

xolox commented 9 years ago

Off the top of my head I don't know what would cause this.

Can you check the contents of the session script (try :ViewSession while you're inside the session) for *map commands? Maybe they are being persisted in a 'corrupt' way that breaks your vimrc mappings, possibly in interaction with other plug-ins. This really shouldn't happen IIUC because vim-session changes 'sessionoptions' so as not to persist mappings in sessions scripts, but who knows...

If you don't know how to you can also attach the session script here or post it somewhere online and provide a link in this issue. Please make sure the session script doesn't contain any private data though ;-).

KillianKemps commented 9 years ago

Thank you for your fast reply.

Is it normal that doing :ViewSession slows down my Vim?

I didn't find *map commands in the session though. :/

Here is my vim session if you're curious (it should have no private data): https://www.zerobin.net/?a8439d5b15699479#U1lsN878TBufk1D+KQp7k3Mo7rYPMH0E18D3BYnkR1M=

xolox commented 9 years ago

Is it normal that doing :ViewSession slows down my Vim?

Your session includes a quick-fix list that serializes to 3.7 MB (!) of Vim script code, all on a single line (it looks like you searched for 'map'? ;-). My Vim was a bit slow to show your session script as well and in fact I had to try three web browsers to open that zerobin link because the first two just jumped to 100% CPU and became unresponsive. Probably all related to that 3.7 MB line :-).

I didn't find *map commands in the session though. :/

I also can't find anything "suspicious" or "out of place" about your session script. Hmmm... Does this happen with all sessions? Or do you only use a single default session?

Also, if you run the following two Vim commands:

vnoremap <Tab>
vnoremap <S-Tab>

What output do you get? Does that output change once you've manually sourced your vimrc?

xolox commented 9 years ago

I just remembered, if the output of the two Vim commands I gave differs before and after loading your vimrc, you can try these commands to (try to) find out where the (wrong) map definitions are coming from:

verbose vnoremap <Tab>
verbose vnoremap <S-Tab>
KillianKemps commented 9 years ago

Thank you very much for your help! I found the problem.

I followed your instructions and in fact the output of vnoremap <Tab> was different before and after sourcing the vimrc. The issue is a conflict with another plugin (SirVer/Ultisnips) and it happens without having to open a session.

This was the output of vnoremap <Tab> before sourcing vimrc:

s  <Tab>       * <Esc>:call UltiSnips#ExpandSnippet()<CR> 
x  <Tab>       * :call UltiSnips#SaveLastVisualSelection()<CR>gvs vnoremap <Tab>

And after:

v   <Tab>        * >gv

So it is not an issue related to your plugin. Sorry for the inconvenience, I should have tried it before without the session plugin.