Skip to content

Antony-AXS/nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

280 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neovim Configuration

A modern, feature-rich Neovim configuration built for productivity. Uses the new Neovim 0.11+ LSP API (vim.lsp.config) and lazy.nvim for plugin management.

Features

  • Modern LSP Setup: Uses Neovim 0.11+ native vim.lsp.config API instead of the deprecated nvim-lspconfig setup pattern
  • Lazy Loading: Plugins are lazy-loaded where possible for fast startup
  • Treesitter: Full syntax highlighting, indentation, and text objects using the new nvim-treesitter main branch API
  • Fuzzy Finding: Telescope with multiple pickers and themes
  • Git Integration: Gitsigns, Neogit, Diffview, LazyGit, and Git Worktree support
  • Autocompletion: nvim-cmp with LSP, snippets, and buffer sources
  • Formatting: null-ls (none-ls) with prettier, stylua, and more
  • File Navigation: Harpoon for quick file switching
  • Database: vim-dadbod for database queries

Requirements

Required System Dependencies

Dependency Purpose Installation
Neovim 0.11+ Required for vim.lsp.config API and new treesitter neovim.io
Node.js & npm Required for many LSP servers (ts_ls, prettier, etc.) and formatters sudo apt install nodejs npm
ripgrep Required for Telescope live_grep and fast file searching sudo apt install ripgrep
git Required for lazy.nvim plugin management sudo apt install git
C compiler (gcc/clang) Required for treesitter parser compilation sudo apt install build-essential
tree-sitter-cli Required for nvim-treesitter (version 0.26.1+) npm install -g tree-sitter-cli

Optional Dependencies (for specific languages)

Dependency Purpose Installation
Go For gopls LSP, gofumpt, golines formatters go.dev
Rust For rust_analyzer LSP rustup.rs
Python For pylsp, jedi_language_server sudo apt install python3 python3-pip
PHP For intelephense LSP sudo apt install php
Ruby For htmlbeautifier formatter gem install htmlbeautifier

Installation

# 1. Backup your existing Neovim config (if any)
mv ~/.config/nvim ~/.config/nvim.bak
mv ~/.local/share/nvim ~/.local/share/nvim.bak

# 2. Clone this configuration
git clone <your-repo-url> ~/.config/nvim

# 3. Start Neovim - plugins will auto-install on first launch
nvim

# 4. Wait for lazy.nvim to install all plugins, then restart Neovim

# 5. Mason will auto-install LSP servers and formatters on startup
# You can check progress with :Mason

Plugin Management

This config uses lazy.nvim for plugin management and Mason for LSP/tool installation.

Command Description
:Lazy Open lazy.nvim UI - view installed plugins, logs, and profiles
:Lazy sync Install missing plugins, update existing ones, and remove unused plugins
:Lazy update Update all plugins to their latest versions
:Lazy clean Remove plugins that are no longer in your config
:Mason Open Mason UI - manage LSP servers, formatters, and linters
:MasonLog View Mason installation logs (useful for debugging)

Keymaps

Note: <leader> is set to \ by default in Neovim. All keymaps below use this leader key.

General

Keymap Mode Description
<Esc> Normal Clear search highlight - removes the yellow highlighting after searching
<C-z> Normal Disabled - prevents accidental terminal suspend which can be confusing
<leader>ll Normal Jump back to the last cursor position before using gg, G, {, }, etc.
<leader>sl Normal Toggle statusline between modes 2 (always show) and 3 (global statusline)
<leader>cs Normal Cycle through colorschemes: tokyonight → catppuccin → solarized-osaka
<leader>ih Normal Toggle LSP inlay hints (shows type information inline in code)

Telescope (Fuzzy Finder)

Telescope is the main way to navigate files, search content, and access Neovim features.

Keymap Mode Description
<leader>ff Normal Find files - search for files in current directory
<leader>fg Normal Live grep - search for text content across all files (requires ripgrep)
<leader>fb Normal Buffers - list and switch between open buffers
<leader>fh Normal Help tags - search Neovim help documentation
<leader>fo Normal Old files - recently opened files
<leader>fd Normal Diagnostics - list all LSP errors and warnings
<leader>fk Normal Keymaps - search all keybindings (great for discovering features)
<leader>fc Normal Colorschemes - preview and switch colorschemes
<leader>fm Normal Marks - list all marks set with m{letter}
<leader>fi Normal Registers - view contents of all registers
<leader>fz Normal Command history - search and re-run previous commands
<leader>fs Normal Search history - search and re-run previous searches
<leader>fe Normal Resume - reopen the last Telescope picker with previous results
<leader>fp Normal Pickers - list all previous Telescope pickers
<leader>ft Normal Find files (hidden) - includes hidden files (dotfiles)
<leader>fa Normal Find all files - includes hidden and ignored files
<leader>fr Normal Live grep (dropdown) - grep with dropdown theme
<leader>fx Normal Find files (ivy) - find files with ivy theme

LSP (Language Server Protocol)

These keymaps work when an LSP server is attached to the current buffer.

Keymap Mode Description
K Normal Hover - show documentation for symbol under cursor
gd Normal Go to definition - jump to where the symbol is defined
<leader>ca Normal, Visual Code actions - show available refactoring options (rename, extract, etc.)
<leader>gf Normal Format buffer - format the entire file using configured formatters
<Leader>1f Visual Format selection - format only the selected text
]d Normal Next diagnostic - jump to next error/warning
[d Normal Previous diagnostic - jump to previous error/warning

Harpoon (Quick File Navigation)

Harpoon lets you mark files and quickly jump between them. Much faster than using buffers for frequently accessed files.

Keymap Mode Description
<leader>hh Normal Add file - mark current file in harpoon (adds to tabline)
<leader>z Normal Toggle menu - open harpoon quick menu to see/edit all marks
<leader>th Normal Telescope marks - view harpoon marks in Telescope
<C-j> Normal Previous mark - navigate to previous harpoon file
<C-k> Normal Next mark - navigate to next harpoon file
m1 - m9 Normal Jump to mark 1-9 - directly jump to specific harpoon mark

Git (Gitsigns)

Gitsigns shows git diff information in the sign column and provides hunk-based operations.

Keymap Mode Description
]c Normal Next hunk - jump to next changed section
[c Normal Previous hunk - jump to previous changed section
<leader>hp Normal Preview hunk - show a popup with the hunk diff
<leader>hb Normal Blame line - show full git blame for current line
<leader>tb Normal Toggle line blame - show/hide inline blame at end of each line
<leader>hd Normal Diff this - open diff view for current file
<leader>hD Normal Diff this (~) - diff against previous commit
<leader>td Normal Toggle deleted - show/hide deleted lines inline
<leader>sh Normal Stage hunk - git add the current hunk
<leader>uh Normal Undo stage hunk - unstage the current hunk
<leader>ih Operator, Visual Select hunk - use hunk as text object

Git (Neogit & Diffview)

Neogit provides a Magit-like git interface. Diffview shows side-by-side diffs.

Keymap Mode Description
<leader>nd Normal Open Diffview - show all uncommitted changes in diff view
<leader>nc Normal Close Diffview - close the diff view
<leader>nh Normal File history (all) - show git history for entire repo
<leader>nq Normal File history (current) - show git history for current file
<leader>nt Normal Toggle files - toggle file panel in Diffview
<leader>nf Normal Neogit (floating) - open Neogit in floating window
<leader>ns Normal Neogit (split) - open Neogit in split above

Git Worktree

Git worktrees let you have multiple branches checked out simultaneously in different directories.

Keymap Mode Description
<leader>gt Normal Create worktree - create a new git worktree
<leader>gh Normal Switch worktree - switch to an existing worktree

Command: :Gwdel <path> - Delete a git worktree

Terminal (ToggleTerm)

ToggleTerm provides persistent terminal instances that can be toggled on/off.

Keymap Mode Description
<leader>cf Normal Float terminal - open terminal in floating window
<leader>cv Normal Vertical terminal - open terminal in vertical split (60 cols)
<leader>ch Normal Horizontal terminal - open terminal in horizontal split (12 rows)
<Esc> Terminal Exit terminal mode - return to normal mode (then use window commands)
<C-h/j/l> Terminal Navigate windows - move between terminal and editor windows

Buffer & Tab Navigation

Keymap Mode Description
<leader>we Normal Next buffer - switch to next buffer
<leader>wq Normal Previous buffer - switch to previous buffer
<leader>tt Normal Next tab - switch to next tab
<leader>tr Normal Previous tab - switch to previous tab
<leader>tc Normal Close tab - close current tab

Window Binding

Useful for comparing files side-by-side - cursor movements are synchronized.

Keymap Mode Description
<leader>ba Normal Bind windows - enable cursorbind for all windows in current tab
<leader>bn Normal Unbind windows - disable cursorbind for all windows

Treesitter Text Objects

These work in visual and operator-pending modes. For example, daf deletes a function, vif selects inside a function.

Keymap Mode Description
af Visual, Operator A function - select entire function including signature
if Visual, Operator Inner function - select function body only
ac Visual, Operator A class - select entire class
ic Visual, Operator Inner class - select class body only
ak Visual, Operator A conditional - select entire if/else block
ik Visual, Operator Inner conditional - select conditional body
al Visual, Operator A loop - select entire loop
il Visual, Operator Inner loop - select loop body
as Visual, Operator Scope - select current scope

Completion (nvim-cmp)

Keymap Mode Description
<C-Space> Insert Trigger completion - manually open completion menu
<CR> Insert Confirm - accept the selected completion item
<C-e> Insert Abort - close completion menu without selecting
<C-b> Insert Scroll up - scroll documentation window up
<C-f> Insert Scroll down - scroll documentation window down

Custom Commands

Command Description
:Tshift Toggle Cycle through colorschemes (tokyonight → catppuccin → solarized-osaka)
:Tshift sol Switch to solarized-osaka
:Tshift cat Switch to catppuccin
:Cppath Copy the full file path to system clipboard
:Ppath Print the relative file path in command line
:DeleteFile Delete the current file (with confirmation)
:RenameFile <name> Rename the current file
:Tc Close current tab (shortcut for :tabclose)
:Gcclog Open git commit log in a new tab
:Gwdel <path> Delete a git worktree

LSP Servers

These LSP servers are automatically installed via Mason on first startup:

Server Language Notes
lua_ls Lua Configured with inlay hints and disabled "missing-fields" warning
ts_ls TypeScript/JavaScript Full inlay hints enabled, formatting disabled (uses prettier)
pylsp Python Max line length set to 150
rust_analyzer Rust
gopls Go
html HTML
cssls CSS
jsonls JSON
bashls Bash/Shell
vimls Vimscript
yamlls YAML
clangd C/C++
vue_ls Vue
angularls Angular
emmet_ls Emmet HTML/CSS abbreviation expansion
sqls SQL
intelephense PHP
jedi_language_server Python Alternative Python LSP
quick_lint_js JavaScript Fast JS linter
taplo TOML
vale_ls Prose/Markdown
diagnosticls General

Formatters & Linters

Auto-installed via mason-tool-installer:

Formatters

Tool Languages Notes
stylua Lua Opinionated Lua formatter
prettier JS, TS, CSS, JSON, HTML Industry standard web formatter
prettierd JS, TS, CSS, JSON, HTML Faster prettier daemon
htmlbeautifier HTML Ruby-based HTML formatter
shfmt Shell/Bash Shell script formatter
yamlfmt YAML YAML formatter
gofumpt Go Stricter gofmt
golines Go Fixes long lines in Go

Linters

Tool Languages Notes
shellcheck Shell/Bash Shell script static analysis
shellharden Shell/Bash Shell script hardening suggestions
luacheck Lua Lua linter
vint Vimscript Vimscript linter
gitlint Git commits Commit message linter
gitleaks Git Detects secrets in git repos
editorconfig-checker All Validates .editorconfig rules

Colorschemes

Three colorschemes are configured and can be cycled with <leader>cs:

  1. catppuccin (default)

    • Flavor: frappe
    • Transparent background enabled
    • Custom integrations for cmp, gitsigns, treesitter, etc.
  2. solarized-osaka

    • Transparent sidebars and floats
    • Custom Telescope highlights
  3. tokyonight

    • Night variant

File Structure

~/.config/nvim/
├── init.lua                    # Main configuration file
│                               # - Vim options (number, wrap, etc.)
│                               # - lazy.nvim bootstrap
│                               # - LSP configuration (vim.lsp.config)
│                               # - Mason setup
│                               # - Keymaps
│                               # - Autocommands
│
├── lua/
│   ├── plugins.lua             # Main plugin specifications
│   │                           # - Telescope, Treesitter, Mason
│   │                           # - Completion (nvim-cmp)
│   │                           # - Autopairs, Surround
│   │
│   ├── constants.lua           # Shared constants and state
│   │
│   ├── plugins/
│   │   ├── git/
│   │   │   └── init.lua        # Git plugins (fugitive, gitsigns, neogit, lazygit, worktree)
│   │   │
│   │   ├── dadbod/
│   │   │   └── init.lua        # Database plugins (vim-dadbod, dadbod-ui)
│   │   │
│   │   └── colorschemes/
│   │       └── init.lua        # Colorscheme configs (catppuccin, solarized-osaka, tokyonight)
│   │
│   └── utils/
│       └── fn.lua              # Utility functions
│
├── vimrc.vim                   # Legacy vim settings (sourced by init.lua)
└── lazy-lock.json              # Plugin version lockfile (auto-generated)

Troubleshooting

LSP not working

  1. Check if the server is installed: :Mason
  2. Check LSP status: :LspInfo or :checkhealth lsp
  3. View LSP logs: :LspLog

Treesitter errors

  1. Update parsers: :TSUpdate
  2. Check installed parsers: :TSInstallInfo
  3. Reinstall a parser: :TSInstall <language>

Formatter not working

  1. Check if installed: :Mason
  2. Check null-ls status: :NullLsInfo
  3. Try manual format: :lua vim.lsp.buf.format()

Plugin issues

  1. Update plugins: :Lazy sync
  2. Check for errors: :Lazy then press L for logs
  3. Clear cache and reinstall: Delete ~/.local/share/nvim and restart

About

my personal neovim configuration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors