There is a lua-version of this plugin, too. It is here: https://github.com/m42e/lgh.nvim
This plugin saves the file worked on in a git repository every time you save. Since 2021-03-18 it is done using the jobstart api, so it won't be compatible with older version of (neo)vim.
Yes, I do know undo, and yes I know persistent undo, too. But there are times, when you replace a file on disk, either by yourself or a git checkout (--force) or you evil twin deletes a file. And here undo does not help.
Install it, feel saver. If you want to see the history of a file type
:LGHistory
And then you get an fzf window with all the dates when the file has been stored.
- Search for files where you don't have the exact filename
- Allowing diff mode
- Handling of more edge use cases.
- Handling
:q
in diffmode like fugitive does
fzf-vim is required. Use vim-plug or any other Vim plugin manager.
With vim-plug:
Plug 'm42e/vim-lgh'
You can set the backup directory:
let g:lgh_basedir = '~/.vim/githistory'
You can also set a basedir for a file indivually, either manually or by autocmds:
autocmd BufEnter *.py let b:lgh_dir = '~/my_python_githistory'
You can specify not to use diff as default:
let g:lgh_diff = 0
See the history by:
:LGHistory
- vim-historic Which also handles a local history in git. But uses some shell script and I try to avoid that. To at least have a possibility that it may work on windows
- vim-localhistory I saw he is using fzf for handling the history files. I really liked the idea, because I thought about how to make vim-historic better but thinking of that I was afraid. vim-localhistory gave me the hint into the right direction.