Neovim configuration with some personal hacks.
Create file named .nvimrc
(also can be _nvimrc
on Windows) in
home
or config
directory.
It's a pure text file with json syntax. Example:
/home/anthonyk213/.nvimrc
{
// Set `true` if internet connection is unavailable.
"offline": false,
// Dependencies
"dep": {
// (string|array) Shell
"sh": ["pwsh", "-nologo"],
// (string) C compiler
"cc": "clang",
// (string) Python3 executable path
"py3": "python3/executable/path",
// (string) Proxy
"proxy": "http://127.0.0.1:7890"
},
// Paths
"path": {
// (string) Home directory
"home": "$HOME",
// (string) Cloud drive directory
"cloud": "$HOME/cloud",
// (string) Desktop directory
"desktop": "$HOME/Desktop",
// (string) Binaries directory
"bin": "$HOME/bin"
},
// Terminal UI
"tui": {
// ("onedark"|"tokyonight"|"gruvbox"|"nightfox"|"onenord") Color scheme
"scheme": "nightfox",
// ("dark"|"light") Tui background theme
"theme": "dark",
// (string) Style of color scheme
"style": "nord",
// (boolean) Make background transparent
"transparent": false,
// (boolean) Global statusline
"global_statusline": false,
// (string) Floating window border style
"border": "single",
// (boolean) nvim-cmp ghost text
"cmp_ghost": false,
// (boolean) Dim inactive window automatically
"auto_dim": false,
// (boolean) Animation effects
"animation": false,
// (boolean) Show current context by indent line
"show_context": false,
// (boolean) Enable devicons
"devicons": false,
// (string|array) Welcome page title
"welcome_header": "NEOVIM",
// (string|array) Bufferline style
"bufferline_style": "thin"
},
// GUI (neovim-qt, fvim, neovide)
"gui": {
// ("auto"|"dark"|"light") GUI background theme
"theme": "auto",
// (number) Window opacity
"opacity": 0.98,
// (boolean) Render ligatures
"ligature": false,
// (boolean) Use GUI popup menu
"popup_menu": false,
// (boolean) Use GUI tabline
"tabline": false,
// (boolean) Use GUI scroll bar
"scroll_bar": false,
// (number) Line space
"line_space": 0.0,
// (boolean) Cursor blink
"cursor_blink": false,
// (number) GUI font size
"font_size": 13,
// (string) See `guifont`
"font_half": "Monospace",
// (string) See `guifontwide`
"font_wide": "Monospace"
},
// Language Server Protocol
"lsp": {
// (boolean|object) https://github.com/clangd/clangd
"clangd": false,
// (boolean|object) https://github.com/LuaLS/lua-language-server
"lua_ls": {
"load": false,
"settings": {
"Lua": {
"runtime": {
"version": "LuaJIT"
},
"diagnostics": {
"globals": [ "vim" ]
},
"workspace": {
// "${lua_expression}" is allowed.
"library": "${vim.api.nvim_get_runtime_file('', true)}",
"checkThirdParty": false
},
"telemetry": {
"enable": false
},
"format": {
"defaultConfig": {
"indent_style": "space",
"indent_size": "2"
}
}
}
}
},
// (boolean|object) https://github.com/OmniSharp/omnisharp-roslyn
"omnisharp": {
"load": false,
// Some LSPs' semantic tokens are not usable
"disable_semantic_tokens": true
},
// (boolean|object) https://github.com/microsoft/pyright
"pyright": {
"load": false,
// Extra settings, depends on the LSP
"settings": {
"python": {
"analysis": {
"autoSearchPaths": true,
"diagnosticMode": "workspace",
"useLibraryCodeForTypes": true,
"stubPath": "stubPath",
"typeCheckingMode": "off"
}
}
}
},
// (boolean|object) https://github.com/rust-analyzer/rust-analyzer
"rust_analyzer": false,
// (boolean|object) https://github.com/iamcco/vim-language-server
"vimls": false
// And so on...
},
// Treesitter
"ts": {
// (array) Parsers to install automatically
"ensure_installed": [],
// (array) File type to disable treesitter highlight
"highlight_disable": [],
// (array) File type to disable vim-matchup
"matchup_disable": []
},
// Debug Adapter Protocol
"dap": {
// (boolean) https://github.com/llvm/llvm-project
"lldb": false,
// (boolean) https://github.com/Samsung/netcoredbg
"netcoredbg": false,
// (boolean) https://github.com/microsoft/debugpy
"debugpy": false
},
// Disabled built-in plugins
"disable": [
"matchit",
"matchparen",
"netrwPlugin"
]
}
-
Requirements
-
Clone repository
- Windows
git clone --depth=1 https://github.com/AnthonyK213/nvim.git ` "$env:LOCALAPPDATA\nvim"
- GNU/Linux
git clone --depth=1 https://github.com/AnthonyK213/nvim.git \ "${XDG_DATA_HOME:-$HOME/.config}"/nvim
- Windows
-
Start Neovim and wait for the installation to complete
-
Install LSP servers with
Mason
command (unavailable whenoffline
istrue
) -
Set
.vimrc
for Vim (optional)- Windows
Copy-Item "$env:LOCALAPPDATA\nvim\viml\vimrc.vim" ` -Destination "$env:HOMEPATH\_vimrc"
- GNU/Linux
cp "${XDG_DATA_HOME:-$HOME/.config}"/nvim/viml/vimrc.vim \ "${XDG_DATA_HOME:-$HOME}"/.vimrc
- Windows
Modifier | Key | Mode | Description |
---|---|---|---|
Ctrl | S | in | Save current buffer to file. |
Ctrl | direction |
n | Adjust window size. |
Meta | a | in | Select all text in current buffer. |
Meta | c | v | Copy to system clipboard. |
Meta | d | t | Close the terminal. |
Meta | e | n | nvim-tree.lua find file. |
Meta | g | nv | Find and replace. |
Meta | h | nv | Goto the window left. |
Meta | j | nv | Goto the window below. |
Meta | k | nv | Goto the window above. |
Meta | l | nv | Goto the window right. |
Meta | n | nv | Move line(s) down. |
Meta | p | nv | Move line(s) up. |
Meta | v | inv | Paste from system clipboard. |
Meta | w | inv | Switch window in turns. |
Meta | x | v | Cut to system clipboard. |
Meta | , | n | Open nvimrc . |
Meta | CR | i | Begin a new line below the cursor and insert bullet. |
Meta | number |
in | Goto tab (Number 1, 2, 3, ..., 9, 0). |
Meta | B | in | Toggle Markdown/LaTeX bold. |
Meta | I | in | Toggle Markdown/LaTeX italic. |
Meta | M | in | Toggle Markdown bold_italic; LaTeX Roman Family. |
Meta | P | in | Toggle Markdown block . |
Meta | U | inv | Markdown underscore. |
Ctrl | N | inv | Cursor down. |
Ctrl | P | inv | Cursor up. |
Ctrl | B | ci | Cursor left. |
Ctrl | F | ci | Cursor right. |
Ctrl | A | ci | To the first character of the screen line. |
Ctrl | E | ci | To the last character of the screen line. |
Ctrl | K | i | Kill text until the end of the line. |
Meta | b | cin | Cursor one word left. |
Meta | f | cin | Cursor one word right. |
Meta | d | i | Kill text until the end of the word. |
Meta | x | in | Command-line mode. |
* | v | Search visual selection downward. | |
# | v | Search visual selection upward. | |
F5 | n | nvim-dap continue debugging; presenting.nvim presenting view. | |
Shift | F5 | n | CodeRun . |
CtrlShift | F5 | n | CodeRun test . |
F8 | invt | Toggle mouse status. | |
F10 | n | nvim-dap step over. | |
Shift | F11 | n | nvim-dap step into. |
CtrlShift | F11 | n | nvim-dap step out. |
leader | bb | n | bufferline.nvim pick buffer. |
leader | bc | n | Set cwd to current buffer directory. |
leader | bd | n | Delete current buffer. |
leader | bg | n | Toggle background theme. |
leader | bh | n | Stop the search highlighting. |
leader | bn | n | Goto the next buffer. |
leader | bp | n | Goto the previous buffer. |
leader | cc | nv | Chinese characters count. |
leader | cs | n | Toggle spell check. |
leader | db | n | nvim-dap toggle break point. |
leader | dc | n | nvim-dap clear break point. |
leader | dl | n | nvim-dap run last. |
leader | dn | n | nvim-dap-ui toggle dap-ui. |
leader | dr | n | nvim-dap toggle REPL window. |
leader | dt | n | nvim-dap terminate. |
leader | ev | n | Evaluate lua chunk surrounded by backquote. |
leader | el | n | Evaluate lisp chunk (math) surrounded by backquote. |
leader | fb | n | telescope.nvim buffers. |
leader | ff | n | telescope.nvim find files. |
leader | fg | n | telescope.nvim live grep. |
leader | gb | n | gitsigns.nvim blame line. |
leader | gn | n | Neogit open. |
leader | gh | n | diffview.nvim open file history in tab. |
leader | gj | n | gitsigns.nvim next hunk. |
leader | gk | n | gitsigns.nvim previous hunk. |
leader | gl | n | toggleterm.nvim open lazygit. |
leader | gp | n | gitsigns.nvim preview hunk. |
leader | gs | n | Show git status. |
leader | hb | nv | Search cword/selection with Baidu. |
leader | hd | nv | Search cword/selection with DuckDuckGo. |
leader | hg | nv | Search cword/selection with Google. |
leader | hh | nv | Search cword/selection with StarDict (requires local dictionary). |
leader | hy | nv | Search cword/selection with Youdao dictionary. |
leader | jm | n | Toggle jieba-mode. |
leader | kc | nv | Comment current/selected line(s). |
leader | ku | nv | Uncomment current/selected line(s). |
leader | l0 | n | Document symbol. |
leader | la | n | Code action. |
leader | ld | n | Goto declaration. |
leader | lf | n | Goto definition. |
leader | lh | n | Signature help. |
leader | li | n | Implementation. |
leader | lk | n | Show diagnostics in a floating window. |
leader | lm | n | Format. |
leader | ln | n | Rename. |
leader | lr | n | References. |
leader | lt | n | Type definition. |
leader | lw | n | Work space symbol. |
leader | l[ | n | Goto previous diagnostic mark. |
leader | l] | n | Goto next diagnostic mark. |
leader | mf | n | Fetch recently unseen mails from IMAP server. |
leader | ml | n | Regenerate list bullets. |
leader | mn | n | Create a new mail(.eml file). |
leader | ms | n | Send current buffer as an e-mail. |
leader | mv | n | aerial.nvim/VimTeX toggle table of content. |
leader | mt | n | Toggle preview (Markdown/Marp/LaTeX/GLSL) |
leader | mi | n | glslViewer input. |
leader | nd | n | Append the weekday after a date (yyyy-mm-dd). |
leader | ns | n | Insert timestamp after cursor. |
leader | nt | n | Print TODO list. |
leader | ob | n | Open file of buffer with system default browser. |
leader | oe | n | Open system file manager. |
leader | ot | n | Open terminal. |
leader | op | n | nvim-tree.lua toggle. |
leader | ou | n | Open path or url under the cursor. |
leader | sa | nv | Surrounding add. |
leader | sc | n | Surrounding change. |
leader | sd | n | Surrounding delete. |
leader | ta | n | vim-table-mode add formula. |
leader | tc | n | vim-table-mode evaluate formula. |
leader | tf | n | vim-table-mode re-align. |
leader | vs | n | Show highlight information. |
leader | zbd | v | Decode visual selection with base64. |
leader | zbe | v | Encode visual selection with base64. |
leader is mapped to SPACE.
Command | Arguments | Description |
---|---|---|
CodeRun |
build /test /... |
Run or compile the code. |
BuildDylibs |
Build crates in $config/rust/ directory. |
|
GlslViewer |
Open glslViewer. | |
NvimUpgrade |
stable /nightly |
Upgrade neovim by channel. |
PushAll |
-b {branch}-m {commit}-r {remote} |
Just push everything to the remote. |
Time |
Print date and time. |