A Neovim plugin for maintaining local history of files.

Every time you save a file, a copy of the saved contents is kept in the local history. At any time, you can compare a file with any older version from the history. It can help you out when you change a file by accident. The file revision is stored inside the .local-history folder of your workspace directory (you can also configure another location)
Install pynvim
pip3 install pynvim
Install Neovim plugin
Plug 'dinhhuy258/vim-local-history', {'branch': 'master', 'do': ':UpdateRemotePlugins'}
Use command LocalHistoryToggle to open/close local history.
You can map this command to another key:
nnoremap <F5> :LocalHistoryToggle<CR>
If you see an error Not and editor command: LocalHistoryToggle  you need to run :UpdateRemotePlugins
If the error still occurs, run the following command
pip install --user --upgrade pynvim
then restart nvim and re-run :UpdateRemotePlugins and finally restart nvim, :LocalHistoryToggle will exist
These functions are only work under the LocalHistory buffer.
| Functions | Usage | Default keys | 
|---|---|---|
| move_older | Navigate to older change | j | 
    
| move_newer | Navigate to newer change | k | 
    
| move_oldest | Navigate to the oldest change | G | 
    
| move_newest | Navigate to the newest change | gg | 
    
| revert | Revert to selected change | Enter | 
    
| diff | Vertical diff of current buffer with selected change | r | 
    
| delete | Delete selected change | d | 
    
| bigger | Increase local history graph size | L | 
    
| smaller | Decrease local history graph size | H | 
    
| preview_bigger | Increase local history preview size | K | 
    
| preview_smaller | Decrease local history preview size | J | 
    
| quit | Close local history windows | q | 
    
You can tweak the behavior of LocalHistory by setting a few variables in your vim setting file. For example:
let g:local_history_path = '/Users/dinhhuy258/.local-history'
let g:local_history_max_changes = 100
...
Disable/ enable local history
Possible values:
0: Never (Disable local history plugin)1: Always (Save also a single file which is not in the workspace folder)2: Workspace (Save only files within workspace folder)Default: 1 (Always)
Specify location for local history folder
Default: .local-history
Enable info message. If you find the vim-local-history message is annoying, then set it off. This configuration is used for development purposes.
Default: v:false
Maximum changes for each file. If the number of changes exceed g:local_history_max_changes the oldest change will be removed.
Default: 100
A delay in seconds to create new change in local history (0: no delay). This configuration is used to avoid creating many changes in a short time. If saving time between 2 change is less than delay value, the content will be override for the lastest change instead of creating new change.
Default: 300 (5 minutes)
Set the horizontal width of the local history graph (and preview).
Default: 45
Set the vertical height of the local history preview.
Default: 15
Files or folders to not save.
let g:local_history_exclude = [ '**/node_modules/**', '*.txt' ]
Default: []
Remap key bindings for local history functions
let g:local_history_mappings = {
  \ "diff": ["d"],
  \ "quit": ["q", "Q"],
  \ "preview_bigger": ["b"],
  \ }
Please re-define all functions that is listed in the table above otherwise the non-mapping key are gone.
Default: See the table above
Toggle local history

Delete local history change

Revert local history change

Show vertical diff
