Skip to content

Repository files navigation

Neovim Configuration

nvim screenshot

This repository contains a Lua-based Neovim configuration with a small init.lua entrypoint and focused modules under lua/config/. It is tuned for native Neovim LSP features, lazy-loaded plugins, VimR on macOS, and a local light/dark colorscheme setup.

Entry Point

init.lua loads these modules in order:

  • config.globals
  • config.options
  • config.lazy
  • config.autocmds
  • config.keymaps

config.lsp loads on the first supported filetype instead of during startup.

Layout

  • init.lua bootstraps the config
  • lua/config/globals.lua sets leader keys and disables built-in providers/netrw
  • lua/config/lazy.lua bootstraps lazy.nvim
  • lua/config/options.lua sets core editor options
  • lua/config/autocmds.lua defines colorscheme switching and filetype-specific behavior
  • lua/config/keymaps.lua defines custom mappings
  • lua/config/lsp.lua enables Neovim's built-in LSP clients and turns on native LSP features on attach
  • colors/ contains local colorscheme files

Plugin Manager

The configuration uses lazy.nvim. If it is not installed, lua/config/lazy.lua clones the stable branch into Neovim's data directory on startup.

Plugins

The current lua/config/plugins.lua declares these plugins:

PluginNotes
dmtrKovalenko/fff.nvimLazy-loaded for file finding and live grep
vinitkumar/fff-plus.nvimLazy-loaded extension pickers for buffers, Git files, and colorschemes
dmmulroy/tsc.nvimLazy-loaded for TypeScript buffers, configured to run tsgo --noEmit --pretty false
tpope/vim-commentaryComment operator on gc
nvim-lualine/lualine.nvimCustom "bubbles" statusline theme with native diagnostics/progress segments
nvim-tree/nvim-web-deviconsDependency for lualine and nvim-tree
lukas-reineke/indent-blankline.nvimLoaded via ibl on BufReadPost
nvim-tree/nvim-tree.lua:NvimTreeToggle file tree
kdheepak/lazygit.nvim:LazyGit integration
nvim-treesitter/nvim-treesitterStarts Tree-sitter on file buffers and registers markdown_inline as markdown
brenoprata10/nvim-highlight-colorsBackground color previews, including Tailwind and variable usage
kevinhwang91/nvim-ufoFolding with Tree-sitter/indent providers
kevinhwang91/promise-asyncnvim-ufo dependency
MagicDuck/grug-far.nvimSearch and replace UI
vimwiki/vimwikiWiki and diary support, lazy-loaded for vimwiki filetype and Vimwiki commands
ggandor/leap.nvimMotion plugin mapped on s, S, and gs
kylechui/nvim-surroundSurround text objects
j-hui/fidget.nvimLSP progress UI
vinitkumar/lanciabones.nvimPrimary colorscheme, loaded when a UI attaches
rktjmp/lush.nvimlanciabones.nvim dependency
zenbones-theme/zenbones.nvimlanciabones.nvim dependency

Colorschemes

lua/config/autocmds.lua loads lanciabones after a UI attaches, so headless sessions skip the Lush/Zenbones rendering cost. It renders light and dark variants based on vim.o.background.

Background selection works like this:

  • NVIM_BACKGROUND=dark or NVIM_BACKGROUND=light overrides everything
  • on macOS, the config reads AppleInterfaceStyle and follows the system appearance
  • elsewhere, the default is dark

The repo also ships a colors/ directory with local colorscheme files.

Options

The current defaults from lua/config/options.lua include:

  • line numbers and relative line numbers enabled
  • UTF-8 encodings
  • system clipboard via unnamed and unnamedplus
  • GUI font set to Berka Mono Closer Narrow:h18
  • 2-space indentation with expandtab
  • textwidth = 80
  • termguicolors = true
  • Tree-sitter folding via foldexpr
  • completion popup borders via pumborder=rounded
  • floating window borders via winborder=rounded
  • native popup completion tuned with completeopt = menu,menuone,popup,fuzzy,nearest
  • pummaxwidth = 80
  • persistent undo in stdpath("data") .. "/undo//"
  • cursorline, hlsearch, wrap, and wildmenu enabled
  • swapfile, backup, and writebackup disabled
  • list enabled by default with visible tab/trailing/extends markers
  • splitbelow and splitright enabled

Autocommands

The config defines these behaviors in lua/config/autocmds.lua:

  • strip trailing whitespace before write, except for binary buffers and diff files
  • re-evaluate background/colorscheme on FocusGained
  • for ~/vimwiki/diary/*.wiki, insert a template from ~/.vim/bin/generate-vimwiki-diary-template
  • for *.md, force markdown filetype and set softtabstop/shiftwidth to 4
  • for *.md, *.txt, *.adoc, *.html, and COMMIT_EDITMSG, enable wrap, linebreak, spell, and kspell completion
  • for gitcommit, enable spelling and set textwidth = 72
  • for javascript, typescript, json, c, html, and htmldjango, enforce 2-space indentation
  • for *.tsx, force filetype=typescript.tsx
  • for *.yaml and *.yml, force filetype=yaml
  • for yaml, enforce 2-space indentation

LSP

lua/config/lsp.lua enables Neovim's built-in LSP for:

  • Ruby LSP: ruby-lsp with root markers Gemfile, .ruby-version, and .git
  • TypeScript LSP: typescript-language-server --stdio
  • Lua LSP: lua-language-server
  • OCaml: resolves $(opam var prefix)/bin/ocamllsp lazily when an OCaml buffer opens, with root markers .opam, dune-project, and .git
  • Pyright: pyright-langserver --stdio

On LspAttach, the config also enables these Neovim 0.12 native features when the server supports them:

  • auto-triggered native LSP completion
  • code lens display and execution
  • linked editing ranges
  • rounded diagnostic floats

Keymaps

The current custom mappings from lua/config/keymaps.lua are:

ModeMappingAction
Normal<C-p>Linux: require("fzf-lua").files(), otherwise lazy-load fff.nvim file finding
Normal<C-b>Linux: require("fzf-lua").buffers(), otherwise lazy-load the fff-plus.nvim buffer picker
Normal<C-h>Linux: require("fzf-lua").git_files()
Normalfglazy-load fff.nvim live grep
Normal<leader>glazy-load the fff-plus.nvim Git file picker
Normal<leader>clazy-load the fff-plus.nvim colorscheme picker
Normal<C-c>:NvimTreeToggle<CR>
Normal<C-t>:tabNext<CR>
Normal<C-e>open buffer diagnostics in the location list
Normal<C-g>:LazyGit<CR>
Normal<leader>Sopen grug-far search and replace
Normal/Visual<leader>swopen grug-far prefilled with word or selection
Normal<leader>gdnative LSP definition
Normal<leader>gynative LSP type definition
Normal<leader>grnative LSP references
Normal<leader>ginative LSP implementation
Normal<leader>hhorizontal split
Normal<leader>lr:LspRestart
Normal<leader>lwnative workspace diagnostics
Normal<leader>vvertical split
Normal<leader>tnew tab
Normal<leader>dtinsert strftime("%c")
Normal<leader>rnrename symbol
Normal<leader>cacode action
Normal<CR>go to end of file (G)
Normal<BS>go to start of file (gg)
Normal<j>display-line down (gj)
Normal<k>display-line up (gk)
NormalzRopen all folds with nvim-ufo
NormalzMclose all folds with nvim-ufo
NormalzKpreview folded lines with nvim-ufo
Normal/Visual/OperatorsLeap forward
Normal/Visual/OperatorSLeap backward
Normal/Visual/OperatorgsLeap from window
Normalgrxrun native LSP code lens
NormalKhover documentation
Insert<Tab>native popup next item or literal tab
Insert<S-Tab>native popup previous item or literal shifted tab
Insert<CR>native popup confirm when an item is selected, otherwise newline

Leader is ,.

Requirements

Based on the current config, these external tools are expected:

  • Neovim with Lua config support and vim.lsp.config / vim.lsp.enable
  • git to bootstrap lazy.nvim
  • fzf-lua available on Linux if you use the Linux-only finder keymaps
  • Rust as a fallback if fff.nvim cannot download a prebuilt binary
  • lazygit for :LazyGit
  • ruby-lsp for Ruby
  • typescript-language-server for JavaScript and TypeScript
  • lua-language-server for Lua
  • opam and ocamllsp for the OCaml LSP
  • pyright-langserver for Python
  • tsgo for tsc.nvim
  • ~/.vim/bin/generate-vimwiki-diary-template if you use vimwiki diary creation

Installation

git clone https://github.com/vinitkumar/nvim ~/.config/nvim
nvim

On first launch, lazy.nvim bootstraps itself and installs the configured plugins.

Tests

Run the headless startup, 50 ms cold-cache and 75 ms UI-ready performance budgets, key-triggered lazy-loading, and first-buffer LSP checks with make test. Install the locked plugins before running the integration tests.

About

My Neovim configuration in Lua, tuned for writing and software development.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages