/init.nvim

An Opinionated Minimalist Neovim Configuration

Primary LanguageVim Script

An opinionated Neovim config for the Minimalists

Table of Contents

Why?

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!

Features

  • 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
  • Vscode like auto completion, multi cursor
  • Smooth Scrolling (its really smooth!)
  • floating window + borders + file previews on fzf(see demos)
  • Asynchronous Lint Engine
  • Simple, Intuitive shortcuts

Supported Languages

Neovim provides support for a wide range of languages by default. There is also support for:

Requirements

  • Linux (not tested on other platforms)
  • Neovim (you can try regular Vim)
  • Properly set up environment

Setup

To check if your current environment is correctly set up run :CheckHealth.

Environment

  • python
    • python3 pip3 install --user pynvim
    • python2 pip2 install --user pynvim
  • ruby gem install neovim
  • nodeJS yarn install -g neovim

Tools

Installation

After installing the requirements:

  • git clone https://github.com/Blacksuan19/init.nvim ~/.config/nvim
  • Start nvim and it will do the rest
  • press enter if there are any errors (don't worry its fine)

Plugins

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
airline-themes airline themes
devicons icons everywhere
rainbow rainbow parenthesis
vim-material material themes
coc.nvim async completion and more
fzf.vim fuzzy finder vim integration
ultisnips snippets engine
vim-snippets snippets for many languages
vim-closetag auto html tag closing
indentLine auto indent lines
vim-liquid liquid language support
dart-vim-plugin dart language support
vim-commentary better comments everywhere
vim-auto-save auto save on insert mode exit
vim-startify cool startup thingy
vim-carbon-now-sh cool screen shots powered by carbon now sh
vim-fugitive best git integration around
vim-sandwich surround stuff with stuff
vim-smoothie super smooth scrolling
vim-lastplace open a file in the last place cursor was
tmux-complete tmux panes completion
Vista list of tags
vim-eunuch some common Linux commands
semshi better highlighting for python

Keyboard shortcuts

To learn the default Vim shortcuts run Tutor and or checkout this site.
Not a lot of changes have been done here, the plugins shortcuts are almost identical, check each plugin under the plugins section for its key mappings, the changes i have made either make a function easier to access and or expose a hidden functionality within a plugin.

Legend

, == leader key
S == Shift key
C == ctrl key

Mapping functionality Replaced Mapping
; commands key :
,r reload Nvim config None
,t Trim white spaces(enabled by default with ALE) None
,q close tab :q
,w save changes(tho save when existing insert mode is enabled by default) :q
,f fzf files viewer (shows project files with the ability to search) None
,e call :PlugInstall (install plugins) None
,v search in vista tags None
,c show list of editor commands in fzf None
,d show git diff in splits None
,/ search in project folder (calls Rg) None
,rn rename globally None
,l easymotion to the left None
,h easymotion to the right None
,j easymotion to the bottom None
,k easymotion to the top None
,s format file with any available formatter None
jj Escape Esc
d use a different register for deletion (so the deleted text wont be copied) "_d
C-q close all buffers and exit nvim None
C-c copy text to system clipboard (only in visual mode) +y
C-x cut text to system clipboard (only in visual mode) +d
C-l move to the split on the right Default
C-k move the split above Default
C-j move to the split on below Default
C-h Move the split to the left Default
C-c highlights character for multi cursor selection (in normal mode) None
C-a Highlights word/selection for multi cursor selection None
ENTER insert blank line below in normal mode None
ENTER inputs selected snippet in insert mode None
Tab cycles throw coc in insert mode None
Tab switch to the next buffer(tab) Default
S-Tab switch to the previous buffer(tab) Default
F4 Open vista (tags viewer) none
F6 Startify Default
F8 opens selection in carbon now sh (only in visual mode) None
]g next diagnostic None
[g Previous diagnostic None
gd jump to definition(using coc) None
gy jump to type definition(using coc) None
gi jump to implementation(using coc) None
gr jump to references (using coc) None
S-k show current symbol documentation None
<esc><esc> disable search highlighting for current search None

FZF keyboard shortcuts

Mapping Functionality
C-x Open file in horizontal split
C-v Open file in vertical split
C-t Open file in new tab

Custom commands

Command Functionality
Format format file with any available formatter
Prettier format file using prettier(if supported)
OR organize imports

Customizations

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 autosave: set let g:auto_save = 0

Most of the included plugins are highly customizable in nature (this is vim), checkout Plugins

Demos

fzf preview Ag preview asciicast asciicast asciicast

Credits

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 hacker who spend time Finding good shortcuts and tricks to make this an even more superb experience.