This repository contains a personal Neovim configuration optimized for modern development workflows, particularly focusing on Python. It leverages Lua for configuration and lazy.nvim for plugin management, aiming for a balance between features, performance, and maintainability.
- Modern Development Environment: Provide a feature-rich editing experience comparable to modern IDEs, including robust code intelligence, debugging, and testing capabilities.
- Performance: Utilize lazy-loading extensively via
lazy.nvimto ensure fast startup times and responsiveness. - Python Focus: Offer first-class support for Python development, including accurate linting/formatting, type checking, debugging (
nvim-dap), and virtual environment awareness (includingpyenv). - Maintainability: Organize configuration logically using Lua modules, making it easier to understand, modify, and extend.
- Ergonomics: Implement sensible keybindings (inspired by common practices and personal preferences) for efficient navigation and interaction.
This configuration includes a curated set of plugins managed by lazy.nvim:
- Plugin Manager: lazy.nvim - Fast, declarative plugin management.
- Core Editor Enhancements:
- nvim-treesitter: Advanced syntax highlighting, indentation, text objects, and code navigation.
- nvim-surround: Easily add/change/delete surrounding pairs (quotes, brackets, etc.).
- Comment.nvim: Smart, context-aware commenting.
- gitsigns.nvim: Git decorations in the sign column and hunk management.
- Language Server Protocol (LSP):
- nvim-lspconfig: Core LSP configuration framework.
- mason.nvim & mason-lspconfig.nvim: Seamless installation and management of LSP servers.
- fidget.nvim: UI for LSP progress notifications.
- Configured LSPs include
pyright,lua_ls,bashls,marksman,esbonio,html, etc.
- Completion & Snippets:
- nvim-cmp: Autocompletion framework.
- LuaSnip: Snippet engine.
- friendly-snippets: Collection of common snippets.
- Sources configured: LSP, snippets, buffer, path.
- Debugging (DAP):
- nvim-dap: Debug Adapter Protocol client.
- nvim-dap-python: Python debugger integration (
debugpy). Configured to work withpyenv. - nvim-dap-ui: UI for DAP sessions (scopes, breakpoints, watches, REPL).
- Fuzzy Finding:
- telescope.nvim: Highly extendable fuzzy finder for files, buffers, grep, LSP symbols, etc.
- telescope-fzf-native.nvim: Performance boost using native FZF sorting.
- UI & Aesthetics:
- gruvbox.nvim: Theme.
- lualine.nvim: Statusline.
- nvim-web-devicons: Filetype icons.
- Entry Point:
init.luaserves as the main entry point, responsible for loading core options, bootstrappinglazy.nvim, loading keymaps, and setting the colorscheme. - Core Settings: Basic editor settings (indentation, line numbers, search behavior, etc.) are defined in
lua/core/options.lua. - Plugin Management:
lazy.nvimis set up inlua/core/lazy_setup.lua. It loads plugin specifications from files within thelua/plugins/directory. Each file typically configures one plugin or a related group of plugins (e.g.,lua/plugins/lsp.lua,lua/plugins/dap.lua). - Keymaps: Global and plugin-specific keymaps are defined in
lua/core/keymaps.lua. Plugin-specific keymaps that depend on the plugin being loaded might also be defined within the plugin's configuration file (e.g.,gitsignsuseson_attach,nvim-dapuses thekeystable). - Custom Snippets: User-defined snippets are placed in
lua/custom-snippets/(e.g.,lua/custom-snippets/python.lua).
A comprehensive list of custom keybindings can be found in KEYMAPS.md.
- Prerequisites:
- Neovim >= 0.8 (check
nvim --version) - Git
- A C compiler (for Treesitter parsers, e.g.,
build-essentialon Debian/Ubuntu) make(fortelescope-fzf-native)python3andpippyenv(optional, but recommended for managing Python versions; the DAP config attempts to detect it)- A Nerd Font installed and configured in your terminal for icons and separators.
- Neovim >= 0.8 (check
- Clone the Repository:
git clone <repository_url> ~/.config/nvim
- Install Python Debugger:
(Note: If using
pip install debugpy
pyenv, ensuredebugpyis installed in the Python version(s) you intend to debug). - Launch Neovim:
Open Neovim (
nvim).lazy.nvimshould automatically bootstrap itself and install the configured plugins. You might need to restart Neovim after the initial installation. - Treesitter Parsers: Run
:TSUpdateinside Neovim to install/update Treesitter parsers if they weren't automatically installed. - Mason LSP/DAP Servers: Run
:Masonto open the Mason UI and ensure required LSP servers (pyright,lua_ls, etc.) and DAP adapters are installed.mason-lspconfigshould handle installing theensure_installedservers automatically on startup.
- Python Debugging: Open a Python file and use
<leader>dpto start debugging. Seedap_practice.pyfor examples and keymap reminders. Ensure the correctpyenvenvironment is active before launching Neovim if you rely onpyenv globalorpyenv local. - LSP: LSP features (diagnostics, hover, definition, etc.) should activate automatically for supported file types once the corresponding LSP server is installed via Mason.
- Telescope: Use
<leader>fprefixed keymaps (e.g.,<leader>fffor files,<leader>fgfor grep) to access Telescope pickers.