# Neovim Configuration This is my personal Neovim configuration, originally forked from [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim) and expanded into a Windows-first setup. It uses [lazy.nvim](https://github.com/folke/lazy.nvim) for plugin management and is aimed at Unreal Engine and game-development workflows, especially C++ and Python. It also supports general-purpose development in Lua, TypeScript, CSS, and HTML. ## Managing Plugins ### Adding a plugin Create a new file in `lua/plugins/` that returns a lazy.nvim plugin spec table. Those plugin specs are loaded through `lua/setup/lazy.lua`, so keeping each plugin in its own file is the intended workflow. ### Removing a plugin Delete the plugin file in `lua/plugins/`, empty it, or remove the plugin spec you no longer want. If you want to keep the file around, you can also disable the plugin in place. ### Disabling a plugin temporarily Add `enabled = false` to the plugin spec table. ```lua return { 'plugin/name', enabled = false, -- other options... } ``` ### Machine-specific paths Copy `machine.json.template` to `machine.json` (it is gitignored), then fill in the machine-specific paths for `basedpyright`, `clangd`, and optionally `ue_python`. ## Keybinds Leader key: `` ### Navigation | Key | Mode | Action | | ------------- | ---- | ---------------------------------------- | | `\` | n | Open file tree (Neo-tree) | | `` | n | Move to left split | | `` | n | Move to lower split | | `` | n | Move to upper split | | `` | n | Move to right split | | `` | n | Resize split left | | `` | n | Resize split down | | `` | n | Resize split up | | `` | n | Resize split right | | `` | n | Scroll half-page down (centered) | | `` | n | Scroll half-page up (centered) | | `n` / `N` | n | Next/prev search result (centered) | | `]b` / `[b` | n | Next/prev buffer | | `]d` / `[d` | n | Next/prev diagnostic | | `]c` / `[c` | n | Next/prev git hunk (in git buffers) | | `]q` / `[q` | n | Next/prev quickfix item | | `j` / `k` | n | Move by visual lines when no count given | | `` | i | Move cursor in insert mode | | `J` / `K` | v | Move selected lines down/up | ### Search (Telescope) | Key | Action | | ------------------ | ------------------------------ | | `sf` | Find files | | `sg` | Live grep | | `sw` | Search current word | | `sd` | Search diagnostics | | `sh` | Search help tags | | `sk` | Search keymaps | | `ss` | Select Telescope picker | | `sr` | Resume last search | | `s.` | Recent files | | `` | Find open buffers | | `/` | Fuzzy search in current buffer | | `s/` | Grep in open files | | `sn` | Search Neovim config files | ### LSP | Key | Action | | ------------ | ------------------------------------------------------ | | `grd` | Go to definition (Telescope) | | `grD` | Go to declaration | | `grr` | Go to references (Telescope) | | `gri` | Go to implementation (Telescope) | | `grt` | Go to type definition (Telescope) | | `gd` | Go to definition (native) | | `gO` | Document symbols | | `gW` | Workspace symbols | | `K` | Hover documentation | | `grn` | Rename symbol | | `n` | Rename symbol | | `gra` | Code action (n/x) | | `lh` | Toggle inlay hints (per buffer) | | `ld` | Toggle diagnostic mode (all lines ↔ current line only) | | `li` | Toggle inlay hints (global) | | `q` | Send diagnostics to quickfix list | | `pi` | Organize imports (Python/basedpyright) | ### Git | Key | Action | | ------------ | ------------------------- | | `gs` | Git status (fugitive) | | `gd` | Git diff split | | `gb` | Git blame (fugitive) | | `gl` | Git log | | `gp` | Git push | | `hs` | Stage hunk (n/v) | | `hr` | Reset hunk (n/v) | | `hS` | Stage buffer | | `hu` | Undo stage hunk | | `hR` | Reset buffer | | `hp` | Preview hunk (popup) | | `hP` | Preview hunk inline | | `hb` | Blame line | | `hd` | Diff against index | | `hD` | Diff against last commit | | `tb` | Toggle line blame | | `tD` | Toggle show deleted lines | | `tw` | Toggle word diff | ### Debug (DAP) | Key | Action | | ----------- | -------------------------- | | `` | Start / Continue | | `` | Step into | | `` | Step over | | `` | Step out | | `` | Toggle DAP UI | | `b` | Toggle breakpoint | | `B` | Set conditional breakpoint | ### Build (CMake) | Key | Action | | ------------- | -------------- | | `cmg` | CMake Generate | | `cmb` | CMake Build | | `cmr` | CMake Run | | `cmd` | CMake Debug | | `cms` | CMake Stop | ### AI | Key | Action | | ------------ | --------------------------- | | `cc` | CodeCompanion Chat toggle | | `ca` | CodeCompanion Actions (n/v) | | `cd` | Generate docstring (visual) | ### Toggles & Utilities | Key | Action | | ---------------- | -------------------------------------- | | `` | Toggle terminal (float) | | `tf` | Toggle floating terminal | | `th` | Toggle horizontal terminal | | `` | Clear search highlight | | `` | Clear search highlight | | `jk` | Escape (n/v/i/t) | | `p` | Paste over selection (v, no overwrite) | | `d` | Delete to black hole (n/v) | ### Commands (no keybind, but worth knowing) | Command | Action | | --------------------------------- | ---------------------------------- | | `:LspRestart ` | Restart a named LSP server | | `:LspInfo` | Show comprehensive LSP info | | `:LspStatus` | Show LSP clients on current buffer | | `:LspCapabilities` | Show LSP capabilities | | `:LspDiagnostics` | Show diagnostic counts | | `:Unreal` | Manually initialize Unreal-Nvim | | `:LspPyrightOrganizeImports` | Organize Python imports | | `:LspPyrightSetPythonPath ` | Set Python interpreter path | ## Unreal Engine ### Auto-initialization Unreal-Nvim auto-initializes when opening: - `*.uproject`, `*.uplugin`, `*.Build.cs`, `*.Target.cs` - C/C++ files (`*.cpp`, `*.h`, `*.hpp`, `*.c`) when the cwd contains a `.uproject` - New C/C++ files created inside a UE project cwd If auto-init does not trigger, run `:Unreal` manually. ### C++ Workflow - Open Neovim from the Unreal project root so `clangd` picks up `compile_commands.json` or `compile_flags.txt` - Use `CMakeGenerate` / `CMakeBuild` (`cmg`, `cmb`) or UBT directly - Debugging uses the `codelldb` adapter via DAP (`` to start, `b` for breakpoints) - `clangd` provides completion, hover, and go-to-definition for UE C++ headers - You can set a machine-specific `clangd` binary path in `machine.json` under the `clangd` key ### Python (Editor Scripting) - Open Neovim from the Unreal project root so Python stub detection works correctly - `basedpyright` picks up `Intermediate/PythonStub` automatically when Unreal-Nvim is initialized - Plugin Python paths (`Plugins/*/Content/Python`) are added to `extraPaths` automatically - Set the UE Python interpreter in `machine.json` under the `ue_python` key - Use `pi` to organize imports - Python debugging uses `debugpy` via DAP (``) ## Troubleshooting ### LSP not starting - Run `:LspInfo` to check whether a client is attached - Ensure the language server binary is on `PATH` or configured in `machine.json` - Run `:LspRestart ` to force-restart a specific server ### Plugins not loading - Run `:Lazy` to open the plugin manager UI - Check `:Lazy log` for errors - Run `:Lazy sync` to update all plugins ### machine.json missing - Copy `machine.json.template` to `machine.json` and fill in the required paths - Without it, LSP servers fall back to binaries on `PATH`, which may or may not work on your system ### Python debugging fails on first launch - On first run, Mason installs `debugpy` in the background; Python DAP is wired automatically once installation completes - If it still fails, restart Neovim and try again ### Unreal LSP/Python not working - Ensure Neovim is opened from the Unreal project root (the directory containing the `.uproject`) - Run `:Unreal` to manually trigger Unreal-Nvim initialization - Check that `ue_python` is set in `machine.json` for the correct UE Python interpreter ### Clangd not finding headers - Ensure a `compile_commands.json` or `compile_flags.txt` exists in the project root (generated by CMake or UBT) - Set the `clangd` path in `machine.json` if you use a custom LLVM build