This is a Neovim configuration written in Lua using lazy.nvim for plugin management. It supports development in Rust, Python, Go, Lua, TypeScript, and more.
nvim/
├── init.lua # Main entry point
├── lua/
│ ├── core/ # Core Neovim settings
│ │ ├── lazy.lua # Plugin manager setup
│ │ ├── options.lua # Neovim options
│ │ ├── keymaps.lua # Keybindings
│ │ ├── autocmds.lua # Autocommands
│ │ ├── statusline.lua
│ │ ├── colors.lua
│ │ └── cmp.lua # nvim-cmp autocomplete
│ ├── lsp/ # LSP configuration
│ │ ├── lspconfig.lua
│ │ └── go.lua
│ └── plugins/ # Plugin configurations
│ ├── git.lua
│ ├── nvim-dap.lua
│ ├── nvim-treesitter.lua
│ └── ...
└── ftplugin/
└── java.lua
# Open Neovim and run health check
nvim +":checkhealth" +qa
# Use stylua to check for Lua syntax errors
# Test with verbose startup
nvim --startuptime /tmp/nvim.log# Format Lua files (via conform.nvim, mapped to <leader>m)
# Or run stylua directly:
stylua --check lua/
# Format Python files
ruff check --select I --fix .
ruff format .# Run nearest test (in Neovim)
<leader>tn
# Run test file (in Neovim)
<leader>tf
# Toggle test summary
<leader>ts
# Show test output
<leader>to
# Toggle output panel
<leader>tp# Lua (via lua_ls in Neovim)
# Open any .lua file and LSP will report issues
# Go
golangci-lint run
cargo clippy
# Python
ruff check .-
File Organization
- One require per line at the top of files
- Group related requires (core, plugins, lsp)
- Use modular files under
lua/core/,lua/lsp/,lua/plugins/
-
Indentation
- Use 4 spaces (not tabs)
- Config:
opt.shiftwidth = 4,opt.tabstop = 4,opt.expandtab = true
-
Line Length
- No hard limit, but prefer ~100 chars
- Use
opt.colorcolumn = '80'for reference
-
Imports
-- Use require for modules local status_ok, lazy = pcall(require, "lazy") if not status_ok then return end -- Use pcall for protected require
-
Variables
local g = vim.g -- Global variables local opt = vim.opt -- Options local fn = vim.fn -- Functions local api = vim.api -- API
-
Keymaps
-- Preferred: vim.keymap.set (modern) vim.keymap.set("n", "<leader>ff", function() -- code end, { silent = true, desc = "Find files" }) -- Legacy: vim.api.nvim_set_keymap map("n", "<C-s>", ":call ToggleSignColumn()<CR>")
-
Plugin Setup
-- Use table-style setup require("plugin_name").setup({ option = value, }) -- Or with opts require("plugin_name").setup(opts) -- Lazy loading { "author/plugin", event = "BufRead", -- or "InsertEnter", "VeryLazy" ft = { "lua", "vim" }, -- filetype keys = { ... }, -- lazy-load on keybind }
-
Error Handling
-- Always use pcall for loading plugins local status_ok, plugin = pcall(require, "plugin") if not status_ok then return end
-
Naming Conventions
- Variables:
camelCaseorsnake_case - Tables/Modules:
snake_case - File names:
snake_case.lua - Keymap descriptions: "Description" (title case)
- Variables:
-
Formatting
- Use stylua for Lua formatting
- Config in
lua/core/lazy.lua:
formatters_by_ft = { lua = { "stylua" }, python = { "ruff_organize_imports", "ruff_format" }, }
- Use double quotes for strings
- Use
-- commentfor comments - Keep vimscript minimal; prefer Lua
-- Standard on_attach pattern
local on_attach = function(client, bufnr)
-- Map keys
vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts)
end
-- Use vim.lsp.config for new API (Neovim 0.10+)
vim.lsp.config("rust_analyzer", {
on_attach = on_attach,
capabilities = capabilities,
})
vim.lsp.enable("rust_analyzer")- Use neotest for running tests
- Configure adapters in plugin setup
- Java tests:
nvim-neotest/nvim-nio+rcasia/neotest-java
- Plugin Manager: lazy.nvim
- LSP: nvim-lspconfig, mason.nvim
- Completion: nvim-cmp
- Treesitter: nvim-treesitter
- Formatter: conform.nvim (stylua, ruff)
- Debug: nvim-dap
- UI: lualine, noice.nvim, which-key.nvim
- Add to
lua/core/lazy.luain the spec table - Configure in a new file under
lua/plugins/if complex - Add keymaps in
lua/core/keymaps.luaif needed
- Install via Mason:
:MasonInstall <server> - Add to servers list in
lua/lsp/lspconfig.lua - Configure in the same file if custom settings needed
Edit lua/core/keymaps.lua. Use vim.keymap.set() for new bindings.
stylua- Lua formatterruff- Python formatter/linterripgrep- For LeaderFfzf- For fuzzy findinggolangci-lint- Go linternode>= 20.19.0 - For TypeScript LSP