We should load fugitive in the following two situations: + When we open nvim in a Git repository + When we are inside nvim and change the working directory to a Git reposity
Introduction
This repo hosts my Nvim configuration for all the platforms I am using (Linux,
Windows and macOS). init.vim is the config entrypoint for terminal Neovim,
and ginit.vim is the additional config file for GUI client of Neovim (I am
using neovim-qt for now on Windows).
My configurations are heavily documented to make it as clear as possible. While you can download the whole repository and use it, it is not recommended though. Good configurations are personal. Everyone should have his or her unique config file. You are encouraged to copy from this repo the part you feel useful and add it to your own Nvim config.
See doc here on how to install Nvim's dependencies, Nvim itself, and how to set up on different platforms (Linux, macOS and Windows).
This config is always tested against the latest nvim master release. No backward compatibility is guaranteed.
Features
- Plugin management via Packer.nvim.
- Code auto-completion via nvim-compe and nvim-lspconfig.
- Fuzzy searching in current project quickly via LeaderF.
- Faster code commenting via vim-commentary.
- Smarter and faster matching pair management (add, replace or delete) via vim-sandwich.
- Fast buffer jump via vim-sneak.
- Ultra fast snippet insertion via Ultisnips.
- Git integration via vim-fugitive.
- Faster matching pair insertion and jump via auto-pairs.
- Beautiful status line via vim-airline.
- Asynchronous code execution via asyncrun.vim.
- Code highlighting via nvim-treesitter.
- Code editing using true nvim inside browser via firenvim.
- Color theme via vim-gruvbox8 and other beautiful themes.
- Markdown writing and syntax highlighting via vim-markdown, Markdown Previewing via markdown-preview.nvim.
- Command line auto-completion via wilder.nvim.
- Annimated GUI style notifiation via nvim-notify.
- Tags navigation via vista.
- Source code linting via Ale.
- Code formatting via Neoformat.
- Undo management via vim-mundo
- LaTeX editing via vimtex1.
- Smooth scroll experience via vim-smoothie.
- ......
Shortcuts
Some of the shortcuts I use frequently. In the following shortcuts, <leader>
represents ASCII character ,.
| Shortcut | Mode | platform | Description |
|---|---|---|---|
<leader>f |
Normal | Linux/macOS/Win | Fuzzy file search in a floating window |
<leader>h |
Normal | Linux/macOS/Win | Fuzzy help search in a floating window |
<leader>t |
Normal | Linux/macOS/Win | Fuzzy buffer tag search in a floating window |
<leader><Space> |
Normal | Linux/macOS/Win | Remove trailing white spaces |
<leader>v |
Normal | Linux/macOS/Win | Reselect last pasted text |
<leader>ev |
Normal | Linux/macOS/Win | Edit Neovim config in a new tabpage |
<leader>sv |
Normal | Linux/macOS/Win | Reload Neovim config |
<leader>q |
Normal | Linux/macOS/Win | Quit current window |
<leader>Q |
Normal | Linux/macOS/Win | Quit all window and close Neovim |
<leader>w |
Normal | Linux/macOS/Win | Save current buffer content |
<leader>cd |
Normal | Linux/macOS/Win | Change current directory to where current file is |
<leader>y |
Normal | Linux/macOS/Win | Copy the content of entire buffer to default register |
<leader>cl |
Normal | Linux/macOS/Win | Toggle cursor column |
<leader>cd |
Normal | Linux/macOS/Win | Change current working directory to to the dir of current buffer |
<space>t |
Normal | Linux/macOS/Win | Toggle tag window (show project tags in the right window) |
<F9> |
Normal | Linux/macOS/Win | Run current source file (for Python, C++) |
<F11> |
Normal | Linux/macOS/Win | Toggle spell checking |
<F12> |
Normal | Linux/macOS/Win | Toggle paste mode |
\x |
Normal | Linux/macOS/Win | Close location or quickfix window |
\d |
Normal | Linux/macOS/Win | Close current buffer and go to previous buffer |
{count}gb |
Normal | Linux/macOS/Win | Go to buffer {count} or next buffer in the buffer list. |
Alt-M |
Normal | macOS/Win | Render Markdown to HTML and open it in system browser |
ob |
Normal/Visual | macOS/Win | Open link under cursor or search visual selection |
ctrl-u |
Insert | Linux/macOS/Win | Turn word under cursor to upper case |
ctrl-t |
Insert | Linux/macOS/Win | Turn word under cursor to title case |
jk |
Insert | Linux/macOS/Win | Return to Normal mode without lagging (faster <ESC>) |
Trouble shooting
If you come across an issue, you can first use :checkhealth command provided
by nvim to trouble-shoot yourself. Please read carefully the messages
provided by health check.
If you still have an issue, open a new issue.
Further readings
Some of the resources that I find helpful in mastering Vim is documented here. You may also be interested in my post in configuring Vim on different platforms:
-
Not enabled by default for Linux, see this issue on how to enable vimtex on Linux. ↩︎
