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

project-local history #9

Open
Konfekt opened this issue Oct 23, 2024 · 4 comments
Open

project-local history #9

Konfekt opened this issue Oct 23, 2024 · 4 comments

Comments

@Konfekt
Copy link

Konfekt commented Oct 23, 2024

how about a project-local history as well?

@leafOfTree
Copy link
Owner

Hi there. Thanks for your idea.
Can you share more details about project-local history?

Just as you know, vim-project supports project-local session. You can enable it by setting

let g:vim_project_config = {
      \...
      \'use_session': 1,
      \...
      \}

@Konfekt
Copy link
Author

Konfekt commented Oct 28, 2024

Sounds useful to switch sessions with branches.

The project-local history contains all commands, searches, marks,buffers ... and is stored and loaded in a .viminfo/shada file in the current work dir, so one such file per repo.
If a session with a different work dir is loaded, then also the .viminfo file inside.

@leafOfTree
Copy link
Owner

leafOfTree commented Nov 1, 2024

I've added a new option use_viminfo to support project-local viminfo.
When enabled, each project will load and save its viminfo to a centralized place, by default ~/.vim/vim-project-config/<project-name>/viminfo/

However, it may not be that project-local, considering

  • there is a global default viminfo saved and loaded on vim startup and exit. (shall we disable it?)
  • when a user switches between projects/folders, local history from viminfo will be passed to the next one. (shall we clear history before we open the next project?)

Please feel free to try the new option and share ideas on these.

@Konfekt
Copy link
Author

Konfekt commented Nov 1, 2024

there is a global default viminfo saved and loaded on vim startup and exit. (shall we disable it?):

What do you save it for if you work with a local project viminfo?

when a user switches between projects/folders, local history from viminfo will be passed to the next one. (shall we clear history before we open the next project?)

Yes, there's for example the SessionLoadPost and ChangeCD autocmd event. There's

https://github.com/Konfekt/local-viminfo/blob/a972714dd509616521222e4fb0d5417899cfa659/plugin/local_viminfo.vim#L70

for inspiration

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

2 participants