I'm trying to save my session in Vim with relative paths to open files. With cur_dir
in sessionoptions
, the paths to files will be relative wrt. current directory, but the session file contains cd /path/to/base/directory
command:
...
cd /path/to/base
badd +0 relpath1/file
badd +0 relpath2/file
...
If I leave curdir
out of sessionoptions, the cd
command disappears, but file paths will be absolute:
badd +0 /path/to/base/relpath1/file
badd +0 /path/to/base/relpath2/file
Is there a way to have only relative paths wrt. to whatever was the current directory when the session was created -- without plugins or writing scripts? So that the session file would only have:
badd +0 relpath1/file
badd +0 relpath2/file
My ultimate goal is to have a session file that I can copy around, e.g. from SVN checkout to another.
g:^cd :d
a bit? I'm still having issue to make it work. I found this line is critical but have no clue what it does. Thx. – Maryellen