Announcing ‘mini.git’
:Git
command, and interactive Git history inspection
Originally posted on Reddit
Hello, Neovim users!
Let’s together celebrate the release of mini.git - new module of mini.nvim for better Git integration. It can also be installed using separate GitHub repository.
First things first. This release marks ‘mini.nvim’ reaching two important milestones: - It is already module number 40. They grow up so fast. - The project recently reached 4000 GitHub stars. Thank you for your support and trust!
Briefly about module itself. This is not intended as a one-to-one ‘tpope/vim-fugitive’ or full featured Git client replacement!
Git related functionality was one of the oldest module requests dating back to October 2022. After some thoughts, I have finally come up with a scope that I feel strikes an important balance between features and maintainability.
Its initial goal was to track Git related data in a way that can be used in statusline (can be seen used inside statusline in demo). This should pair nicely with what ‘mini.diff’ already does for diff hunks. The ‘mini.statusline’ module now uses ‘mini.git’ and ‘mini.diff’ by default for Git-diff-related sections (with fallback to ‘lewis6991/gitsigns.nvim’, so no major breaking).
After some thinking, I’ve also decided to add Fugitive-style :Git
command and helpers for history navigation. Demo video showcases them both nicely.
Features:
Automated tracking of Git related data: root path, status, HEAD, etc. Exposes buffer-local variables for convenient use in statusline.
:Git
command for executing anygit
call inside file’s repository root with deeper current instance integration (show output as notification/buffer, use to edit commit messages, etc.).Helper functions to inspect Git history:
MiniGit.show_range_history()
shows how certain line range evolved.MiniGit.show_diff_source()
shows file state as it was at diff entry.MiniGit.show_at_cursor()
shows Git related data depending on context.
What it doesn’t do:
- Replace fully featured Git client. Rule of thumb: if feature does not rely on a state of current Neovim (opened buffers, etc.), it is out of scope. For more functionality, use either ‘mini.diff’ or fully featured Git client.
To read more information, see these tags in help file:
Please, check it out and tell me what you think! You can leave your suggestions either here in comments or in dedicated beta-testing issue.
Thanks!