10. vim-fugitive
Vim-fugitive is a plugin for the Vim and Neovim text editor that provides a set of features for working with the Git version control system directly from the Vim editor. This plugin facilitates tasks such as browsing commit history, comparing file versions, adding changes to the index, creating commits, and resolving version merge conflicts. Vim-fugitive is popular among developers who prefer to work directly from the command line and value efficiency and speed.
Let's install it. First, add vim-fugitive to init.vim:
call plug#begin('~/.config/nvim/plugged')
" vim-fugitive
Plug 'tpope/vim-fugitive'
call plug#end()
No configuration is required for this plugin. Just save the source, install it and you can start using it.
Let me give you some useful tips for getting started with vim-fugitive.
:Git
As you may have seen with these types of commands, you can use <Tab>
autocomplete to see what else it can do:
:Git <Tab>
And there's a lot you can do in vim-fugitive
, but if you know Git, vim-fugitive
will be a breeze for you:
" show current branch status
:Git status
" show available branches
:Git branch
" work with storage
:Git stash
:Git add
:Git commit
:Git push
Typing :Git
will bring up without the fugitive-summary
window . I actually like this feature a lot. It displays a list of untracked, staging, and unassigned files along with the current branch name. Placing the cursor on these files allows you to run certain โmapsโ such as preparing/unstaging, discarding changes, toggling embedded diffs, etc.
For more information on what maps are within the fugitive-summary
window, type:
:h fugitive-maps
Or see this link .
vim-fugitive
is also displayed in the footer. You have information about what branch you're in or how many changes you've made to the code.
For more information on vim-fugitive
enter the following command in Neovim:
`` :h fugitive ```