On Thu, Dec 18, 2008 at 7:10 AM, Nicolas Aggelidis
<[email protected]> wrote:
>
> one more thing conserning sessions, i want to keep all the session
> files in a specific folder i.e. ~/sessions/session_name.vim
>
> is there any way to make vim save by default all sessions in the
> specific folder and load from this specific folder.
> so that i can do the following:
> mksession session_name.vim
> source session_name.vim
>
> if this is not possible, can i define a sort of variable so that i can
> something like this:
>
> mksession $SESSION_DIR/session_name.vim
> source $SESSION_DIR/session_name.vim
The simplest way to do this is probably to write your own commands to
load and save the sessions. As a bonus, these commands could do the
toggling of autochdir for you. My preference for any remotely complex
command is to write a function and bind the command to the function:
let g:my_session_dir = '~/.vim/sessions'
function! MakeSession(sessionName)
set noautochdir
" I'd love to know if there's a way to avoid :exe here.
exe ':mksession! ' . g:my_session_dir . '/' . a:sessionName
set autochdir
endfunction
command! -nargs=1 MKSession :call MakeSession(<f-args>)
The above is barely tested. I'll leave "loadession" as an exercise
for the reader. Relevant help sections in the manual are:
:he user-commands
:he 40.2
:he user-functions
:he 41.7
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---