Modern Vim distributions are really huge and bloated with way too many fancy features that you won't ever use or need, for example directory trees like Nerd tree, you don't need a tree, you can view a project structure with fzf which is faster and has search. Another example is ThinkVim has a separate extension for formatting while also having ALE which can do that as well, this double functionality is very common, thats one of the things this distro avoids, KISS!
This is my take on Blacksuan19's init.vim with a few changes and mostly optimizations to allow it to work on OSX
- Single file (you don't want your dotfiles to be all Vim script)
- Super minimal (~400 lines)
- Super fast startup (less than 40ms!)
- Lazy loading plugins
- Highly customizable
- Beautiful Material ocean color scheme
- Various IDE features via coc.nvim
- Smooth Scrolling (its really smooth!)
- Fully integrated with fzf (see demos)
- Live Markdown preview
- Simple, Intuitive shortcuts
Neovim provides support for a wide range of languages by default. There is also support for:
- This version should work on OSX and possibly still linux
- Neovim (you can try regular Vim)
- Properly set up environment
To check if your current environment is correctly set up run :CheckHealth
.
- python3:
pip3 install --user pynvim
- javascript:
yarn global add neovim
- FiraCode Nerd Font (not required but Recommended)
- tmux (not required but recommended)
- prettier
- clang (much better C and C++)
- fuzzy finder (fzf)
- ripgrep
- bat
- autopep8 python formatting
After installing the requirements:
git clone https://github.com/trooms/init.nvim ~/.config/nvim
- Start
nvim
and it will do the rest - press enter if there are any errors (don't worry its fine)
- quit after spamming enter with :q
- reopen with
nvim
and type :PlugInstall - restart again and type :UpdateRemotePlugins
Should be good to go after this
Thanks to vim-plug the plugins are lazy loaded (anything that is not needed for the current buffer is not loaded) for example opening a python file means all other non python related plugins are not loaded. Coc extensions are lazy loaded as well, they work the same way as vim-plug plugins.
Plugin | Functionality |
---|---|
vim-airline | airline status line |
devicons | icons everywhere |
rainbow | rainbow parenthesis |
vim-material | material themes |
coc.nvim | async completion and more |
fzf.vim | fuzzy finder vim integration |
vim-snippets | snippets for many languages |
indentLine | auto indent lines |
vim-liquid | liquid language support |
vim-commentary | better comments everywhere |
vim-startify | cool startup thingy |
vim-fugitive | best git integration around |
vim-sandwich | surround stuff with stuff |
vim-smoothie | super smooth scrolling |
tmux-navigator | seamless movement between Vim and tmux panes |
tmux-complete | tmux panes completion |
vim-eunuch | some common Linux commands |
semshi | better highlighting for python |
markdown-preview | live markdown preview |
vim-MvVis | move visual selection |
To learn the default Vim shortcuts run Tutor
and or checkout this vim adventures.
Mapping | functionality |
---|---|
; |
commands key |
, |
leader key |
leader + r |
reload nvim config |
leader + w |
save changes |
leader + e |
call :PlugInstall (install plug-ins) |
Enter |
enter empty line in normal mode |
F2 |
trim white spaces |
F6 |
open Startify |
Mapping | functionality |
---|---|
ctrl + j |
move selected text to bottom |
ctrl + k |
move selected text to top |
ctrl + h |
move selected text to the left |
ctrl + l |
move selected text to the right |
ctrl + hjkl
navigation also supports tmux panes.
Mapping | functionality |
---|---|
leader + q |
close tab |
ctrl + q |
close all buffers and exit |
ctrl + l |
move to the split on the right |
ctrl + k |
move the split above |
ctrl + j |
move to the split on below |
ctrl + h |
move the split to the left |
Tab |
switch to the next buffer(normal mode) |
S-Tab |
switch to the previous buffer |
Mapping | functionality |
---|---|
leader + o |
organize imports |
leader + a |
run cocAction on what's undercursor |
leader + s |
format file with available formatter |
leader + rn |
rename globally |
leader + jd |
jump to definition |
leader + jy |
jump to type definition |
leader + ji |
jump to implementation |
leader + jr |
jump to references |
ctrl + a |
highlight for multi cursor selection |
shift + k |
show current symbol documentation |
]g |
next diagnostic |
[g |
Previous diagnostic |
Mapping | functionality |
---|---|
F3 |
show list of devices |
F4 |
show list of emulators |
F5 |
start development server (flutter run) |
Mapping | functionality |
---|---|
leader + f |
files viewer |
leader + c |
show editor commands |
leader + / |
search in current folder files |
leader + sh |
search / history |
leader + b |
show open buffers |
leader + t |
search current file tags |
F1 |
show keyboard shortcuts for current mode |
these only work on an open fzf window
Mapping | Functionality |
---|---|
C-x |
open file in horizontal split |
C-v |
open file in vertical split |
C-t |
open file in new tab |
Mapping | functionality |
---|---|
leader + gd |
git diff split |
leader + gc |
git commits |
leader + gb |
git blame |
leader + gs |
git status in fzf window |
Command | Functionality |
---|---|
Format | format file with any available formatter |
OR | organize imports |
Rg | advanced Grep |
Since the file is pretty small its very easy to interpret by even those who don't have any knowledge about vim script, most of the sections have comments about their functionality, and can be removed, commented out or swapped easily, there are some defaults that are not everyone's cup of tea (after all this is highly opinionated).
-
Disabling Plugins: comment out the plug's 'Plugin/name' line from config and also remove the plugin settings
-
Disabling CoC Plugins: comment out the plugin from
coc_global_extensions
variable and uninstall it via:CocUninstall
plugin name -
Installing CoC plugins: open
:CocList
and search for marketplace, you can find all available plugins here -
Adding Bookmarks: to add bookmarks to the start page, find
g:startify_bookmarks
ininit.nvim
and add the new bookmark just like the already present ones, the dictionary key is the shortcut you will use to quickly jump to that folder from the start page and the value is the path to targeted folder
for more customizations read throw the config file, there are comments everywhere and its easy to interpret, you can also checkout the linked github page for each plugin for even more options.
All the Credit goes to the Neovim team for making most of the extensions possible and better (async), and to all the plugins developers, and the hackers who spend time Finding good shortcuts and tricks to make this an even more superb experience.