Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist markers into session? #180

Open
eduardoarandah opened this issue Aug 23, 2019 · 1 comment
Open

Persist markers into session? #180

eduardoarandah opened this issue Aug 23, 2019 · 1 comment

Comments

@eduardoarandah
Copy link

I’ve been looking all over the place to save/load my markers in a session instead of globally (which I find pretty dumb tbh)

So, let’s say I have an “I” marker for the info.txt in each project, doesn’t mix with the info.txt in another project.

I’ve read that :wv and :rv let you create a viminfo file in another location. And that’s exactly what I want to happen when I have a session.

Is this possible?

If so, would you consider integrating it? I’d like to contribute but have no idea about vimscript 😅

@eduardoarandah
Copy link
Author

This provides a great idea to create a viminfo file that autosaves/autoloads with same name as the session:

https://vi.stackexchange.com/questions/17091/can-capitalized-marks-be-saved-in-session-instead-of-viminfo/17093#17093

command! -bang -complete=file -nargs=? Mksession mksession<bang> <args> |
      \ let [s:viminfofile, s:viminfo] = [&viminfofile, &viminfo] |
      \ try |
      \   let [&viminfofile, &viminfo] = [v:this_session . '.viminfo', 'f'] |
      \   wviminfo! |
      \ finally |
      \   let [&viminfofile, &viminfo] = [s:viminfofile, s:viminfo] |
      \ endtry

augroup ViminfoSessionRestore
  autocmd!
  autocmd SessionLoadPost * |
        \ let [s:viminfofile, s:viminfo] = [&viminfofile, &viminfo] |
        \ try |
        \   let [&viminfofile, &viminfo] = [v:this_session . '.viminfo', 'f'] |
        \   rviminfo! |
        \ finally |
        \   let [&viminfofile, &viminfo] = [s:viminfofile, s:viminfo] |
        \ endtry
augroup END

so your sessions directory would look like:

project1
project1.viminfo
project2
project2.viminfo

I tried it but couldn't make progress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant