Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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" 
share|improve this answer
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 at 0:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.