> Hi,
>
> I have a session problem, I can't find out how to resolve.
>
> This is my session configuration in _vimrc:
>
> set
> sessionoptions=blank,buffers,curdir,folds,tabpages,winsize,resize,winpos
> map<F12>s :mksession! C:/Progra~1/Vim/vimfiles/sessions/RW.ses<cr>
> map<F12>r :source C:/Progra~1/Vim/vimfiles/sessions/RW.ses<cr>
>
> " Updates/make a session
> function! UpdateSession()
> let b:sessionfile = 'C:/Progra~1/Vim/vimfiles/sessions/RW.ses'
> exe "mksession! " . b:sessionfile
> endif
> endfunction
>
> " Loads a session if it exists
> function! LoadSession()
> let b:sessionfile = 'C:/Progra~1/Vim/vimfiles/sessions/RW.ses'
> exe 'source ' b:sessionfile
> endfunction
>
> au VimEnter * :call LoadSession()
> au VimLeave * :call UpdateSession()
> map<leader>m :call UpdateSession()<CR>
>
> ------------------------------------------------------------------------------------
>
> Always the same error when I open GVIM:
> Error detected while processing C:/Progra~1/Vim/vimfiles/sessions/
> RW.ses:
> E163: There is only one file to edit
> Press enter or type command to continue
>
> BTW where can I find the message history?
> Some errors are passing so quick that I can't read them in time :-)
>
The message history is display by the ":messages" command. Error E163
probably means that your session file issues a ":next" command with an
argument list improperly set.
the "normal" way to start a session file would be
gvim -S '$VIM/vimfiles/sessions/RW.ses'
except that the "normal" extension for a session file is .vim, because
it is a Vim script. (If the name of the session file is Session.vim in
the $HOME directory, you can omit the name altogether, both in
:mksession and after -S )
If the above works, try adding (untested)
set nohidden
new
only
if winnr('$') > 1
echohl Error
echomsg 'Some buffers cannot be abandoned!'
echohl NONE
echoerr 'Please :quit! or :exit them'
return -1
endif
before the :exe line in your LoadSession function. (When starting Vim
with -S, the session file is sourced with only an empty [NoName] buffer
loaded, and that buffer displayed in the only window. That's what the
session file expects to find when it starts.)
Best regards,
Tony.
--
Of what you see in books, believe 75%. Of newspapers, believe 50%.
And of TV news, believe 25% -- make that 5% if the anchorman wears a
blazer.
--
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