K-nvim or kn-vim, personal attempt to config Neovim and a pun on my username knmac.
Video demo with clickable lualine:
Config structure and cheat sheet (rendered):
Editing a python file, with LSP, Tree-sitter, and outline support:
- Targeting python, bash, latex, markdown, and (some) C/C++ usage.
- Lualine is configured to be (mostly) clickable. (Toggle with the command
:KnvimToggleClickableLualine). - Key-bindings that (hopefully) make sense.
- Fun (for me) to use!!!
The following dependencies are for manual installation.
- Neovim 0.11.0+. Follow the installation guide on Neovim's homepage. This repo is just holding the config.
- A nerdfont for the glyphs and a terminal that supports the font (the screenshots use Ghostty and its baked-in JetBrains Mono font). Knvim is also tested with WezTerm.
- npm for mason.nvim and mason-tool-installer.nvim (package managers for LSPs, DAPs, linters, and formatters).
- rg and fd for fuzzy finder (
Snacks.picker).
Optional dependencies:
- Python package
pynvim(can be installed withpip install pynvim). - LazyGit for quick git management from Snacks.nvim.
- Yazi for file explorer.
- A virtual environment (e.g.,
conda,pyenv, etc.) with the nameknvim.
Clone this repo to $HOME/.config:
git clone https://github.com/knmac/knvim.git $HOME/.config/knvimThen add this command to .bashrc or .zshrc.
export NVIM_APPNAME="knvim"Notes: Knvim will try to find the default python interpreter. But it is recommended to create a virtual environment using conda or pyenv with the name knvim to sandbox your package installation. For more information, see the variable vim.g.python3_host_prog in knvim/init.lua and knvim/core/setting.lua.
Simply delete the two directories $HOME/.config/knvim and $HOME/.local/share/knvim. You can also remove your virtual environment if you set up one.
Nvim-lazyman is a configuration manager that supports popular Neovim configurations. After installing nvim-lazyman, run the following command to install knvim:
lazyman -L KnvimFollow instructions from nvim-lazyman for details about installation, bootstrapping, and other cool features.
| Language | Name | Category |
|---|---|---|
| Python | basedpyright | LSP |
| ruff_lsp | Linter/Formatter | |
| debugpy | DAP | |
| Bash | bashls | LSP |
| shellcheck | Linter | |
| shfmt | Formatter | |
| bash-debug-adapter | DAP | |
| C/C++ | clangd | LSP |
| cpplint | Linter | |
| codelldb | DAP | |
| Vimscript | vimls | LSP |
| Lua | lua_ls | LSP |
| LaTex | texlab | LSP |
| bibtex-tidy | Formatter | |
| Markdown | marksman | LSP |
| prettier | LSP | |
| Typst | tinymist | LSP |
| typstyle | Formatter | |
| YAML | yamlls | LSP |
| prettier | Formatter | |
| Typescript/Javascript | ts_ls | LSP |
| prettier | Formatter | |
| JSON | jsonls | LSP |
| prettier | Formatter | |
| HTML/CSS | prettier | Formatter |
| Copilot | copilot | LSP |
init.lua
lsp/
└── ...
lua/
├── core/
│ ├── auto_commands.lua
│ ├── init.lua
│ ├── keymaps.lua
│ ├── settings.lua
│ └── symbols.lua
└── plugins/
├── coding/
│ ├── blink_cmp.lua
│ ├── dap.lua
│ ├── lsp_linter_formatter.lua
│ ├── neogen.lua
│ ├── neotest.lua
│ └── treesitter.lua
├── experimentals/
│ └── ...
├── ui/
│ ├── barbar.lua
│ ├── catppuccin.lua
│ ├── dropbar.lua
│ ├── lualine.lua
│ ├── noice.lua
│ ├── rainbow_delimiters.lua
│ └── winsep.lua
├── utils/
│ ├── diffview.lua
│ ├── easy-align.lua
│ ├── flash.lua
│ ├── gitsigns.lua
│ ├── leap.lua
│ ├── nvim-colorizer.lua
│ ├── oil.lua
│ ├── outline.lua
│ ├── persistence.lua
│ ├── quicker.lua
│ ├── renderer-markdown-obsidian.lua
│ ├── sidekick.lua
│ ├── snacks.lua
│ ├── todo-comments.lua
│ ├── which-key.lua
│ └── yazi.lua
└── init.luaThe configs in experimentals/ directories are not activated by default. To use them, uncomment the following line in lua/plugins/init.lua:
{ import = "plugins.experimentals", },If you want to try individual experimental plugins instead of the all of them, uncomment a specific plugins, e.g.,
{ import = "plugins.experimentals.neorg", },
{ import = "plugins.experimentals.remote-nvim", },Cheat sheet for knvim can be found here. You can also access cheat sheet from the start page.
This section shows you how to set up extra configuration for knvim to work as you want (completely optional).
Create the file pyproject.toml for each Python project, where the content looks something like this:
[tool.ruff]
line-length = 110
[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
select = ["E", "F"]
# Avoid enforcing line-length violations (`E501`)
ignore = ["E501"]
[tool.ruff.format]
# Use double quotes for strings.
quote-style = "double"
# Indent with spaces, rather than tabs.
indent-style = "space"For more information, visit here and here.
Create the file .vscode/launch.json for each project, where the content looks something like this:
{
"version": "0.2.0",
"configurations": [
{
"type": "python",
"request": "launch",
"name": "NAME OF THE LAUNCH",
"program": "${file} OR ${workspaceFolder}/path/to/file",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"repl_lang": "javascript",
"args": ["ARG1", "ARG2", ...]
}
]
}The above config uses Python as an example, but you can setup debugger for other languages similarly. The template for Python launcher can be generated with ,g. If you want to specify a file for a launch instead of the current file, you can also set cwd as ${workspaceFolder}/path/to/the/file. For more information, visit here.
Create the file ~/.gitconfig globally, where the content looks something like this:
[merge]
tool = nvim
[mergetool]
keepBackup = false
prompt = false
[mergetool "nvim"]
cmd = "nvim -d -c \"wincmd l\" -c \"norm ]c\" \"$LOCAL\" \"$MERGED\" \"$REMOTE\" -c DiffviewOpen"Create the file .marksman.toml for each project, where the (default) content looks something like this:
[core]
markdown.file_extensions = ["md", "markdown"]
text_sync = "full"
incremental_references = false
paranoid = false
[code_action]
toc.enable = true
create_missing_file.enable = true
[completion]
wiki.style = "title-slug"Q1: Why knvim is not working on Windows?
A1: knvim config targets Unix-based OS (e.g., Linux and MacOS) and is not fully tested on Windows. Some common problems include different path separator (/ on Unix vs \ on Windows) and EOL character (LF on Unix and CR LF on Windows). You may want to change these characters manually if you want to try knvim on Windows machines.
Q2: Why knvim does not include (this and that) by default?
A2: knvim is my personal config of Neovim, so it does not cover a wide range of different use cases. You are more than welcome (and recommended) to fork and customize knvim to your personal liking. That said, I will try to add some configs if they are commonly used. Cheers!
Q3: Why knvim does not render markdown correctly (using markdown preview)?
A3: This is mostly how the terminal is configured. I find Ghostty supports most of the features out-of-the box. For WezTerm, some features need additional setup. Please inspect the code carefully before running.
- Rendering under-curl ref:
tempfile=$(mktemp) \
&& curl -o "$tempfile https://raw.githubusercontent.com/wez/wezterm/master/termwiz/data/wezterm.terminfo" \
&& tic -x -o ~/.terminfo "$tempfile" \
&& rm "$tempfile"- Rendering strike-through ref:
infocmp "$TERM" > myterm.info
nvim myterm.info # add smxx=\E[9m, rmxx=\E[29m,
tic -x myterm.infoQ4: Image rendering in knvim?
A4: Corresponding configuration can be found in lua/plugins/utils/snacks.lua. For more information, refer to Snacks.nvim/image.
- Image rendering.
-
Automaticallycopy knvim to server for remote editing. You can try the experimental configplugins.experimental.remote-nvim. - Automatically switch path separator and
EOLcharacter, depending on the OS (Linux/MacOS/Windows). This will not be considered in the short run because I do not have a Windows machine to test :)


