I've finally decided it's time to start using the session feature in
Vim. It looks tremendously useful, and I don't know why I've skipped
this before.
I've read the relevant chapters in the help pages "starting.txt" and
"usr_21.txt"; are there any others I should be aware of?
Useful as it is, it looks like the session feature doesn't have a lot of
commands and options associated with it. I've only seen mksession and
sessionoptions. Among the things that I'm missing is a command to store
the state of the current session without specifying the path to the
session file again, an option to set a default directory where sessions
should be stored, and maybe a convenient way to list/select from
existing sessions (I suppose the last one isn't really possible because
session files could be stored anywhere).
I could create my own shortcuts and functions for this, of course, but
maybe somebody already took the time to create a few useful snippets for
session handling.
- Conrad
PS: sorry about asking a vim-only question when we've such a nice thread
about other editors going at the moment.
> I've finally decided it's time to start using the session feature
> in Vim. It looks tremendously useful, and I don't know why I've
> skipped this before.
>
> I've read the relevant chapters in the help pages "starting.txt"
> and "usr_21.txt"; are there any others I should be aware of?
>
> Useful as it is, it looks like the session feature doesn't have a lot of
> commands and options associated with it. I've only seen mksession and
> sessionoptions. Among the things that I'm missing is a command to store
> the state of the current session without specifying the path to the
> session file again, an option to set a default directory where sessions
> should be stored, and maybe a convenient way to list/select from
> existing sessions (I suppose the last one isn't really possible because
> session files could be stored anywhere).
By chance did you miss auto command? If so ....
"Useful" depends on your use. I use views instead of sessions (a
view is much more tolerable than a session) ...
let $cf = expand( "$HOME/cf" )
let $vim_cf = expand( "$cf/vim" )
let $view_dir = expand( "$vim_cf/.view-sess" )
...
set viewdir=$view_dir
set sessionoptions=blank,buffers,curdir,folds,winsize,slash,unix
...
au BufWinLeave * mkview
au BufWinEnter * silent loadview
...
One annoyance I encounter sometimes is that sometimes a plain ":cd"
(in vim) is different than the actual current directory, until I do
":cd .", followed by quitiing vim, followed by restarting vim.
Example ...
- in directory ~/two, I do "vim p" then quit vim;
- change to ~/one, and then "vim ~/two/p";
- ":cd" will show "~/two" when I really wanted to see "~/one". To
achieve that, I do ":cd .", quit vim, "vim ~/two/p".
... hmmm ... as I write this, I see that I have "curdir" in
"sessionoptions", I will try without that for few days.
- parv
--