Rafael Bodill's Neovim Config
Lean mean Neovim machine, 30-45ms startup time.
Works best with Neovim 0.5.x β οΈ For Vim 8.x, use the
vim
git tag .
I encourage you to fork this repo and create your own experience.
Learn how to tweak and change Neovim to the way YOU like it.
This is my cultivation of years of tweaking, use it as a git remote
and stay in-touch with upstream for reference or cherry-picking.
Table of Contents
(π Click to expand/collapse)
Features
Screenshot
Prerequisites
Neovim
(brew install neovim
) β₯ v0.5.0
Plugins are parsed from YAML and cached.
Ensure one of these tools is installed:
yj (brew install yj
)
yq (brew install yq
)
yaml2json
Ruby
Python with PyYAML (pip install PyYAML
)
Install
1. Let's clone this repo! Clone to ~/.config/nvim
mkdir ~ /.config
git clone git://github.com/rafi/vim-config.git ~ /.config/nvim
cd ~ /.config/nvim
2. Run make test
to test your nvim version and capabilities.
3. Run make
to install all plugins.
4. If you are experiencing problems, run and read nvim -c checkhealth
Enjoy! π
Language-Server Protocol (LSP)
To leverage LSP auto-completions and other functionalities, once you open a
file in Neovim, run :LspInstall <server>
to use
williamboman/nvim-lsp-installer installation feature.
Use Tab to list available servers.
Here are some useful LSP server installations:
:LspInstall html cssls jsonls yamlls
:LspInstall gopls
:LspInstall pylsp
:LspInstall bashls vimls sumneko_lua
:LspInstall diagnosticls
and more β¦
See lua/plugins/lspconfig.lua and lua/lsp/* for built-in
mapping and configuration for several language-servers. You'll need utilities
like npm
and curl
to install some extensions. For more information, see:
Upgrade
cd ~ /.config/nvim
make update
This will run git pull --ff --ff-only
and update all plugins using
Shougo/dein.vim package-manager (:call dein#update()
).
Recommended Fonts
On macOS with Homebrew, choose one of the Nerd Fonts ,
for example, here are some popular fonts:
brew tap homebrew/cask-fonts
brew search nerd-font
brew install --cask font-victor-mono-nerd-font
brew install --cask font-iosevka-nerd-font-mono
brew install --cask font-hack-nerd-font
brew install --cask font-fira-code
Recommended Linters
brew install vint shellcheck jsonlint yamllint
brew install tflint ansible-lint tidy-html5 proselint write-good
yarn global add markdownlint-cli eslint jshint stylelint sass-lint
pip3 install --user pycodestyle pyflakes flake8
Recommended Tools
User Custom Config
For custom configuration , create the config/local.vim
file
and add your personal vimscript there.
For installing plugins , create a config/plugins.local.yaml
file and
manage your own plugin collection. If you want to disable some of the plugins
I use, you can overwrite them, e.g. :
- { repo: shadmansaleh/lualine.nvim, if: 0 }
Using config/plugins.local.yaml
you can install any plugin you want, e.g. :
# Choose only ONE of these statuslines ;)
- repo : itchyny/lightline.vim
- repo : vim-airline/vim-airline
- repo : glepnir/galaxyline.nvim
- repo : glepnir/spaceline.vim
- repo : liuchengxu/eleline.vim
You can set global specific features by defining in your local
config/local.vim
:
let g: elite_mode = 1 " Set arrow-keys to window resize
let g: global_symbol_padding = ' ' " Padding after nerd symbols
let g: tabline_plugin_enable = 0 " Disable built-in tabline
let g: enable_universal_quit_mapping = 0 " Disable normal 'q' mapping
let g: disable_mappings = 0 " Disable config/mappings.vim
To override LSP configurations , create a lua/lsp-local/<server_name>.lua
file. Must return a table with config
function. For example, create
lua/lsp-local/go.lua
:
local config = {
settings = {
gopls = {
staticcheck = true
}
}
}
return {
config = function (_ ) return config end ,
}
β οΈ This will completely overwrite built-in lua/lsp/go.lua
.
Structure
after/ - Language specific custom settings
autoload/ - Action-menu and badge functions
config/ - Configuration
lua/ - Lua plugin configurations
lsp/ - LSP configurations
lsp-local - Custom user LSP configurations
plugins/ - Plugins configurations
badge.lua - Badges for status lines
user.lua - Custom functions
plugin/ - Custom written plugins
snippets/ - Personal code snippets
themes/ - Colorscheme overrides
filetype.vim - Custom filetype detection
Plugin Highlights
Plugin management with cache and lazy loading for speed
Auto-completion with Language-Server Protocol (LSP)
Project-aware tabline
Fern as file-manager + Git status icons
Extensive syntax highlighting with nvim-treesitter .
Note that 95% of the plugins are lazy-loaded .
Plugins Included
List (π Click to expand/collapse)
Non Lazy-Loaded Plugins
Lazy-Loaded Plugins
Commands
Interface
Completion & Code-Analysis
Fern
Syntax
Operators & Text Objects
Custom Key-mappings
Note that,
Leader key set as Space
Local-Leader key set as ; and used for navigation and search
(Telescope and Fern)
Disable β β β β in normal mode by enabling g:elite_mode
in .vault.vim
Key-mappings
(π Click to expand/collapse)
Modes: π=normal π=visual π=select π=insert π=command
Navigation
Key
Mode
Action
Plugin or Mapping
j / k
π π
Cursor moves through display-lines
g
j/k
g +j / k
π π π
Jump to edge upward/downward
haya14busa/vim-edgemotion
gh / gl
π π
Easier line-wise movement
g
^/$
Space +Space
π π
Toggle visual-line mode
V
/ Escape
zl / zh
π
Scroll horizontally and vertically wider
z4
l/h
Ctrl +j
π
Move to split below
christoomey/tmux-navigator
Ctrl +k
π
Move to upper split
christoomey/tmux-navigator
Ctrl +h
π
Move to left split
christoomey/tmux-navigator
Ctrl +l
π
Move to right split
christoomey/tmux-navigator
Return
π
Toggle fold
za
Shift +Return
π
Focus the current fold by closing all others
zMzvzt
]q or ]q
π
Next/previous on quickfix list
:cnext
/ :cprev
]a or ]a
π
Next/previous on location-list
:lnext
/ :lprev
]w or ]w
π
Next/previous whitespace error
plugin/whitespace.vim
]g or ]g
π
Next/previous Git hunk
lewis6991/gitsigns.nvim
]d or ]d
π
Next/previous LSP diagnostic
lua/plugins/lspconfig.lua
Ctrl +f
π
Move cursor forwards in command
Right
Ctrl +b
π
Move cursor backwards in command
Left
Ctrl +h
π
Move cursor to the beginning in command
Home
Ctrl +l
π
Move cursor to the end in command
End
File Operations
Key
Mode
Action
Plugin or Mapping
Space +cd
π
Switch to the directory of opened buffer
:lcd %:p:h
gf
π
Open file under the cursor in a vsplit
:rightbelow wincmd f
Space +w
π
Write buffer to file
:write
Ctrl +s
π π π
Write buffer to file
:write
Edit
Key
Mode
Action
Plugin or Mapping
Ctrl +y
π
Expand emmet abbreviation
mattn/emmet-vim
Q
π
Start/stop macro recording
q
gQ
π
Play macro 'q'
@q
Shift +Return
π
Start new line from any cursor position
<C-o>o
<
π
Indent to left and re-select
<gv
>
π
Indent to right and re-select
`>gv
Tab
π
Indent to right and re-select
`>gv
Shift +Tab
π
Indent to left and re-select
<gv
gc
π π
Caw (comments plugin) prefix
tyru/caw.vim
gcc
π π
Toggle comments
tyru/caw.vim
Space +v
π π
Toggle single-line comments
tyru/caw.vim
Space +V
π π
Toggle comment block
tyru/caw.vim
Space +j or k
π π
Move lines down/up
:m
β¦
Space +d
π π
Duplicate line or selection
Space +cn / cN
π π
Change current word in a repeatable manner
Space +cp
π
Duplicate paragraph
yap<S-}>p
Space +cw
π
Remove all spaces at EOL
:%s/\s\+$//e
sj / sk
π
Join/split arguments
AndrewRadev/splitjoin.vim
dsf / csf
π
Delete/change surrounding function call
AndrewRadev/dsf.vim
Search & Replace
Key
Mode
Action
Plugin or Mapping
* / #
π π
Search selection forward/backward
haya14busa/vim-asterisk
g* / g#
π π
Search whole-word forward/backward
haya14busa/vim-asterisk
Backspace
π
Match bracket
%
gpp
π
Select last paste
sg
π
Replace within selected area
:s/β΄/gc
Ctrl +r
π
Replace selection with step-by-step confirmation
:%s/\V/β΄/gc
Clipboard
Key
Mode
Action
Plugin or Mapping
p or P
π
Paste without yank
s:visual_paste
Y
π
Yank to the end of line
y$
Space +y
π
Copy relative file-path to clipboard
Space +Y
π
Copy absolute file-path to clipboard
Command & History
Key
Mode
Action
Plugin or Mapping
!
π
Shortcut for shell command
:!
g!
π
Read vim command into buffer
:put=execute('β΄')
Ctrl +n / p
π
Switch history search pairs
β / β
β / β
π
Switch history search pairs
Ctrl
n
/p
Editor UI
Key
Mode
Action
Plugin or Mapping
Space +ts
π
Toggle spell-checker
:setlocal spell!
Space +tn
π
Toggle line numbers
:setlocal nonumber!
Space +tl
π
Toggle hidden characters
:setlocal nolist!
Space +th
π
Toggle highlighted search
:set hlsearch!
Space +tw
π
Toggle wrap
:setlocal wrap!
β¦
Space +ti
π
Toggle indentation lines
nathanaelkane/vim-indent-guides
Space +tt
π
Show highlight groups for word
g1
π
Go to first tab
:tabfirst
g9
π
Go to last tab
:tablast
g5
π
Go to previous tab
:tabprevious
Ctrl +Tab
π
Go to next tab
:tabnext
Ctrl +Shift Tab
π
Go to previous tab
:tabprevious
Alt +j
π
Go to next tab
:tabnext
Alt +k
π
Go to previous tab
:tabprevious
Alt +{
π
Move tab backward
:-tabmove
Alt +}
π
Move tab forward
:+tabmove
Custom Tools & Plugins
Window Management
Key
Mode
Action
Plugin or Mapping
q
π
Quit window (and Vim, if last window)
:quit
Ctrl +x
π
Rotate window placement
C-w
x
sv
π
Horizontal split
:split
sg
π
Vertical split
:vsplit
st
π
Open new tab
:tabnew
so
π
Close other windows
:only
sb
π
Previous buffer
:b#
sc
π
Close current buffer
:close
sd
π
Delete buffer
:bdelete
sq
π
Quit window
:quit
sx
π
Delete buffer, leave blank window
:enew β bdelete
sz
π
Toggle window zoom
:vertical resize β resize
ssv
π
Split with previous buffer
:split β wincmd p β e#
ssg
π
Vertical split with previous buffer
:vsplit β wincmd p β e#
sh
π
Toggle colorscheme background=dark/light
:set background
β¦
Plugin: Gitsigns
Key
Mode
Action
]g or ]g
π
Next/previous Git hunk
gs
π
Preview hunk
Space +hp
π
Preview hunk
Space +hb
π
Blame line
Space +hs
π π
Stage hunk
Space +hu
π
Undo stage hunk
Space +hr
π π
Reset hunk
Space +hR
π
Reset buffer
Space +hl
π
Publish hunks to location-list
Plugin: Gina
Key
Mode
Action
Space +ga
π
Git add current file
Space +gd
π
Git diff
Space +gc
π
Git commit
Space +gb
π
Git blame
Space +gs
π
Git status -s
Space +gl
π
Git log --graph --all
Space +gF
π
Git fetch
Space +gp
π
Git push
Space +go
π π
Open SCM detailed URL in browser
Plugin: Telescope
Key
Mode
Action
;r
π
Results of the previous picker
;R
π
List of the previous pickers
;f
π
File search
;g
π
Grep search
;b
π
Buffers
;x
π
Old files
;v
π π
Yank history
;m
π
Marks
;n
π
Dein plugin list
;j
π
Jump points
;u
π
Spelling suggestions
;o
π
Vim options
;s
π
Sessions
;t
π
LSP workspace symbols
;h
π
Highlights
;w
π
Memo list
;z
π
Zoxide directories
;;
π
Command history
;/
π
Search history
Space +gt
π
Find symbols matching word under cursor
Space +gf
π
Find files matching word under cursor
Space +gg
π π
Grep word under cursor
Within Telescope window
?
π
Keymaps help screen
jj or Escape
π
Leave Insert mode
i
π
Enter Insert mode (filter input)
q or Escape
π
Exit denite window
Tab or Shift +Tab
π π
Next/previous candidate
Ctrl d /u
π π
Scroll down/upwards
Ctrl f /b
π π
Scroll preview down/upwards
J or K
π
Select candidates up/downwards
st
π
Open in a new tab
sg
π
Open in a vertical split
sv
π
Open in a split
w
π
Smart send to quickfix list
e
π
Send to quickfix list
dd
π
Delete entry (buffer list)
Plugin: Fern
Key
Mode
Action
;e
π
Open file-explorer (toggle)
;a
π
Focus current file in file-explorer
Within Fern window
j or k
π
Move up and down the tree
J or K or Space
π
Select entries up/downwards
l or Return
π
Toggle collapse/expand directory or open file
h
π
Collapse directory tree
Ctrl +Return
π
Choose window to edit entry
a
π
Select entry action
p
π
Preview entry
Ctrl +p
π
Toggle auto-preview
Ctrl +f or b
π
Preview scroll up/down
gr
π
Grep in current position
gf
π
Find files in current position
!
π
Toggle hidden files
^
π
Change into project root directory
Backspace
π
Change into parent directory
o
π
Open bookmarks
B
π
Save location as bookmark
st
π
Open file in new tab
sv
π
Open file in a horizontal split
sg
π
Open file in a vertical split
N
π
Create new directories and/or files
Ctrl +n
π
Create new directory
c / m
π
Copy/move
C / M / P
π
Clipboard copy/move/paste
R
π
Rename file or directory
D
π
Trash selected files and directories
fi / fe
π
Include/exclude
yy
π
Yank path to clipboard
w
π
Toggle window size
x
π
Execute associated system application
Plugin: LSP
Key
Mode
Action
Tab / Shift-Tab
π
Navigate completion-menu
Enter
π
Select completion or expand snippet
Ctrl +j /k /d /u
π
Movement in completion pop-up
Ctrl +Return
π
Expand Emmet sequence
Ctrl +Space
π
Refresh and show candidates
Ctrl +y
π
Close pop-up
Ctrl +e
π
Cancel selection and close pop-up
Ctrl +l
π
Expand snippet at cursor
Tab / Shift-Tab
π π
Navigate snippet placeholders
Plugin: Any-Jump
Key
Mode
Action
Space +ii
π
Jump to definition under cursor
Space +ii
π
Jump to selected text in visual mode
Space +ib
π
Open previous opened file (after jump)
Space +il
π
Open last closed search window again
Plugin: Signature
Key
Mode
Action
m/ or m?
π
Show list of buffer marks/markers
mm
π
Toggle mark on current line
m,
π
Place next mark
m a-z
π
Place specific mark (Won't work for: mm , mn , mp )
dm a-z
π
Remove specific mark (Won't work for: mm , mn , mp )
mn
π
Jump to next mark
mp
π
Jump to previous mark
]=
π
Jump to next marker
[=
π
Jump to previous marker
m-
π
Purge all on current line
m Space
π
Purge marks
m Backspace
π
Purge markers