vim-project icon indicating copy to clipboard operation
vim-project copied to clipboard

project-local history

Open Konfekt opened this issue 1 year ago • 4 comments

how about a project-local history as well?

Konfekt avatar Oct 23 '24 14:10 Konfekt

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,
      \...
      \}

leafOfTree avatar Oct 28 '24 02:10 leafOfTree

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.

Konfekt avatar Oct 28 '24 06:10 Konfekt

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.

leafOfTree avatar Nov 01 '24 12:11 leafOfTree

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

Konfekt avatar Nov 01 '24 15:11 Konfekt