Built on modern devtools including LSP and treesitter. Treesitter delivers
AST-level highlighting, text objects, and navigations, while LSP offers
features like auto completion, go to definition and reference, and code
diagnostics. By harnessing the power of both Ctags and LSP, this configuration
brings a harmonic blend of old-school and modern development tools.
Powerful Text Edit Plugins
Vim's exceptional text editing capabilities are further amplified by a host of
powerful plugins focusing on text editing. (Remember it is pure text editing
makes vim vim.)
Tailored for Data Science
This configuration is specifically tailored toward data science toolsets,
including python, R, SQL, Latex, rmarkdown, and quarto.
Seamless Integration with Vscode
Curated configuration working together with vscode thanks to
vscode-neovim. Access all the
familiar neovim keybindings, including translations of equivalent commands in
vscode, even when working with complex graphical content like Jupyter
notebooks. And many neovim plugins, such as treesitter, can be embedded
seamlessly in vscode, allowing for a smooth and uninterrupted workflow.
NOTE: If you plan to use this configuration with vscode-neovim, please
use the windows/vscode branch. If you wish to use neovim both in the terminal
and in vscode, we suggest creating two folders in ~/.config or your specified
$XDG_CONFIG path. One is ~/.config/nvim, which uses the default
configuration in the master branch, and the other is
~/.config/vscode-neovim, which uses the configuration in the windows/vscode
branch. This takes advantage of the NVIM_APPNAME feature in nvim 0.9.
There are two ways to ask vscode-neovim to use the configuration from the
~/.config/vscode-neovim folder as opposed to the default folder. Select the
method that suits your preference best:
Create a bash script like the following:
#!bin/bash
NVIM_APPNAME=vscode-neovim nvim "$@"
Then, in vscode, set vscode-neovim.neovimExecutablePaths.darwin to
your_path/to_the/bash_script, changing darwin to match your system.
Set vscode-neovim.NVIM_APPNAME to vscode-neovim in vscode settings.
Be Wild
Randomly select a theme from a curated list each time you start up and
automatically switches between day and night themes at scheduled time.
Additionally, the displayed verses on the welcome screen is also randomized with
each launch. With neovim, you can have a fresh experience every time. Be casual
and wild!
Showcase
The welcome screen displays two verses randomly selected from my curated
collection. You can select new verses and color schemes at random or access
frequently used commands from this screen.
This screenshot showcases writing Lua code with smart autocompletion through
both language server (LSP) and universal-ctags (ctags). This combination
seamlessly blends old-school and modern tools. The bottom window shows the
occurrence of referenced symbols that you specify (via lsp find references), while the right window shows the symbol outline of the current
file (via lsp document symbols).
This screenshot demonstrates the use of literate programming in neovim, which
is highly beneficial for data science workflows. You can write code in both
Python and R with intelligent autocompletion from both LSP and Ctags in quarto
or markdown files. Moreover, you can send your code to both R and Python REPL
simultaneously.
This screenshot demonstrates how to debug Python program in neovim. Stepping through
the code and watching variables and stack frames, just like in vscode.
Dependencies
You are responsible for installing the dependencies, but most of them are
optional. They consist mainly of language servers and linters that correspond
to their respective languages. You can choose the ones you need and leave out
the others. Even if certain dependencies are absent, neovim will still operate
and display notifications instead of halting completely.
If your system lacks a proper package manager, such as with Windows, or if the
packages are out of date, as with Debian, you can use Mason.nvim, a neovim
plugin specifically to install some of the dependencies. Dependencies marked
with a * can be installed through Mason.nvim. To install these packages
within neovim, enter :Mason in the prompt, and a popup window will appear
with the intuitive interface of Mason. From there, you can easily install
packages.
This configuration relies on an external tool called efm-langserver, which
can be installed via mason. However, it needs to be separately configured
outside of neovim. An example configuration for efm is provided in the dist
folder. To use this example configuration, simply copy the folder to
~/.config/.
python deps
python.
debugpy: this module should be included by the python at the top of your $PATH.
ipython
black*
efm-langserver*
pyright*
r deps
r-language-server: this is a R package that should be installed by the r at the top of your $PATH
radian
lua deps
lua-language-server*
stylua*
selene*
efm-langserver*
vimscript deps
vim-language-server*
markdown deps
prettierd*
vale*
efm-langserver*
sql deps
sqls*
sql-formatter*
bash deps
bash-language-server*
shellcheck*
latex deps
texlab*
latexindent*: while this package is shipped with texlive, perl shipped
by macOS cannot run this program, so I use a homebrew installed
latexindent instead.
cpp deps
clangd*: Apple's xcode command line tools ship this for you.
general purpose deps
universal-ctags
Keymaps
NOTE: this only includes keymaps defined by myself,
and some of the default plugins keymaps
that I used frequently.
The <Leader> key is <Space>,
the <LocalLeader> key is <Space><Space> or <Backslash>.
In case you forget the keymaps
you can always use <Leader>fk (:Telescope keymaps)
to find all keymaps.
Builtin keymaps
Builtin movement keymaps
Mode
LHS
RHS/Functionality
ic
<C-b>
<Left>
ic
<C-p>
<Up>
ic
<C-f>
<Right>
ic
<C-n>
<Down>
ic
<C-a>
Go to Beginning of the line
ic
<C-e>
Go to end of the line
ic
<C-h>
<Backspace>
ic
<C-k>
Del chars from cursor to line end
ic
<C-d>
Delete a char forwardly
c
<A-f>
Move cursor to next word
c
<A-b>
Move cursor to previous word
ivt
jk
Switch to normal mode
Builtin window keymaps
Mode
LHS
RHS/Functionality
n
<A-f>
Move current win to prev tab
n
<A-b>
Move current win to next tab
n
<A-w>
Go to next win
n
<A-p>
Go to Prev win
n
<A-t>
Move this win to new tab
n
<A-q>
Del this win
n
<A-v>
Vertically split current win
n
<A-s>
Horizontally split current win
n
<A-h>
Go to win to the left
n
<A-j>
Go to win to the below
n
<A-k>
Go to win to the above
n
<A-l>
Go to win to the right
n
<A-H>
Move current win to the left
n
<A-J>
Move current win to the below
n
<A-K>
Move current win to the above
n
<A-L>
Move current win to the right
n
<A-o>
Make current win the only win
n
<A-=>
Balance the win height/width
n
<A-|>
Maximize current win's width
n
<A-_>
Maximize current win's height
n
<A-<>
Decrease current win's width
n
<A->>
Increase current win's width
n
<A-+>
Increase current win's height
n
<A-->
Decrease current win's height
n
<A-]>
Downward scroll the float win
n
<A-[>
Upward scroll the float win
n
<Leader>wf
Move current win to prev tab
n
<Leader>wb
Move current win to next tab
n
<Leader>ww
Go to next win
n
<Leader>wp
Go to Prev win
n
<Leader>wT
Move this win to new tab
n
<Leader>wq
Del this win
n
<Leader>wv
Vertically split current win
n
<Leader>ws
Horizontally split current win
n
<Leader>wh
Go to win to the left
n
<Leader>wj
Go to win to the below
n
<Leader>wk
Go to win to the above
n
<Leader>wl
Go to win to the right
n
<Leader>wH
Move current win to the left
n
<Leader>wJ
Move current win to the below
n
<Leader>wK
Move current win to the above
n
<Leader>wL
Move current win to the right
n
<Leader>wo
Make current win the only win
n
<Leader>w=
Balance the win height/width
n
<Leader>w]
Downward scroll the float win
n
<Leader>w[
Upward scroll the float win
n
<Leader>w|
Maximize current win's width
n
<Leader>w_
Maximize current win's height
n
<Leader>w]
Jump to tags in a new window
n
<Leader>wg]
Select a tag to jump in a new window
Builtin tab keymaps
Mode
LHS
RHS/Functionality
n
<Leader><Tab>[
Go to next tab
n
<Leader><Tab>]
Go to prev tab
n
<Leader><Tab>n
Create a new tab
n
<Leader><Tab>c
Close current tab
n
<Leader><Tab>o
Close other tabs except this one
n
<Leader><Tab>h
Move tab to the left
n
<Leader><Tab>l
Move tab to the right
n
<Leader><Tab>1
Go to 1st tab
n
<Leader><Tab>2
Go to 2nd tab
n
<Leader><Tab>3
Go to 3rd tab
n
<Leader><Tab>4
Go to 4th tab
n
<Leader><Tab>5
Go to 5th tab
n
<Leader><Tab>6
Go to 6th tab
n
<Leader><Tab>7
Go to 7th tab
n
<Leader><Tab>8
Go to 8th tab
n
<Leader><Tab>9
Go to 9th tab
Builtin buffer keymaps
Mode
LHS
RHS/Functionality
n
<Leader>bd
Delete current buffer
n
<Leader>bw
Wipeout current buffer
n
<Leader>bp
Prev buffer
n
<Leader>bn
Next buffer
Builtin navigation keymaps
Mode
LHS
RHS/Functionality
n
]b
Next buffer
n
[b
Previous buffer
n
]q
Next quickfix list entry
n
[q
Prev quickfix list entry
n
]Q
Set current quickfix list as newer one in qflist history
n
[Q
Set current quickfix list as older one in qflist history
n
]t
Go to next tag location for currently searched symbol
n
[t
Go to previous tag location for currently searched symbol
Builtin miscellenous keymaps
Mode
LHS
RHS/Functionality
n
<Leader>olx
Open URI under cursor using xdg-open
n
<Leader>olw
Open URI under cursor using w3m
n
<C-g>
<ESC>
n
<Leader>mt
search current word from tags file and send to loclist
n
<Leader>mdc
Set working dir as current file's dir
n
<Leader>mdu
Set working dir up one level from current working dir
n
<Leader>mc
Pick a color scheme
n
<Leader>th
Toggle highlight serach (see :h hlsearch)
n
<Leader>tH
Toggle cmdheight between 0 or 1 (see :h cmdheight)
Toggle compilation based on main file or current file
n
<LocalLeader>la
Show the context menu for symbol under the cursor
n
<LocalLeader>lo
Show the compile output
n
<LocalLeader>ss
Add a surround env pair for current line
nv
<LocalLeader>s
Add a surround env pair for motion / text object / selected text
nv
<LocalLeader>c
Add a surround command pair for motion / text object / selected text
Mode
LHS
RHS/Functionality
n
dse
Delete the surround env
n
dsc
Delete the surround command
n
ds$
Delete the surround math delimiter
n
dsd
Delete the surround delimiter
n
cse
Change the surround env
n
csc
Change the surround command
n
cs$
Change the surround math delimiter
n
csd
Change the surround delimiter
Other Notes
vim-sneak defines relatively inconsistent behavior: in normal mode,
use s/S, in operator pending mode, use z/Z, in visual mode,
use s/Z. In normal mode, default mapping s is replaced.
In op mode, use z/Z is to be compatible with vim-surround (mappings: ys/ds/cs),
in visual mode, use s/Z is to be compatible with
folding (mapping: zf) and vim-surround (mapping: S)
You need to define your leader key before defining any keymaps.
Otherwise, keymap will not be correctly mapped with your leader key.
Note that tree-sitter will turn syntax off, and pandoc-syntax and pandoc-rmarkdown
relies on the builtin syntax, so we need to load config.pandoc before we load config.treesitter
vim-matchup will (intentionally) hide the status-line if the matched pair are spanned
over entire screen to show the other side of the pair.
Discussion
It is recommended to use the mailing list ~northyear/nvim-devel@lists.sr.ht.
Alternatively, you are also welcome to open a Github issue.