GitHub - PBandJAMD/vim-config: Lean mean (Neo)Vim machine, carefully crafted with Use with latest Neovim or Vim 8

Rafael Bodill's Neo/vim Config

Lean mean Neo/vim machine, 30-45ms startup time.

Best with Neovim or Vim8 and python3 enabled.

I encourage you to fork this repo and create your own experience. Learn how to tweak and change Neo/vim 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

  • Fast startup time
  • Robust, yet light-weight
  • Lazy-load 95% of plugins with Shougo/dein.vim
  • Custom side-menu (try it out! Space+l)
  • Custom context-menu (try it! ;+c)
  • Modular configuration (see structure)
  • Auto-complete prabirshrestha/asyncomplete.vim extensive setup
  • Shougo/denite.nvim centric work-flow (lists)
  • Structure view with liuchengxu/vista.vim
  • Open SCM detailed URL in OS browser
  • Light-weight but informative status/tabline
  • Easy customizable theme
  • Premium color-schemes
  • Central location for tags and sessions

Screenshot

Vim screenshot

Prerequisites

  • Python 3 (brew install python)
  • Neovim or Vim (brew install neovim and/or brew install vim)

Install

1. Let's clone this repo! Clone to ~/.config/nvim, we'll also symlink it for regular Vim:

mkdir ~/.config
git clone git://github.com/rafi/vim-config.git ~/.config/nvim
cd ~/.config/nvim
ln -s ~/.config/nvim ~/.vim  # For "regular" Vim
  • Note: If you set a custom $XDG_CONFIG_HOME, use that instead of ~/.config in the commands above. Neovim follows the XDG base-directories convention, Vim doesn't.

2. Install the Python 3 pynvim library. This is also needed for Vim 8 if you want to use Denite and Defx.

Neovim: ./venvs.sh or pip3 install --user pynvim

Vim: pip3 install --user pynvim

3. Run make test to test your nvim/vim version and capabilities.

4. Run make to install all plugins.

5. If you are experiencing problems, run and read nvim -c checkhealth

Test Python 3 availability with :py3 print(sys.version_info)

Enjoy! πŸ˜„

Language-Server Protocol (LSP)

To leverage LSP auto-completions and other functionalities, once you open a file in Neo/vim, run :LspInstallServer to use mattn/vim-lsp-settings installation feature.

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, to install the Hack font:

brew tap homebrew/cask-fonts
brew search nerd-font
brew cask install font-hack-nerd-font
brew cask install font-iosevka-nerd-font-mono
brew cask install font-jetbrains-mono
brew cask install font-fira-code

Recommended Linters

  • macOS with Homebrew:
brew install shellcheck jsonlint yamllint tflint ansible-lint
brew install tidy-html5 proselint write-good
  • Node.js based linters:
yarn global add eslint jshint jsxhint stylelint sass-lint
yarn global add markdownlint-cli raml-cop
  • Python based linters:
pip3 install --user vim-vint pycodestyle pyflakes flake8

Recommended Tools

User Custom Config

If you want to add your own configuration, create the config/local.vim file and add your personal vimscript there. If you'd like to install plugins by yourself, create a config/local.plugins.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: dense-analysis/ale, if: 0 }

Structure

Plugin Highlights

  • Plugin management with cache and lazy loading for speed
  • Auto-completion with Language-Server Protocol (LSP)
  • Project-aware tabs and labels
  • Defx as file-manager + Git status icons
  • Extensive language extensions library

Note that 95% of the plugins are lazy-loaded.

Plugins Included

List (πŸ”Ž Click to expand/collapse)

Non Lazy-Loaded Plugins

Name Description
Shougo/dein.vim Dark powered Vim/Neovim plugin manager
rafi/awesome-colorschemes Awesome color-schemes
itchyny/vim-gitbranch Lightweight git branch detection
itchyny/vim-parenmatch Efficient alternative to the standard matchparen plugin
thinca/vim-localrc Enable configuration file of each directory
romainl/vim-cool Simple plugin that makes hlsearch more useful
sgur/vim-editorconfig EditorConfig plugin written entirely in Vimscript
christoomey/tmux-navigator Seamless navigation between tmux panes and vim splits
tpope/vim-sleuth Heuristically set buffer indent options
roxma/nvim-yarp Vim8 remote plugin framework for Neovim
roxma/vim-hug-neovim-rpc Vim8 compatibility layer for neovim rpc client

Lazy-Loaded Plugins

Language

Name Description
hail2u/vim-css3-syntax CSS3 syntax support to vim's built-in syntax/css.vim
othree/csscomplete.vim Updated built-in CSS complete with latest standards
cakebaker/scss-syntax.vim Syntax file for scss (Sassy CSS)
groenewege/vim-less Syntax for LESS
iloginow/vim-stylus Syntax, indentation and autocomplete for Stylus
mustache/vim-mustache-handlebars Mustache and handlebars syntax
digitaltoad/vim-pug Pug (formerly Jade) syntax and indentation
othree/html5.vim HTML5 omnicomplete and syntax
plasticboy/vim-markdown Markdown syntax highlighting
rhysd/vim-gfm-syntax GitHub Flavored Markdown syntax highlight extension
pangloss/vim-javascript Enhanced Javascript syntax
HerringtonDarkholme/yats.vim Advanced TypeScript Syntax Highlighting
MaxMEllon/vim-jsx-pretty React JSX syntax pretty highlighting
heavenshell/vim-jsdoc Generate JSDoc to your JavaScript code
jparise/vim-graphql GraphQL file detection, syntax highlighting, and indentation
moll/vim-node Superb development with Node.js
kchmck/vim-coffee-script CoffeeScript support
elzr/vim-json Better JSON support
posva/vim-vue Syntax Highlight for Vue.js components
fatih/vim-go Go development
vim-python/python-syntax Enhanced version of the original Python syntax
Vimjas/vim-python-pep8-indent A nicer Python indentation style
vim-scripts/python_match.vim Extend the % motion for Python files
raimon49/requirements.txt.vim Python requirements file format
StanAngeloff/php.vim Up-to-date PHP syntax file (5.3 – 7.1 support)
tbastos/vim-lua Lua 5.3 syntax and indentation improved support
vim-ruby/vim-ruby Ruby support
keith/swift.vim Swift support
rust-lang/rust.vim Rust support
vim-jp/syntax-vim-ex Improved Vim syntax highlighting
chrisbra/csv.vim Handling column separated data
tpope/vim-git Git runtime files
ekalinin/Dockerfile.vim Syntax and snippets for Dockerfile
tmux-plugins/vim-tmux Plugin for tmux.conf
MTDL9/vim-log-highlighting Syntax highlighting for generic log files
cespare/vim-toml Syntax for TOML
mboughaba/i3config.vim i3 window manager config syntax
dag/vim-fish Fish shell edit support
jstrater/mpvim Macports portfile configuration files
robbles/logstash.vim Highlights logstash configuration files
lifepillar/pgsql.vim PostgreSQL syntax and indent
chr4/nginx.vim Improved nginx syntax and indent
IN3D/vim-raml Syntax and language settings for RAML
towolf/vim-helm Syntax for Helm templates (yaml + gotmpl + sprig)
pearofducks/ansible-vim Improved YAML support for Ansible
hashivim/vim-terraform Base Terraform integration

Commands

Name Description
Shougo/defx.nvim Dark powered file explorer implementation
kristijanhusak/defx-git Git status implementation for Defx
kristijanhusak/defx-icons Filetype icons for Defx
tyru/caw.vim Robust comment plugin with operator support
Shougo/context_filetype.vim Context filetype detection for nested code
liuchengxu/vim-which-key Shows key-bindings in pop-up
mbbill/undotree Ultimate undo history visualizer
reedes/vim-wordy Uncover usage problems in your writing
brooth/far.vim Fast find and replace plugin
jreybert/vimagit Ease your git work-flow within Vim
tweekmonster/helpful.vim Display vim version numbers in docs
lambdalisue/gina.vim Asynchronously control git repositories
kana/vim-altr Switch to the alternate file without interaction
Shougo/vinarise.vim Hex editor
guns/xterm-color-table.vim Display 256 xterm colors with their RGB equivalents
cocopon/colorswatch.vim Generate a beautiful color swatch for the current buffer
dstein64/vim-startuptime Visually profile Vim's startup time
jaawerth/nrun.vim "which" and "exec" functions targeted at local node project bin
Vigemus/iron.nvim Interactive REPL over Neovim
kana/vim-niceblock Make blockwise Visual mode more useful
t9md/vim-choosewin Choose window to use, like tmux's 'display-pane'
lambdalisue/suda.vim An alternative sudo.vim for Vim and Neovim
mzlogin/vim-markdown-toc Generate table of contents for Markdown files
chemzqm/vim-easygit Git wrapper focus on simplity and usability
liuchengxu/vista.vim Viewer & Finder for LSP symbols and tags in Vim
junegunn/fzf Powerful command-line fuzzy finder
junegunn/fzf.vim Fzf integration
Ron89/thesaurus_query.vim Multi-language thesaurus query and replacement

Interface

Name Description
haya14busa/vim-asterisk Improved * motions
rhysd/accelerated-jk Up/down movement acceleration
haya14busa/vim-edgemotion Jump to the edge of block
t9md/vim-quickhl Highlight words quickly
hotwatermorning/auto-git-diff Display Git diff for interactive rebase
rafi/vim-sidemenu Small side-menu useful for terminal users
machakann/vim-highlightedyank Make the yanked region apparent
wellle/context.vim Show context of current visible code hierarchy
itchyny/cursorword Underlines word under cursor
norcalli/nvim-colorizer.lua The fastest Neovim colorizer
airblade/vim-gitgutter Show git changes at Vim gutter and un/stages hunks
kshenoy/vim-signature Display and toggle marks
nathanaelkane/vim-indent-guides Visually display indent levels in code
rhysd/committia.vim Pleasant editing on Git commit messages
junegunn/goyo Distraction-free writing
junegunn/limelight Hyperfocus-writing
itchyny/calendar.vim Calendar application
vimwiki/vimwiki Personal Wiki for Vim

Completion & Code-Analysis

Name Description
prabirshrestha/async.vim Normalize async job control API for Vim and Neovim
prabirshrestha/asyncomplete.vim Async-completion in pure Vimscript for Vim8 and Neovim
prabirshrestha/asyncomplete-lsp.vim Provide Language Server Protocol autocompletion source
prabirshrestha/vim-lsp Async Language Server Protocol plugin for Vim and Neovim
mattn/vim-lsp-settings Auto LSP configurations for vim-lsp
Shougo/neco-vim Completion source for Vimscript
prabirshrestha/asyncomplete-necovim.vim Provides syntax autocomplete via neco-vim
prabirshrestha/asyncomplete-tags.vim Provides tag autocomplete via vim tagfiles
prabirshrestha/asyncomplete-file.vim Provides file autocomplete
wellle/tmux-complete.vim Completion of words in adjacent tmux panes
prabirshrestha/asyncomplete-ultisnips.vim Provides UltiSnips autocomplete
SirVer/ultisnips Ultimate snippet solution
honza/vim-snippets Community-maintained snippets for programming languages
dense-analysis/ale Check syntax asynchronously and fix files with LSP support
mattn/emmet-vim Provides support for expanding abbreviations alΓ‘ emmet
ncm2/float-preview.nvim Less annoying completion preview window
ludovicchabant/vim-gutentags Manages your tag files
Raimondi/delimitMate Auto-completion for quotes, parens, brackets

Denite

Name Description
Shougo/denite.nvim Dark powered asynchronous unite all interfaces
Shougo/neomru.vim Denite plugin for MRU
Shougo/neoyank.vim Denite plugin for yank history
Shougo/junkfile.vim Denite plugin for temporary files
chemzqm/unite-location Denite location & quickfix lists
chemzqm/denite-git gitlog, gitstatus and gitchanged sources
rafi/vim-denite-session Browse and open sessions
rafi/vim-denite-z Filter and browse Z (jump around) data file

Operators & Text Objects

Name Description
kana/vim-operator-user Define your own custom operators
kana/vim-operator-replace Operator to replace text with register content
machakann/vim-sandwich Search, select, and edit sandwich text objects
kana/vim-textobj-user Create your own text objects
terryma/vim-expand-region Visually select increasingly larger regions of text
AndrewRadev/sideways.vim Match function arguments
AndrewRadev/splitjoin.vim Transition code between multi-line and single-line
AndrewRadev/linediff.vim Perform diffs on blocks of code
AndrewRadev/dsf.vim Delete surrounding function call
osyo-manga/vim-textobj-multiblock Handle bracket objects
kana/vim-textobj-function Text objects for functions

Custom Key-mappings

Note that,

  • Leader key set as Space
  • Local-leader set as ; and used for navigation and search (Denite and Defx)
Key-mappings (πŸ”Ž Click to expand/collapse)

General

Key Mode Action
Space All Leader key
; All Local Leader key
← ↑ β†’ ↓ Normal Resize splits (* Enable g:elite_mode in .vault.vim)
;+c Normal Open context-menu
Space+l Normal Open side-menu helper
Backspace Normal Match bracket (%)
gK Normal Open Zeal or Dash on some file-types
Y Normal Yank to the end of line (y$)
Return Normal Toggle fold (za)
Shift+Return Normal Focus the current fold by closing all others (zMzvzt)
Shift+Return Insert Start new line from any cursor position (<C-o>o)
j / k Normal/Visual Cursor moves through display-lines (g/jk)
Ctrl+f Normal Smart page forward (C-f/C-d)
Ctrl+b Normal Smart page backwards (C-b/C-u)
Ctrl+e Normal Smart scroll down (3C-e/j)
Ctrl+y Normal Smart scroll up (3C-y/k)
Ctrl+q Normal Remap to Ctrl+w
Ctrl+x Normal Rotate window placement
! Normal Shortcut for :!
<< Visual Indent to left and re-select
>> Visual Indent to right and re-select
Tab Visual Indent to right and re-select
Shift+Tab Visual Indent to left and re-select
gh Normal Show highlight groups for word
gp Normal Select last paste
Q Normal Start/stop macro recording
gQ Normal Play macro 'q'
Space+j or k Normal/Visual Move lines down/up
Space+cp Normal Duplicate paragraph
Space+cn / cN Normal/Visual Change current word in a repeatable manner
sg Visual Replace within selected area
Ctrl+a Command Navigation in command line
Ctrl+b Command Move cursor backward in command line
Ctrl+f Command Move cursor forward in command line
Ctrl+r Visual Replace selection with step-by-step confirmation
Ctrl+Shift+q Normal Exit Vim, confirm unsaved changes
Space+cw Normal Remove all spaces at EOL
Space+Space Normal Enter visual line-mode
Space+sl Normal Load workspace session
Space+se Normal Save current workspace session
Space+d Normal/Visual Duplicate line or selection
Space+S Normal/Visual Source selection
Space+ml Normal Append modeline

File Operations

Key Mode Action
Space+cd Normal Switch to the directory of opened buffer (:lcd %:p:h)
Space+w Normal/Visual Write (:w)
Space+y Normal Copy relative file-path to clipboard
Space+Y Normal Copy absolute file-path to clipboard
Ctrl+s All Write (:w)

Editor UI

Key Mode Action
Space+ti Normal Toggle indentation lines
Space+ts Normal Toggle spell-checker (:setlocal spell!)
Space+tn Normal Toggle line numbers (:setlocal nonumber!)
Space+tl Normal Toggle hidden characters (:setlocal nolist!)
Space+th Normal Toggle highlighted search (:set hlsearch!)
Space+tw Normal Toggle wrap (:setlocal wrap! breakindent!)
g1 Normal Go to first tab (:tabfirst)
g9 Normal Go to last tab (:tablast)
g5 Normal Go to previous tab (:tabprevious)
Ctrl+j Normal Move to split below
Ctrl+k Normal Move to upper split
Ctrl+h Normal Move to left split
Ctrl+l Normal Move to right split
* Visual Search selection forwards
# Visual Search selection backwards
]+c or q Normal Next on location/quickfix list
]+c or q Normal Previous on location/quickfix list
s+h Normal Toggle colorscheme background dark/light
s+- Normal Lower colorscheme contrast (Support solarized8)
s+= Normal Raise colorscheme contrast (Support solarized8)

Window Management

Key Mode Action
q Normal Quit window (and Vim, if last window)
Ctrl+Tab Normal Next tab
Ctrl+Shift+Tab Normal Previous tab
s+v Normal Horizontal split (:split)
s+g Normal Vertical split (:vsplit)
s+t Normal Open new tab (:tabnew)
s+o Normal Close other windows (:only)
s+b Normal Previous buffer (:b#)
s+c Normal Closes current buffer (:close)
s+x Normal Remove buffer, leave blank window
Space+sv Normal Split with previous buffer
Space+sg Normal Vertical split with previous buffer

Plugin: Denite

Key Mode Action
;+r Normal Resumes last Denite window
;+f Normal File search
;+b Normal Buffers and MRU
;+d Normal Directories
;+v Normal/Visual Yank history
;+l Normal Location list
;+q Normal Quick fix
;+n Normal Dein plugin list
;+g Normal Grep search
;+j Normal Jump points
;+u Normal Junk files
;+o Normal Outline tags
;+s Normal Sessions
;+t Normal Tag list
;+p Normal Jump to previous position
;+h Normal Help
;+m Normal Memo list
;+z Normal Z (jump around)
;+/ Normal Buffer lines
;+* Normal Match word under cursor with lines
;+; Normal Command history
Space+gl Normal Git log (all)
Space+gs Normal Git status
Space+gc Normal Git branches
Space+gt Normal Find tags matching word under cursor
Space+gf Normal Find file matching word under cursor
Space+gg Normal/Visual Grep word under cursor
Within Denite window
jj or kk Insert Leave Insert mode
q or Escape Normal Exit denite window
Space Normal Select entry
Tab Normal List and choose action
i Normal Open filter input
dd Normal Delete entry
p Normal Preview entry
st Normal Open in a new tab
sg Normal Open in a vertical split
sv Normal Open in a split
r Normal Redraw
yy Normal Yank
' Normal Quick move

Plugin: Defx

Key Mode Action
;+e Normal Open file explorer (toggle)
;+a Normal Open file explorer and select current file
Within Defx window
h Normal Collapse directory tree
j or k Normal Move up and down the tree
Return or l Normal Toggle collapse/expand directory or open file
Space Normal Select current file or directory
* Normal Invert selection (select all)
Backspace Normal Move into the parent directory
& or </kbd> Normal Move to project root
~ Normal Move to user home directory
st Normal Open file in new tab
sv Normal Open file in a horizontal split
sg Normal Open file in a vertical split
N Normal Create new directories and/or files
K Normal Create new directory
c / m / p Normal Copy, move, and paste
r Normal Rename file or directory
dd Normal Delete selected files and directories
y Normal Yank selected item to clipboard
w Normal Toggle window size
]+g Normal Next dirty git item
[+g Normal Previous dirty git item
x / gx Normal Execute associated system application
gd Normal Open git diff on selected file
gl Normal Open terminal file explorer
gr Normal Grep in selected directory
gf Normal Find files in selected directory

Plugin: Asyncomplete and Emmet

Key Mode Action
Tab / Shift-Tab Insert Navigate completion-menu
Enter Insert Select completion or expand snippet
Ctrl+j k d u Insert Movement in completion pop-up
Ctrl+Return Insert Expand Emmet sequence
Ctrl+Space Insert Refresh and show candidates
Ctrl+y Insert Close pop-up
Ctrl+e Insert Cancel selection and close pop-up
Ctrl+l Insert Expand snippet at cursor
Ctrl+f Insert/select Jump to next snippet placeholder
Ctrl+b Insert/select Jump to previous snippet placeholder

Plugin: Caw (comments)

Key Mode Action
gc Normal/visual Prefix
gcc Normal/visual Toggle comments
Space+v Normal/visual Toggle single-line comments
Space+V Normal/visual Toggle comment block

Plugin: Edge Motion

Key Mode Action
g+j Normal/Visual Jump to edge downwards
g+k Normal/Visual Jump to edge upwards

Plugin: Signature

Key Mode Action
m + / or ? Normal Show list of buffer marks/markers
m + m Normal Toggle mark on current line
m + , Normal Place next mark
m + a-z Normal Place specific mark (Won't work for: m, n, p)
d + m + a-z Normal Remove specific mark (Won't work for: m, n, p)
m + n Normal Jump to next mark
m + p Normal Jump to previous mark
] + = Normal Jump to next marker
[ + = Normal Jump to previous marker
m + - Normal Purge all on current line
m + Space Normal Purge marks
m + Backspace Normal Purge markers

Plugin: Easygit

Key Mode Action
Space+ga Normal Git add current file
Space+gS Normal Git status
Space+gd Normal Git diff
Space+gD Normal Close diff
Space+gc Normal Git commit
Space+gb Normal Git blame
Space+gB Normal Open in browser
Space+gp Normal Git push

Plugin: GitGutter

Key Mode Action
[+g Normal Jump to next hunk
]+g Normal Jump to previous hunk
g+S Normal Stage hunk
Space+gr Normal Revert hunk
g+s Normal Preview hunk

Plugin: Linediff

Key Mode Action
Space+mda Visual Sequentially mark region for diff
Space+mdf Visual Mark region for diff and compare if more than one
Space+mds Normal Shows the comparison for all marked regions
Space+mdr Normal Removes the signs denoting the diff regions

Misc Plugins

Key Mode Action
v / V Visual/select Expand/reduce selection (expand-region)
- Normal Choose a window to edit (choosewin)
Space+mg Normal Open Magit
Space+mt Normal/Visual Toggle highlighted word (quickhl)
Space+- Normal Switch editing window with selected (choosewin)
Space+o Normal/Visual Open SCM detailed URL in browser (:OpenSCM)
Space+t Normal Open structure window (:Vista)
Space+a Normal Show nearby tag in structure window (:Vista show)
Space+G Normal Toggle distraction-free writing (goyo)
Space+gu Normal Open undo-tree
Space+W Normal VimWiki
Space+K Normal Thesaurus

Credits & Contribution

Big thanks to the dark knight Shougo.