I am trying to manage multiple projects each with multiple files so:

               file1.cpp, ..., file10.cpp
               incl1.h, ..., incl10.h

               file1.cpp, ..., file10.cpp
               incl1.h, ..., incl10.h

I would like to save bookmark information for a project locally as a file under each projectx (x=1 or 2) folder itself as opposed to saving it globally under $home/.vim/.

Is there any way one can have project specific bookmarks saved locally (in the project folder itself) that is also portable across machines accessing the same folder (i.e., the paths saved necessarily have to be relative and not absolute.)?

I tried to setup .viminfo thus via the .vimrc based on a suggestion here:

set viminfo=%,<800,'100,/50,:100,f1,n./.viminfo

This saves the viminfo file in the projectx folder. However, this .viminfo file also stores the path to marks using absolute path and not relative paths as a result of which, it is not portable.

  • Can you give more information on what kind of bookmarks you want? AFAIK the easy ways are sessions or global marks, neither of which is likely to be portable. Also note that plugin requests are off-topic: I encourage you to edit the question to ask how to solve your problem (and perhaps an answer will say “here’s a plugin”).
    – D. Ben Knoble
    Sep 4, 2021 at 11:41
  • I have edited to ask the question specifying my particular problem.
    – Tryer
    Sep 4, 2021 at 16:19

1 Answer 1


I have decided to adopt the following strategy.

The output of $pwd from the projectx folder on one machine contains the words /mnt/c (standing for WSL on Windows), while the other does not.

So, I defined in my .vimrc the following:

let g:machine_run_on_wsl = system("pwd | grep -c '/mnt/c'") 
if g:machine_run_on_wsl == 1    
    set viminfo=%,<800,'100,/50,:100,f1,n./.vim/.viminfowsl 
    set viminfo=%,<800,'100,/50,:100,f1,n./.vim/.viminfoubuntu  

This way, there are two .viminfo files within .\.vim subfolder of projectx. Even though each of these files (.viminfowsl and .viminfoubuntu) has absolute paths, they are the right absolute paths for the respective machine I am currently working on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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