Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using such sessionopts:

set ssop=blank,buffers,sesdir,folds,localoptions,tabpages,winpos,winsize

The "sesdir" as opposed to "curdir" should store all the paths relative to the directory in which session file is located. Unfortunately there is a line in session file:

args absolute/path/to/file1 absolute/path/to/file2 and/so/on

How do I make vim use only relative paths so I could just put the session file into a git repo and resume my session from any machine?

share|improve this question

That sounds strange. When you set sesdir you declare the location of session will be set to be current working directory and all path in the session file will become relative path instead of absolute path.

I've used your sessionopts and it works. I can't find any line related to paths. How are you creating the session file? Standard is:

  1. :mksession [filename]
  2. vim -S [filename]
share|improve this answer

grosshat's solution doesn't work. Probably need to refer to Zsolt Botyaki's answer over on SO:

You can't do that without setting up a wrapper function for it, AFAIK.

function! MakeSession()
  let b:sessiondir = getcwd()
  let b:filename = b:sessiondir . '/session.vim'
  exe "mksession! " . b:filename
  exe "edit! " . b:filename
  exe "g:^cd :d"
  exe "x" 
endfunction
share|improve this answer
1  
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Ramhound Aug 28 '15 at 0:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .