Modular Neovim configuration for software development and note taking on Linux, based on Kickstart.nvim. nvim-config.liberacode.dev
nvim-config README.md
14 kB 367 lines
Markdown
at main

nvim config #

Modular Neovim configuration for software development and note taking on Linux. Based on Kickstart.nvim, split into modules under lua/custom/.

Screenshots #

File tree, a TypeScript file with Git change marks, and the project terminal with a passed test run LazyGit in a floating window with changed files, commits, and the unstaged and staged changes Completion menu with suggestions from the TypeScript language server

More screenshots in light and dark theme are in docs/screenshots/.

Features #

  • LSP, completion (blink.cmp, LuaSnip, Friendly Snippets), and Treesitter
  • Format-on-save with Conform
  • Telescope search and Neo-tree file tree
  • Tests with vim-test, debugging with nvim-dap
  • Gitsigns and LazyGit
  • Project terminal (ToggleTerm) and project/branch sessions (persistence.nvim)
  • Markdown rendering and inline images (render-markdown.nvim, image.nvim)
  • mini.nvim text objects, surround, and statusline; autopairs; HTML/JSX/TSX tag closing
  • liberacode color scheme
  • Plugins pinned in lazy-lock.json; tools installed by Mason

Requirements #

Required:

  • Neovim 0.12+
  • Git, curl, tar, unzip
  • Make and a C compiler
  • ripgrep
  • Node.js

Optional:

Tool Used for
Nerd Font UI icons
Deno 2.x Deno projects: language server denols (deno lsp) and formatter deno fmt (not installed by Mason)
Go Go development; Mason installs gopls, goimports, Delve with it
PHP, Composer PHP development; Mason installs Phpactor, PHP-CS-Fixer with it
Xdebug PHP debugging
Python 3 with venv (Debian: python3-venv) Python development; Mason installs basedpyright, Ruff, debugpy with it
ShellCheck, shfmt Shell diagnostics and formatting (not installed by Mason)
LazyGit Space g g
esbuild :MinifyJS, :MinifyCSS (project-local node_modules/.bin/esbuild first)
ImageMagick, Sixel terminal Image display
fd (Debian: fd-find) Telescope file search

Installation #

git clone https://tangled.org/liberacode.dev/nvim-config ~/.config/nvim
nvim

The first start installs plugins, Mason tools, and Treesitter parsers. Then restart Neovim and run:

:MasonToolsInstallSync
:ConfigHealth
:checkhealth

Try it next to an existing configuration:

git clone https://tangled.org/liberacode.dev/nvim-config ~/.config/nvim-config
NVIM_APPNAME=nvim-config nvim

Expected :checkhealth warnings #

Section Warning Cause
mason luarocks, Ruby, RubyGem, javac, julia, pip not available Not used by any configured Mason package
which-key Overlapping keymaps (sd/sdn, a/al, gc/gcc, ...) mini.surround, mini.ai, Neovim comment mappings
blink.cmp Some providers show as "disabled" Cmdline source is enabled dynamically
neo-tree gio trash --list failed No gvfs; Neo-tree uses its own trash implementation
vim.health Newer Nvim version available Update Neovim

Updating #

git -C ~/.config/nvim pull --ff-only
:Lazy restore
:MasonToolsUpdate
:TSUpdate
:ConfigHealth

:Lazy update and :Lazy sync update plugins and rewrite lazy-lock.json. :Lazy restore installs the revisions in lazy-lock.json.

Languages #

Language LSP Format on save Tests Debugging
JavaScript, JSX tsc or denols, Biome deno fmt or Biome vim-test (Vitest, Jest) Launch file, attach to Node
TypeScript, TSX tsc or denols, Biome deno fmt or Biome vim-test (Vitest, Jest) Attach to Node
HTML html LSP, with .editorconfig – –
CSS cssls, Biome deno fmt or Biome – –
SCSS cssls LSP, with .editorconfig – –
JSON, JSONC jsonls, Biome deno fmt or Biome – –
Go, Go templates gopls goimports, gofmt vim-test (go test) Delve
PHP phpactor PHP-CS-Fixer vim-test (PHPUnit, Pest) Xdebug
Python basedpyright, ruff Ruff vim-test (pytest, unittest) debugpy
C clangd – (Space f only) – codelldb
XML lemminx LSP, with .editorconfig – –
Lua lua_ls, LazyDev StyLua – –
Bash, sh bashls, ShellCheck shfmt, with .editorconfig – –
Markdown, MDX Marksman deno fmt (Markdown in Deno projects) – –
TOML – – – –

Language servers (Mason): basedpyright, bashls, biome, clangd, cssls, gopls, html, jsonls, lemminx, lua_ls, marksman, phpactor, ruff. tsc is the language server of the project's own TypeScript 7 (tsc --lsp, not installed by Mason).

Language server from the system: denols (runs deno lsp).

denols starts in projects with deno.json, deno.jsonc, or deno.lock; tsc starts only in other projects and needs TypeScript 7 or newer in node_modules or on PATH. When a folder has both a Node.js lock file and a Deno file, the one closer to the edited file wins.

Other Mason tools: codelldb, debugpy, delve, goimports, js-debug-adapter, php-cs-fixer, php-debug-adapter, stylua, tree-sitter-cli.

Treesitter parsers: bash, c, css, diff, go, gomod, gowork, html, javascript, json, lua, markdown, markdown_inline, php, python, query, scss, toml, tsx, typescript, vim, vimdoc, xml. MDX uses the markdown parser.

Formatter conditions #

Formatter Runs when the project contains
deno fmt deno.json or deno.jsonc; runs before Biome, and Biome does not run when deno fmt runs
Biome biome.json, biome.jsonc, .biome.json, or .biome.jsonc (project-local node_modules/.bin/biome first)
StyLua stylua.toml or .stylua.toml
PHP-CS-Fixer .php-cs-fixer.php or .php-cs-fixer.dist.php (project-local vendor/bin/php-cs-fixer first)
Ruff ruff.toml, .ruff.toml, or [tool.ruff] in pyproject.toml; organizes imports, then formats
shfmt, HTML/SCSS/XML LSP .editorconfig
goimports, gofmt always
  • No LSP fallback on save for filetypes with a configured formatter.
  • C and C++ are never formatted on save.
  • Timeout: 5 seconds.
  • Space f formats with LSP fallback.

Python #

  • basedpyright type-checking mode: standard, unless set in pyproject.toml or pyrightconfig.json.
  • Ruff hover is disabled; hover comes from basedpyright.
  • Debugging uses the project's virtual environment: $VIRTUAL_ENV, or .venv, venv, env, .env in the project root.
  • Test runner for debugging: pytest (pytest.ini or [tool.pytest...] in pyproject.toml), Django (manage.py), otherwise unittest.

C #

  • Build with debug information, e.g. gcc -g -O0 -o app main.c.
  • Space d c → Launch executable asks for the path (starts at the project root) or Attach to process.

Project root #

Search, Neo-tree, terminal, LazyGit, tests, and debugging use the project root, detected in this order:

  1. attached LSP workspace
  2. Git repository
  3. package.json, go.mod, composer.json, pyproject.toml, Cargo.toml
  4. directory of the current file
  5. current working directory

Key mappings #

Leader: Space. Press Space and wait to see the Which-key groups.

Editor #

Key Action
Esc Clear search highlighting
Ctrl+H / Ctrl+J / Ctrl+K / Ctrl+L Move to the window left / below / above / right
Space t s Toggle spell checking (current buffer)
Key Action
\ Reveal current file in Neo-tree; \ in Neo-tree closes it
Space s f Find files
Space s g Search text
Space s w Search word under cursor
Space s d Search diagnostics
Space s h Search help
Space s k Search key mappings
Space s s Select a Telescope picker
Space s r Resume last search
Space s . Recent files
Space s / Search in open files
Space s n Search Neovim configuration files
Space / Fuzzy search in current buffer
Space Space Open buffers

LSP #

Active when a language server is attached.

Key Action
grd Definition
grD Declaration
gri Implementation
grr References
grt Type definition
grn Rename
gra Code actions
gO Document symbols
gW Workspace symbols
K Hover
Ctrl+T Jump back
Space t h Toggle inlay hints

Completion #

Key Action
Ctrl+Space Open completion
Ctrl+N / Ctrl+P Next / previous item
Ctrl+Y Accept
Ctrl+E Close
Tab / Shift+Tab Next / previous snippet placeholder
Ctrl+K Toggle signature help (Insert mode)

Formatting and diagnostics #

Key Action
Space f Format buffer
Space x x Workspace diagnostics
Space x X Buffer diagnostics
Space x s Document symbols
Space x q Quickfix list
Space x l Location list

Tests #

Key Action
Space r n Nearest test
Space r f Current file
Space r s Test suite
Space r l Last test
Space r v Go to last test

Debugging #

Key Action
Space d c Start / continue
Space d b Toggle breakpoint
Space d B Conditional breakpoint
Space d i Step into
Space d o Step over
Space d O Step out
Space d l Run last configuration
Space d r Open REPL
Space d t Terminate
Space d u Toggle debug UI
Space d e Evaluate expression / selection
Space d g / Space d G Debug nearest / last Go test
Space d p / Space d P Debug Python test method / class at cursor

Git #

Key Action
Space g g Toggle LazyGit
]c / [c Next / previous hunk
Space h s Stage / unstage hunk (Visual mode: selected lines)
Space h r Reset hunk (Visual mode: selected lines)
Space h S Stage buffer
Space h R Reset buffer
Space h p Preview hunk
Space h b Blame line
Space h d Diff against index
Space h D Diff against last commit
Space t b Toggle line blame
Space t D Toggle deleted lines

Terminal and sessions #

Key Action
Space t t Toggle project terminal (Normal mode)
Esc Esc Leave terminal input mode
Space q s Restore session for current directory and branch
Space q l Restore last session
Space q S Select session
Space q d Stop saving current session

Commands #

Command Action
:MinifyJS / :MinifyCSS Save and write FILE.min.js / FILE.min.css with esbuild
:ConfigHealth Check Neovim version, external tools, and Mason tools
:ConformInfo Formatter status
:checkhealth vim.lsp LSP status
:checkhealth nvim-treesitter Treesitter status
:Lazy Plugin manager
:Mason Tool manager
:MasonToolsInstallSync Install configured Mason tools
:TSLog Treesitter install log
:BlinkCmp status Completion status

Configuration #

Setting Effect
NVIM_NERD_FONT=0 Disables Nerd Font icons (ASCII symbols in Neo-tree)
~/.local/bin/pynvim-python Python provider; without it the provider is disabled

The Perl, Ruby, and Node.js providers are disabled.

Development #

init.lua
lazy-lock.json
.stylua.toml
colors/liberacode.lua
lua/custom/
├── options.lua  filetypes.lua  keymaps.lua  autocmds.lua
├── commands.lua  project.lua  health.lua
├── dap/         c.lua  php.lua
└── plugins/     autotag  completion  core  dap-go  dap-python  debugging
                 formatting  gitsigns  image  lsp  markdown  neo-tree
                 persistence  telescope  terminal  testing  treesitter  trouble

Format Lua with StyLua (installed by Mason):

stylua --check .

Limitations #

  • lazy-lock.json pins plugins only, not Mason packages or Treesitter parsers.
  • Linux only.

Security and privacy #

  • Do not commit credentials, API keys, tokens, SSH keys, .env files, private source, or Neovim cache/session/undo state.
  • Formatters, tests, debuggers, terminals, Git integrations, Mason, and the minify commands run external tools. Review test scripts, formatter configuration, debug settings, and package-manager hooks of untrusted projects before use.
  • lazy.nvim and Mason install software from third-party sources. Review lazy-lock.json changes before publishing.
  • Do not post secrets, private source, or private logs in public issues.

License #

MIT, see LICENSE.md. Based on Kickstart.nvim (LICENSES/Kickstart-MIT.txt). Third-party plugins keep their own licenses, see THIRD_PARTY_NOTICES.md.