refactor: Complete modular migration from kickstart.nvim

Major architectural overhaul to transform the flat kickstart.nvim structure
  into a maintainable, modular configuration while preserving upstream sync capability.

  ## Structure Changes
  - Migrated from flat `lua/custom/` to organized `lua/core/` and `lua/plugins/`
  - Separated plugin specs from configs: `lua/plugins/spec/` and `lua/plugins/config/`
  - Complex configs (LSP, Debug) now use directory structure with sub-modules:
    - `lsp/init.lua`, `lsp/servers.lua`, `lsp/keymaps.lua`
    - `debug/init.lua`, `debug/adapters.lua`, `debug/keymaps.lua`

  ## Core Improvements
  - Created dedicated core modules: options, keymaps, autocmds, bootstrap, health
  - Added comprehensive health check (`lua/core/health.lua`) for diagnostics
  - Simplified init.lua to just orchestrate module loading
  - Better separation of concerns throughout

  ## Plugin Updates
  - Fixed Blink.cmp configuration (removed invalid fuzzy options)
  - Integrated Copilot with Blink.cmp for unified completion experience
  - Added autopairs and indent-line from kickstart examples
  - Optimized for Nix development environments (removed venv assumptions)

  ## Documentation
  - Updated README with modular structure and kickstart sync instructions
  - Created comprehensive KEYBIND_ANALYSIS.md with all mappings
  - Added modular.txt help documentation
  - Created TODO_TEST.md checklist for testing

  ## Benefits
  - Easier to maintain and extend
  - Clean separation allows upstream kickstart merges without conflicts
  - Scalable architecture for adding new languages/tools
  - Better code organization and discoverability

  All kickstart functionality preserved while gaining modularity and maintainability.
This commit is contained in:
dlond 2025-09-02 13:21:18 +12:00 committed by Daniel Lond
parent 277be1e79b
commit f81cab2da3
55 changed files with 2039 additions and 2299 deletions

10
.envrc
View File

@ -1 +1,11 @@
export PROJECT=$(basename $(pwd))
# Get the git project root
export PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
# Set Lua paths for Neovim to find our modules
export LUA_PATH="$PROJECT_ROOT/lua/?.lua;$PROJECT_ROOT/lua/?/init.lua;;"
export LUA_CPATH="$PROJECT_ROOT/lua/?.so;;"
# Optional: Set NVIM_APPNAME for isolated testing
export NVIM_APPNAME="nvim-$PROJECT"

View File

@ -1,190 +1,217 @@
# Neovim Keybind Analysis & Natural Language Search Plugin Design
# Neovim Keybind Analysis
## Current Keybind Inventory
## Current Active Keybindings (Modular Config)
### Core Navigation & Windows
- `<C-h>` - Move focus to the left window
- `<C-l>` - Move focus to the right window
- `<C-j>` - Move focus to the lower window
- `<C-k>` - Move focus to the upper window
- `<Esc>` - Clear search highlights
- `<Esc><Esc>` - Exit terminal mode
### Leader Key
- **Leader**: `<Space>`
### Search & File Operations (`<leader>s*`)
- `<leader>sf` - Search Files
- `<leader>sh` - Search Help
- `<leader>sk` - Search Keymaps
- `<leader>ss` - Search Select Telescope
- `<leader>sw` - Search current Word
- `<leader>sg` - Search by Grep
- `<leader>sd` - Search Diagnostics
- `<leader>sr` - Search Resume
- `<leader>s.` - Search Recent Files
- `<leader>s/` - Search in Open Files
- `<leader>sn` - Search Neovim files
- `<leader>/` - Fuzzily search in current buffer
- `<leader><leader>` - Find existing buffers
### Core Navigation & Editing
- `<Esc>` - Clear search highlights (in normal mode)
- `<leader>q` - Open diagnostic quickfix list
- `<Esc><Esc>` - Exit terminal mode (in terminal)
### LSP Operations (Dynamic - Buffer Specific)
- `grn` - LSP: Rename
- `gra` - LSP: Code Action
- `grr` - LSP: References
- `gri` - LSP: Implementations
- `grd` - LSP: Definitions
- `grD` - LSP: Declaration
- `gO` - LSP: Open Document Symbols
- `gW` - LSP: Open Workspace Symbols
- `grt` - LSP: Type Definition
- `<leader>lr` - LSP Reload all servers
### Window/Tmux Navigation
- `<C-h>` - Navigate to left window/tmux pane
- `<C-j>` - Navigate to down window/tmux pane
- `<C-k>` - Navigate to up window/tmux pane
- `<C-l>` - Navigate to right window/tmux pane
- `<C-\>` - Navigate to previous tmux pane
### Debug Operations (`<leader>d*`) - From Commented Plugin
- `<leader>dc` - DAP: Continue show UI
- `<leader>db` - DAP: Toggle Breakpoint
- `<leader>dl` - DAP: Run Last
- `<leader>di` - DAP: Step Into
- `<leader>dk` - DAP: Step Over
- `<leader>do` - DAP: Step Out
- `<leader>dx` - DAP: Run to Cursor
- `<leader>dt` - DAP: Terminate
- `<leader>dr` - DAP: Open REPL
- `<leader>du` - DAP: Toggle UI
### Search & Files (`<leader>s*`)
- `<leader>sf` - **[S]earch [F]iles** - Find files in project
- `<leader>sg` - **[S]earch by [G]rep** - Live grep search
- `<leader>sh` - **[S]earch [H]elp** - Search help documentation
- `<leader>sk` - **[S]earch [K]eymaps** - Browse all keymaps
- `<leader>ss` - **[S]earch [S]elect Telescope** - Telescope picker
- `<leader>sw` - **[S]earch current [W]ord** - Search word under cursor
- `<leader>sd` - **[S]earch [D]iagnostics** - Browse diagnostics
- `<leader>sr` - **[S]earch [R]esume** - Resume last search
- `<leader>s.` - **[S]earch Recent Files** - Recently opened files
- `<leader>s/` - **[S]earch in Open Files** - Grep in open buffers
- `<leader>sn` - **[S]earch [N]eovim files** - Browse config files
- `<leader>/` - **Fuzzy search in current buffer**
- `<leader><leader>` - **Find existing buffers**
### Toggle Operations (`<leader>t*`)
- `<leader>tp` - Toggle path completion (from commented plugin)
- `<leader>th` - Toggle Inlay Hints (LSP dynamic)
### LSP Operations
- `gd` - **[G]oto [D]efinition**
- `grr` - **[G]oto [R]eferences**
- `gri` - **[G]oto [I]mplementation**
- `grD` - **[G]oto [D]eclaration**
- `grt` - **[G]oto [T]ype definition**
- `grn` - **[G]oto [R]e[n]ame** - Rename symbol
- `gra` - **[G]oto code [A]ction** (also works in visual mode)
- `gO` - **[G]oto [O]pen document symbols**
- `gW` - **[G]oto [W]orkspace symbols**
- `K` - **Hover Documentation**
- `<leader>f` - **[F]ormat buffer**
- `<leader>lr` - **[L]SP [R]eload** all servers
### Other Operations
- `<leader>q` - Open diagnostic Quickfix list
- `<leader>f` - Format buffer (from main config)
### Diagnostics
- `[d` - Previous diagnostic message
- `]d` - Next diagnostic message
- `<leader>e` - Show diagnostic error messages (float)
- `<leader>q` - Open diagnostic quickfix list
### Git Operations (`<leader>g*`)
#### Fugitive Commands
- `<leader>gs` - **[G]it [S]tatus** - Open Git status
- `<leader>gd` - **[G]it [D]iff** - Show diff
- `<leader>gc` - **[G]it [C]ommit** - Create commit
- `<leader>gb` - **[G]it [B]lame** - Show blame
- `<leader>gl` - **[G]it [L]og** - View log
- `<leader>gp` - **[G]it [P]ush** - Push changes
- `<leader>gf` - **[G]it [F]etch** - Fetch from remote
#### Gitsigns Hunks (`<leader>h*`)
- `]c` - Jump to next git change
- `[c` - Jump to previous git change
- `<leader>hs` - **[H]unk [S]tage** - Stage current hunk
- `<leader>hr` - **[H]unk [R]eset** - Reset current hunk
- `<leader>hS` - **[H]unk [S]tage buffer** - Stage entire buffer
- `<leader>hu` - **[H]unk [U]ndo stage** - Undo stage hunk
- `<leader>hR` - **[H]unk [R]eset buffer** - Reset entire buffer
- `<leader>hp` - **[H]unk [P]review** - Preview hunk changes
- `<leader>hb` - **[H]unk [B]lame line** - Show blame for line
- `<leader>hd` - **[H]unk [D]iff** - Diff against index
- `<leader>hD` - **[H]unk [D]iff** - Diff against last commit
- `<leader>tb` - **[T]oggle [B]lame line** - Toggle inline blame
- `<leader>tD` - **[T]oggle [D]eleted** - Toggle deleted lines
### Debug Operations (DAP)
- `<F5>` - **Start/Continue** debugging
- `<F10>` - **Step Over**
- `<F11>` - **Step Into**
- `<F12>` - **Step Out**
- `<F7>` - **Toggle Debug UI**
- `<leader>db` - **[D]ebug [B]reakpoint** - Toggle breakpoint
- `<leader>dB` - **[D]ebug [B]reakpoint** - Set conditional
- `<leader>lp` - **[L]og [P]oint** - Set log point message
- `<leader>de` - **[D]ebug [E]val** - Evaluate expression
- `<leader>dr` - **[D]ebug [R]EPL** - Open REPL
- `<leader>dl` - **[D]ebug [L]ast** - Run last debug session
- `<leader>dh` - **[D]ebug [H]over** - Hover variables
- `<leader>ds` - **[D]ebug [S]copes** - View scopes
- `<leader>df` - **[D]ebug [F]rames** - View call frames
- `<leader>dt` - **[D]ebug [T]erminate** - Terminate session
- `<leader>dc` - **[D]ebug [C]ontinue** - Continue to cursor
### Completion (Blink.cmp)
- `<C-Space>` - Trigger/Show completion
- `<C-y>` - Accept completion
- `<C-e>` - Cancel/Hide completion
- `<C-n>` - Select next item
- `<C-p>` - Select previous item
- `<C-b>` - Scroll documentation up
- `<C-f>` - Scroll documentation down
- `<Tab>` - Next snippet placeholder
- `<S-Tab>` - Previous snippet placeholder
### GitHub Copilot
**Integration**: Copilot is installed (`zbirenbaum/copilot.lua`) and integrated with Blink.cmp.
- Copilot suggestions appear automatically in the completion menu
- Inline ghost text is disabled (handled by Blink.cmp instead)
- Use standard Blink.cmp keybindings to accept Copilot suggestions
Copilot commands:
- `:Copilot auth` - Authenticate with GitHub
- `:Copilot status` - Check Copilot status
- `:Copilot disable` - Disable Copilot
- `:Copilot enable` - Enable Copilot
### Text Objects (Mini.ai)
Enhanced text objects for better selection:
- `a` - Around (e.g., `daw` = delete around word)
- `i` - Inside (e.g., `ci"` = change inside quotes)
Common targets:
- `w` - Word
- `W` - WORD (includes punctuation)
- `p` - Paragraph
- `s` - Sentence
- `(`, `)`, `[`, `]`, `{`, `}` - Brackets
- `'`, `"`, `` ` `` - Quotes
- `<`, `>` - Angle brackets
- `t` - Tag (HTML/XML)
### Surround Operations (Mini.surround)
Default mappings:
- `sa` - Add surrounding (e.g., `saiw"` = surround word with quotes)
- `sd` - Delete surrounding (e.g., `sd"` = delete surrounding quotes)
- `sr` - Replace surrounding (e.g., `sr"'` = replace " with ')
- `sf` - Find surrounding
- `sF` - Find surrounding (left)
- `sh` - Highlight surrounding
- `sn` - Update MiniSurround.config.n_lines
### Comments (Comment.nvim)
- `gcc` - Toggle comment on current line
- `gc` - Toggle comment (motion/visual mode)
- `gbc` - Toggle block comment on current line
- `gb` - Toggle block comment (motion/visual mode)
Examples:
- `gcap` - Comment a paragraph
- `gc3j` - Comment current line and 3 lines below
- Visual mode: Select lines then `gc` to toggle
### Autopairs (nvim-autopairs)
Automatic bracket/quote pairing:
- When typing `(`, `[`, `{`, `'`, `"`, or `` ` ``, the closing pair is automatically inserted
- Pressing `<CR>` between pairs expands them properly
- Backspace removes both opening and closing pairs
### Indent Line (indent-blankline.nvim)
Visual indent guides are automatically shown - no keybindings needed
### Vim Sleuth
Automatically detects and sets indentation settings - no keybindings needed
### Illuminate (vim-illuminate)
Automatically highlights other occurrences of word under cursor - no keybindings needed
Navigation between occurrences:
- `<Alt-n>` or `]]` - Next occurrence (if configured)
- `<Alt-p>` or `[[` - Previous occurrence (if configured)
### Which-Key Groups
- `<leader>s` - [S]earch group
- `<leader>t` - [T]oggle group
- `<leader>h` - Git [H]unk group
Groups that organize keybindings:
- `<leader>c` - **[C]ode** operations
- `<leader>d` - **[D]ocument/[D]ebug** operations
- `<leader>g` - **[G]it** operations
- `<leader>h` - **Git [H]unk** operations
- `<leader>r` - **[R]ename** operations
- `<leader>s` - **[S]earch** operations
- `<leader>t` - **[T]oggle** operations
- `<leader>w` - **[W]orkspace** operations
## Issues & Opportunities
## Keybinding Architecture
### 1. **Duplicate Keybinds**
Both main `init.lua` and custom telescope plugin define identical telescope keybinds. The custom ones likely override the main ones.
### Organization Pattern
1. **Leader-based commands** - Most actions use `<leader>` (Space)
2. **Mnemonic prefixes** - First letter usually matches action (s=search, g=git, d=debug)
3. **LSP shortcuts** - Use `g` prefix for goto operations
4. **Function keys** - Reserved for debugging (F5, F7, F10-F12)
5. **Control combos** - Navigation and completion
### 2. **Commented Out Functionality**
Many useful keybinds are in commented-out plugin files:
- Debug operations (`<leader>d*`)
- Path completion toggle (`<leader>tp`)
- Additional telescope configurations
### Configuration Locations
- **Core keymaps**: `lua/core/keymaps.lua` (custom LSP reload)
- **Kickstart defaults**: Built into respective plugin configurations
- **LSP keymaps**: `lua/plugins/config/lsp/keymaps.lua`
- **Telescope keymaps**: `lua/plugins/config/telescope.lua`
- **Git keymaps**: `lua/plugins/config/git.lua`
- **Debug keymaps**: `lua/plugins/config/debug/keymaps.lua`
- **Tmux navigation**: `lua/plugins/spec/nvim-tmux-navigator.lua`
- **Blink.cmp keymaps**: `lua/plugins/config/blink.lua`
- **Editor enhancements**: `lua/plugins/config/editor.lua` (Mini.nvim modules)
- **Which-key groups**: `lua/plugins/config/ui.lua`
### 3. **Missing Categories**
No git operations visible (though which-key defines git hunk group), file operations beyond search, etc.
## Tips for Learning Keybindings
### 4. **Inconsistent Description Patterns**
- Some use `[X]` bracket notation
- Some use full words
- LSP uses `LSP:` prefix
- DAP uses `DAP:` prefix
1. **Use Which-key**: Press `<leader>` and wait to see available options
2. **Search keymaps**: Use `<leader>sk` to search all keybindings
3. **Mnemonic patterns**: Most bindings follow logical patterns (s=search, g=git, etc.)
4. **Check `:checkhealth core`**: Verify all features are working
## Natural Language Search Plugin Design
## Customization Guide
### Core Concept
Create a Telescope extension that indexes all keybinds and allows fuzzy natural language search.
### Implementation Approach
#### 1. **Keybind Parser Module** (`lua/custom/plugins/keyfinder/parser.lua`)
```lua
-- Scan all config files for vim.keymap.set calls
-- Extract: key, mode, description, file location
-- Build searchable index with synonyms
```
#### 2. **Natural Language Matcher** (`lua/custom/plugins/keyfinder/matcher.lua`)
```lua
-- Map natural language to keybind concepts:
-- "find file" -> ["search", "file", "find", "open"]
-- "debug breakpoint" -> ["debug", "breakpoint", "dap", "pause"]
-- "restart lsp" -> ["lsp", "restart", "reload", "server"]
```
#### 3. **Telescope Extension** (`lua/custom/plugins/keyfinder/telescope.lua`)
```lua
-- Telescope picker that searches through indexed keybinds
-- Shows: Keybind | Description | Mode | File
-- Supports: fuzzy matching on natural language
```
#### 4. **Usage Examples**
- Type "find files" → Shows `<leader>sf` - Search Files
- Type "debug step" → Shows debug stepping keybinds
- Type "lsp rename" → Shows `grn` - LSP: Rename
- Type "reload" → Shows `<leader>lr` - LSP Reload all servers
### Integration Points
#### With Which-Key
- Read which-key group definitions for context
- Show which-key popup for discovered keybinds
- Integrate with which-key's delay system
#### With Telescope
- Reuse telescope's fuzzy matching
- Follow telescope's UI patterns
- Allow chaining to other telescope commands
#### With Help System
- Link to `:help` entries when available
- Show function signatures for LSP commands
- Display source file locations
### Technical Implementation
#### File Scanning Strategy
1. **Static Analysis**: Parse Lua AST for `vim.keymap.set` calls
2. **Runtime Introspection**: Query `vim.api.nvim_get_keymap()` for active bindings
3. **Plugin Integration**: Hook into lazy.nvim plugin loading to catch dynamic bindings
#### Search Algorithm
1. **Tokenization**: Split natural language into keywords
2. **Synonym Expansion**: "find" → ["search", "find", "locate", "open"]
3. **Weighted Scoring**: Boost exact matches, penalize partial matches
4. **Context Awareness**: Consider mode, plugin context, frequency of use
#### Performance Considerations
- **Lazy Loading**: Only scan when plugin is first used
- **Caching**: Store parsed results, invalidate on config changes
- **Incremental Updates**: Watch for file changes, update index incrementally
### User Experience
#### Primary Interface
- `<leader>?` or `<leader>sk` (extend existing keymap search)
- Telescope popup with natural language prompt
- Live preview of matching keybinds
#### Secondary Features
- **Keybind Execution**: Press Enter to execute the found keybind
- **Help Integration**: `<C-h>` to show help for selected keybind
- **Source Navigation**: `<C-s>` to jump to keybind definition
- **Usage Statistics**: Track most-used searches, suggest improvements
## Next Steps
1. **Prototype Parser**: Build basic keybind extraction from config files
2. **Simple Matcher**: Implement keyword-based search
3. **Telescope Integration**: Create basic picker interface
4. **Test & Iterate**: Use with real workflows, refine search algorithm
5. **Advanced Features**: Add synonym expansion, usage tracking, help integration
## Natural Language → Keybind Examples
| Natural Language | Expected Keybind | Current Status |
|------------------|------------------|----------------|
| "find files" | `<leader>sf` | ✅ Active |
| "search in file" | `<leader>/` | ✅ Active |
| "debug breakpoint" | `<leader>db` | ⚠️ Commented out |
| "lsp rename" | `grn` | ✅ Active (LSP buffer only) |
| "reload lsp" | `<leader>lr` | ✅ Active |
| "git blame" | ? | ❌ Not found |
| "format code" | `<leader>f` | ✅ Active |
| "open terminal" | ? | ❌ Not found |
| "toggle diagnostics" | ? | ❌ Not found |
This analysis reveals both the potential and the gaps in your current keybind setup. The natural language search plugin would be most valuable for discovering the numerous LSP keybinds and managing the complexity of your growing configuration.
To add new keybindings:
1. For general keymaps: Edit `lua/core/keymaps.lua`
2. For plugin-specific: Add to the relevant config file in `lua/plugins/config/`
3. Update Which-key groups in `lua/plugins/config/ui.lua` if adding new categories

503
README.md
View File

@ -1,241 +1,358 @@
# kickstart.nvim
# 🚀 Modular Neovim Configuration
## Introduction
A clean, fast, and fully-featured Neovim configuration with perfect separation of concerns. Built on modern plugins with LSP, TreeSitter, and Copilot integration. Originally forked from [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim) and transformed into a maintainable modular structure.
A starting point for Neovim that is:
## ✨ Features
* Small
* Single-file
* Completely Documented
### 🎯 Core Features
- **Modular Architecture** - Clean separation between core settings, plugin specs, and configurations
- **LSP Support** - Full language server integration for C/C++, Python, Nix, LaTeX, and more
- **Intelligent Completion** - [Blink.cmp](https://github.com/saghen/blink.cmp) with Copilot integration
- **Fuzzy Finding** - Telescope with FZF for lightning-fast file and text search
- **Git Integration** - Fugitive + Gitsigns for complete git workflow
- **Syntax Highlighting** - TreeSitter-based highlighting with automatic parser installation
- **Debugging** - Full DAP (Debug Adapter Protocol) support
**NOT** a Neovim distribution, but instead a starting point for your configuration.
### 🔧 Language Support
- **C/C++** - clangd with automatic compile_commands.json detection
- **Python** - Pyright + Ruff for type checking and linting
- **Nix** - Full nixd integration
- **LaTeX** - TeXLab for document preparation
- **CMake** - CMake language server
- **Lua** - Optimized for Neovim config development
## Installation
### Install Neovim
Kickstart.nvim targets *only* the latest
['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest
['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim.
If you are experiencing issues, please make sure you have the latest versions.
### Install External Dependencies
External Requirements:
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation),
[fd-find](https://github.com/sharkdp/fd#installation)
- Clipboard tool (xclip/xsel/win32yank or other depending on the platform)
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
- Emoji fonts (Ubuntu only, and only if you want emoji!) `sudo apt install fonts-noto-color-emoji`
- Language Setup:
- If you want to write Typescript, you need `npm`
- If you want to write Golang, you will need `go`
- etc.
> [!NOTE]
> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes
> and quick install snippets
### Install Kickstart
> [!NOTE]
> [Backup](#FAQ) your previous configuration (if any exists)
Neovim's configurations are located under the following paths, depending on your OS:
| OS | PATH |
| :- | :--- |
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
| Windows (cmd)| `%localappdata%\nvim\` |
| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` |
#### Recommended Step
[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo
so that you have your own copy that you can modify, then install by cloning the
fork to your machine using one of the commands below, depending on your OS.
> [!NOTE]
> Your fork's URL will be something like this:
> `https://github.com/<your_github_username>/kickstart.nvim.git`
You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file
too - it's ignored in the kickstart repo to make maintenance easier, but it's
[recommended to track it in version control](https://lazy.folke.io/usage/lockfile).
#### Clone kickstart.nvim
> [!NOTE]
> If following the recommended step above (i.e., forking the repo), replace
> `nvim-lua` with `<your_github_username>` in the commands below
<details><summary> Linux and Mac </summary>
```sh
git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
```
</details>
<details><summary> Windows </summary>
If you're using `cmd.exe`:
## 📁 Project Structure
```
git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim"
nvim/
├── init.lua # Minimal bootstrapper
├── lua/
│ ├── core/ # Core Neovim settings
│ │ ├── bootstrap.lua # Lazy.nvim installation
│ │ ├── options.lua # Editor options
│ │ ├── keymaps.lua # Core keybindings
│ │ ├── autocmds.lua # Auto commands
│ │ └── health.lua # Health checks
│ └── plugins/
│ ├── spec/ # Plugin declarations
│ │ ├── lsp.lua # Language servers
│ │ ├── blink.lua # Completion
│ │ ├── telescope.lua # Fuzzy finder
│ │ ├── treesitter.lua # Syntax highlighting
│ │ ├── git.lua # Git integration
│ │ └── ... # Other plugins
│ └── config/ # Plugin configurations
│ ├── lsp/ # LSP setup
│ ├── blink.lua # Completion config
│ ├── telescope.lua # Telescope config
│ └── ... # Other configs
```
If you're using `powershell.exe`
## 🚀 Installation
```
git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim"
### Prerequisites
#### System Requirements
- **Neovim** >= 0.10
- **Git** - Version control
- **Make** - Build tool
- **C Compiler** - For native extensions
- **ripgrep** - Fast text search
- **fd** - Fast file finder
#### Language Servers (Install via Nix/Homebrew/Package Manager)
```bash
# Example with Nix
nix-env -iA nixpkgs.clang-tools # clangd
nix-env -iA nixpkgs.pyright # Python LSP
nix-env -iA nixpkgs.ruff # Python linter
nix-env -iA nixpkgs.nixd # Nix LSP
nix-env -iA nixpkgs.texlab # LaTeX LSP
```
</details>
### Install Configuration
### Post Installation
#### Backup Existing Config
```bash
mv ~/.config/nvim ~/.config/nvim.backup
```
Start Neovim
#### Clone This Repository
```bash
git clone https://github.com/yourusername/nvim.git ~/.config/nvim
```
```sh
#### Launch Neovim
```bash
nvim
```
That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
the current plugin status. Hit `q` to close the window.
The first launch will automatically:
1. Install lazy.nvim plugin manager
2. Download and install all plugins
3. Set up TreeSitter parsers
#### Read The Friendly Documentation
### Health Check
Read through the `init.lua` file in your configuration folder for more
information about extending and exploring Neovim. That also includes
examples of adding popularly requested plugins.
After installation, run `:checkhealth core` to verify:
- Neovim version
- Required executables
- LSP servers
- Formatters
> [!NOTE]
> For more information about a particular plugin check its repository's documentation.
## 🔄 Syncing with Kickstart.nvim
This configuration maintains compatibility with upstream kickstart.nvim while keeping all customizations in a modular structure. Here's how to sync with kickstart updates:
### Getting Started
### Initial Setup (One Time)
```bash
# Add kickstart as a remote
git remote add kickstart https://github.com/nvim-lua/kickstart.nvim
git fetch kickstart
```
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
### Checking for Updates
```bash
# See what changed in kickstart
git fetch kickstart
git log kickstart/master --oneline
### FAQ
# Review specific changes
git diff HEAD kickstart/master -- init.lua
```
* What should I do if I already have a pre-existing Neovim configuration?
* You should back it up and then delete all associated files.
* This includes your existing init.lua and the Neovim files in `~/.local`
which can be deleted with `rm -rf ~/.local/share/nvim/`
* Can I keep my existing configuration in parallel to kickstart?
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME`
to maintain multiple configurations. For example, you can install the kickstart
configuration in `~/.config/nvim-kickstart` and create an alias:
```
alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim'
```
When you run Neovim using `nvim-kickstart` alias it will use the alternative
config directory and the matching local directory
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
distribution that you would like to try out.
* What if I want to "uninstall" this configuration:
* See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information
* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
* The main purpose of kickstart is to serve as a teaching tool and a reference
configuration that someone can easily use to `git clone` as a basis for their own.
As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
into smaller parts. A fork of kickstart that does this while maintaining the
same functionality is available here:
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
* Discussions on this topic can be found here:
* [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218)
* [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473)
### Cherry-Picking Updates
```bash
# Option 1: Cherry-pick specific commits
git cherry-pick <commit-hash>
### Install Recipes
# Option 2: Manually review and integrate changes
git diff kickstart/master -- init.lua | less
Below you can find OS specific install instructions for Neovim and dependencies.
# Option 3: Check for specific feature updates (e.g., telescope)
git diff kickstart/master -- init.lua | grep -A5 -B5 telescope
```
After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step.
### Update Workflow
1. **Review Changes**: Check kickstart's commit history for interesting updates
2. **Test Locally**: Apply changes in a test branch first
3. **Adapt to Modular Structure**: Move any new plugins/configs to appropriate `lua/plugins/` files
4. **Document**: Update relevant documentation for new features
#### Windows Installation
### Example: Adding a New Plugin from Kickstart
If kickstart adds a new plugin in their `init.lua`:
1. Create a new spec file: `lua/plugins/spec/newplugin.lua`
2. Add configuration to: `lua/plugins/config/newplugin.lua` (if needed)
3. Update: `lua/plugins/spec/init.lua` to import the new spec
<details><summary>Windows with Microsoft C++ Build Tools and CMake</summary>
Installation may require installing build tools and updating the run command for `telescope-fzf-native`
## ⌨️ Key Mappings
See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
### Leader Key
The leader key is set to `<Space>`.
This requires:
### Essential Keybindings
- Install CMake and the Microsoft C++ Build Tools on Windows
#### File Navigation
| Key | Description |
|-----|-------------|
| `<leader>sf` | **S**earch **F**iles |
| `<leader>sg` | **S**earch by **G**rep |
| `<leader>sh` | **S**earch **H**elp |
| `<leader><leader>` | Switch buffers |
| `<leader>/` | Fuzzy search in current buffer |
#### LSP Features
| Key | Description |
|-----|-------------|
| `gd` | **G**oto **D**efinition |
| `gr` | **G**oto **R**eferences |
| `gI` | **G**oto **I**mplementation |
| `<leader>rn` | **R**e**n**ame symbol |
| `<leader>ca` | **C**ode **A**ction |
| `K` | Hover documentation |
| `<space>f` | **F**ormat buffer |
#### Git Operations
| Key | Description |
|-----|-------------|
| `<leader>gs` | Git status (Fugitive) |
| `<leader>gd` | Git diff |
| `<leader>gc` | Git commit |
| `<leader>gb` | Git blame |
| `]c` | Next git change |
| `[c` | Previous git change |
| `<leader>hs` | Stage hunk |
| `<leader>hr` | Reset hunk |
#### Debugging
| Key | Description |
|-----|-------------|
| `<F5>` | Start/Continue debugging |
| `<F10>` | Step over |
| `<F11>` | Step into |
| `<F12>` | Step out |
| `<leader>db` | Toggle breakpoint |
| `<F7>` | Toggle debug UI |
#### Window Navigation (Tmux-aware)
| Key | Description |
|-----|-------------|
| `<C-h>` | Navigate left |
| `<C-j>` | Navigate down |
| `<C-k>` | Navigate up |
| `<C-l>` | Navigate right |
### Completion Keybindings
| Key | Description |
|-----|-------------|
| `<C-Space>` | Trigger completion |
| `<C-y>` | Accept completion |
| `<C-e>` | Cancel completion |
| `<Tab>` | Next snippet placeholder |
| `<S-Tab>` | Previous snippet placeholder |
## 🔌 Installed Plugins
### Core
- [lazy.nvim](https://github.com/folke/lazy.nvim) - Plugin manager
- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) - Lua utilities
### Editor Enhancement
- [mini.nvim](https://github.com/echasnovski/mini.nvim) - Collection of minimal plugins
- [Comment.nvim](https://github.com/numToStr/Comment.nvim) - Smart commenting
- [vim-sleuth](https://github.com/tpope/vim-sleuth) - Auto-detect indentation
- [nvim-autopairs](https://github.com/windwp/nvim-autopairs) - Auto-close brackets
- [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) - Indent guides
- [vim-illuminate](https://github.com/RRethy/vim-illuminate) - Highlight word under cursor
### UI/Theme
- [tokyonight.nvim](https://github.com/folke/tokyonight.nvim) - Color scheme
- [which-key.nvim](https://github.com/folke/which-key.nvim) - Keybinding hints
- [todo-comments.nvim](https://github.com/folke/todo-comments.nvim) - Highlight TODO comments
### Navigation
- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) - Fuzzy finder
- [telescope-fzf-native.nvim](https://github.com/nvim-telescope/telescope-fzf-native.nvim) - FZF sorter
- [vim-tmux-navigator](https://github.com/christoomey/vim-tmux-navigator) - Seamless tmux navigation
### Git
- [vim-fugitive](https://github.com/tpope/vim-fugitive) - Git commands
- [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim) - Git gutter signs
### LSP & Completion
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) - LSP configurations
- [blink.cmp](https://github.com/saghen/blink.cmp) - Completion engine
- [lazydev.nvim](https://github.com/folke/lazydev.nvim) - Lua development
- [fidget.nvim](https://github.com/j-hui/fidget.nvim) - LSP progress
### Development
- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) - Syntax highlighting
- [nvim-treesitter-textobjects](https://github.com/nvim-treesitter/nvim-treesitter-textobjects) - Syntax-aware text objects
- [copilot.lua](https://github.com/zbirenbaum/copilot.lua) - GitHub Copilot
- [conform.nvim](https://github.com/stevearc/conform.nvim) - Formatting
- [nvim-dap](https://github.com/mfussenegger/nvim-dap) - Debug Adapter Protocol
- [nvim-dap-ui](https://github.com/rcarriga/nvim-dap-ui) - Debug UI
## 🛠️ Configuration
### Customization
All configuration files are designed to be easily customizable:
1. **Core Settings**: Edit files in `lua/core/`
- `options.lua` - Vim options
- `keymaps.lua` - Core keybindings
2. **Add Plugins**: Create new spec files in `lua/plugins/spec/`
```lua
-- lua/plugins/spec/myplugin.lua
return {
'username/plugin-name',
opts = {
-- plugin options
}
}
```
3. **Complex Plugin Config**: Add config files to `lua/plugins/config/`
### LSP Server Configuration
LSP servers are configured in `lua/plugins/config/lsp/init.lua`. Add new servers to the `servers` table:
```lua
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
```
</details>
<details><summary>Windows with gcc/make using chocolatey</summary>
Alternatively, one can install gcc and make which don't require changing the config,
the easiest way is to use choco:
1. install [chocolatey](https://chocolatey.org/install)
either follow the instructions on the page or use winget,
run in cmd as **admin**:
```
winget install --accept-source-agreements chocolatey.chocolatey
servers = {
myserver = {
settings = {
-- server-specific settings
}
}
}
```
2. install all requirements using choco, exit the previous cmd and
open a new one so that choco path is set, and run in cmd as **admin**:
```
choco install -y neovim git ripgrep wget fd unzip gzip mingw make
```
</details>
<details><summary>WSL (Windows Subsystem for Linux)</summary>
### Formatter Configuration
```
wsl --install
wsl
sudo add-apt-repository ppa:neovim-ppa/unstable -y
sudo apt update
sudo apt install make gcc ripgrep unzip git xclip neovim
```
</details>
#### Linux Install
<details><summary>Ubuntu Install Steps</summary>
Formatters are configured in `lua/plugins/spec/formatting.lua`:
```lua
formatters_by_ft = {
javascript = { "prettier" },
-- add your formatters here
}
```
sudo add-apt-repository ppa:neovim-ppa/unstable -y
sudo apt update
sudo apt install make gcc ripgrep unzip git xclip neovim
```
</details>
<details><summary>Debian Install Steps</summary>
```
sudo apt update
sudo apt install make gcc ripgrep unzip git xclip curl
## 🔧 Commands
# Now we install nvim
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz
sudo rm -rf /opt/nvim-linux-x86_64
sudo mkdir -p /opt/nvim-linux-x86_64
sudo chmod a+rX /opt/nvim-linux-x86_64
sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz
### Custom Commands
- `:ReloadLSP` - Restart all LSP servers
# make it available in /usr/local/bin, distro installs to /usr/bin
sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/
```
</details>
<details><summary>Fedora Install Steps</summary>
### Health Check
- `:checkhealth core` - Run configuration health check
```
sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
```
</details>
### Plugin Management
- `:Lazy` - Open plugin manager UI
- `:Lazy sync` - Update all plugins
- `:Lazy profile` - Profile startup time
<details><summary>Arch Install Steps</summary>
## 🐛 Troubleshooting
```
sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
```
</details>
### First Steps
1. Run `:checkhealth core` to verify installation
2. Check `:messages` for error messages
3. Ensure all prerequisites are installed
### Common Issues
**Plugins not loading**
- Run `:Lazy sync` to ensure all plugins are installed
- Check for errors in `:messages`
**LSP not working**
- Verify language servers are installed (check with `:checkhealth core`)
- Run `:LspInfo` to see active servers
- Try `:ReloadLSP` to restart servers
**Telescope not finding files**
- Ensure `ripgrep` and `fd` are installed
- Check you're not in a git-ignored directory
## 📝 License
This configuration is based on [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim) and is available under the MIT License.
## 🙏 Acknowledgments
- [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim) - Initial configuration structure
- [Neovim](https://neovim.io/) - The best text editor
- All plugin authors for their amazing work
## 🤝 Contributing
Contributions are welcome! Feel free to:
- Report issues
- Suggest new features
- Submit pull requests
---
**Happy Coding!** 🎉

View File

@ -1,24 +0,0 @@
================================================================================
INTRODUCTION *kickstart.nvim*
Kickstart.nvim is a project to help you get started on your neovim journey.
*kickstart-is-not*
It is not:
- Complete framework for every plugin under the sun
- Place to add every plugin that could ever be useful
*kickstart-is*
It is:
- Somewhere that has a good start for the most common "IDE" type features:
- autocompletion
- goto-definition
- find references
- fuzzy finding
- and hinting at what more can be done :)
- A place to _kickstart_ your journey.
- You should fork this project and use/modify it so that it matches your
style and preferences. If you don't want to do that, there are probably
other projects that would fit much better for you (and that's great!)!
vim:tw=78:ts=8:ft=help:norl:

222
doc/modular.txt Normal file
View File

@ -0,0 +1,222 @@
*modular.txt* Modular Neovim Configuration
==============================================================================
CONTENTS *modular-contents*
1. Introduction ................................ |modular-intro|
2. Quick Start ................................. |modular-quickstart|
3. Architecture ................................ |modular-architecture|
4. Keybindings ................................. |modular-keybindings|
5. Commands .................................... |modular-commands|
6. Customization ............................... |modular-customization|
7. Troubleshooting ............................. |modular-troubleshooting|
==============================================================================
1. INTRODUCTION *modular-intro*
This is a modular Neovim configuration built for performance and
maintainability. Originally based on kickstart.nvim but restructured with
clean separation of concerns.
Key features:
• Modular plugin architecture
• Full LSP support (C/C++, Python, Nix, LaTeX)
• Intelligent completion with Blink.cmp
• Git integration (Fugitive + Gitsigns)
• Debug support (DAP)
• Tmux integration
==============================================================================
2. QUICK START *modular-quickstart*
Prerequisites: >
- Neovim >= 0.10
- Git, Make, C compiler
- ripgrep, fd
- Language servers (via Nix/package manager)
Installation: >bash
# Backup existing config
mv ~/.config/nvim ~/.config/nvim.backup
# Clone this config
git clone <repo> ~/.config/nvim
# Start Neovim
nvim
Health check: >vim
:checkhealth core
==============================================================================
3. ARCHITECTURE *modular-architecture*
Directory Structure: >
nvim/
├── init.lua # Bootstrap
├── lua/
│ ├── core/ # Core settings
│ │ ├── bootstrap.lua # Lazy.nvim
│ │ ├── options.lua # Vim options
│ │ ├── keymaps.lua # Core keymaps
│ │ └── health.lua # Health checks
│ └── plugins/
│ ├── spec/ # Plugin specs
│ └── config/ # Plugin configs
Loading Order:
1. Bootstrap lazy.nvim
2. Load core options and keymaps
3. Load plugins via lazy.nvim
4. Plugin configurations execute
==============================================================================
4. KEYBINDINGS *modular-keybindings*
Leader key: <Space>
------------------------------------------------------------------------------
NAVIGATION *modular-keys-navigation*
<C-h> Navigate left (window/tmux)
<C-j> Navigate down
<C-k> Navigate up
<C-l> Navigate right
<Esc> Clear search highlights
------------------------------------------------------------------------------
SEARCH *modular-keys-search*
<leader>sf Search [F]iles
<leader>sg Search by [G]rep
<leader>sh Search [H]elp
<leader>sk Search [K]eymaps
<leader>sw Search current [W]ord
<leader>sd Search [D]iagnostics
<leader>/ Fuzzy search in buffer
<leader><leader> Find buffers
------------------------------------------------------------------------------
LSP *modular-keys-lsp*
gd Goto Definition
gr Goto References
gI Goto Implementation
K Hover documentation
<leader>rn Rename symbol
<leader>ca Code action
<space>f Format buffer
<leader>lr Reload LSP servers
------------------------------------------------------------------------------
GIT *modular-keys-git*
<leader>gs Git status
<leader>gd Git diff
<leader>gc Git commit
<leader>gb Git blame
]c Next git change
[c Previous git change
<leader>hs Stage hunk
<leader>hr Reset hunk
------------------------------------------------------------------------------
DEBUG *modular-keys-debug*
<F5> Start/Continue
<F10> Step over
<F11> Step into
<F12> Step out
<F7> Toggle UI
<leader>db Toggle breakpoint
------------------------------------------------------------------------------
COMPLETION *modular-keys-completion*
<C-Space> Trigger completion
<C-y> Accept
<C-e> Cancel
<Tab> Next snippet placeholder
==============================================================================
5. COMMANDS *modular-commands*
Custom Commands:
:ReloadLSP Restart all LSP servers
:checkhealth core Run configuration health check
Plugin Commands:
:Lazy Plugin manager UI
:Lazy sync Update plugins
:Git Fugitive git status
:Telescope Open telescope
==============================================================================
6. CUSTOMIZATION *modular-customization*
------------------------------------------------------------------------------
ADDING PLUGINS *modular-adding-plugins*
Create a new spec file: >lua
-- lua/plugins/spec/myplugin.lua
return {
'author/plugin-name',
event = 'VeryLazy',
opts = {
-- options here
}
}
Then import it: >lua
-- lua/plugins/spec/init.lua
return {
{ import = 'plugins.spec.myplugin' },
-- other imports...
}
------------------------------------------------------------------------------
CONFIGURING LSP *modular-config-lsp*
Edit `lua/plugins/config/lsp/init.lua`: >lua
local servers = {
myserver = {
settings = {
-- server settings
}
}
}
------------------------------------------------------------------------------
CUSTOM KEYMAPS *modular-custom-keymaps*
Add to `lua/core/keymaps.lua`: >lua
vim.keymap.set('n', '<leader>xx', function()
-- your function
end, { desc = 'My custom action' })
==============================================================================
7. TROUBLESHOOTING *modular-troubleshooting*
Common Issues:
LSP not working: >vim
:checkhealth core " Check if servers installed
:LspInfo " Check active servers
:ReloadLSP " Restart servers
Plugins not loading: >vim
:Lazy sync " Update plugins
:messages " Check for errors
Telescope issues:
• Ensure ripgrep and fd are installed
• Check you're not in git-ignored directory
For more help:
• Run `:checkhealth core`
• Check `:messages` for errors
• See README.md for detailed documentation
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View File

@ -1,3 +1,18 @@
kickstart-is kickstart.txt /*kickstart-is*
kickstart-is-not kickstart.txt /*kickstart-is-not*
kickstart.nvim kickstart.txt /*kickstart.nvim*
modular-adding-plugins modular.txt /*modular-adding-plugins*
modular-architecture modular.txt /*modular-architecture*
modular-commands modular.txt /*modular-commands*
modular-config-lsp modular.txt /*modular-config-lsp*
modular-contents modular.txt /*modular-contents*
modular-custom-keymaps modular.txt /*modular-custom-keymaps*
modular-customization modular.txt /*modular-customization*
modular-intro modular.txt /*modular-intro*
modular-keybindings modular.txt /*modular-keybindings*
modular-keys-completion modular.txt /*modular-keys-completion*
modular-keys-debug modular.txt /*modular-keys-debug*
modular-keys-git modular.txt /*modular-keys-git*
modular-keys-lsp modular.txt /*modular-keys-lsp*
modular-keys-navigation modular.txt /*modular-keys-navigation*
modular-keys-search modular.txt /*modular-keys-search*
modular-quickstart modular.txt /*modular-quickstart*
modular-troubleshooting modular.txt /*modular-troubleshooting*
modular.txt modular.txt /*modular.txt*

958
init.lua
View File

@ -1,947 +1,23 @@
--[[
-- Bootstrap lazy.nvim
require 'core.bootstrap'
=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================
======== .-----. ========
======== .----------------------. | === | ========
======== |.-""""""""""""""""""-.| |-----| ========
======== || || | === | ========
======== || KICKSTART.NVIM || |-----| ========
======== || || | === | ========
======== || || |-----| ========
======== ||:Tutor || |:::::| ========
======== |'-..................-'| |____o| ========
======== `"")----------------(""` ___________ ========
======== /::::::::::| |::::::::::\ \ no mouse \ ========
======== /:::========| |==hjkl==:::\ \ required \ ========
======== '""""""""""""' '""""""""""""' '""""""""""' ========
======== ========
=====================================================================
=====================================================================
-- Core settings (must be before plugins)
require 'core.options'
require 'core.keymaps'
require 'core.autocmds'
What is Kickstart?
Kickstart.nvim is *not* a distribution.
Kickstart.nvim is a starting point for your own configuration.
The goal is that you can read every line of code, top-to-bottom, understand
what your configuration is doing, and modify it to suit your needs.
Once you've done that, you can start exploring, configuring and tinkering to
make Neovim your own! That might mean leaving Kickstart just the way it is for a while
or immediately breaking it into modular pieces. It's up to you!
If you don't know anything about Lua, I recommend taking some time to read through
a guide. One possible example which will only take 10-15 minutes:
- https://learnxinyminutes.com/docs/lua/
After understanding a bit more about Lua, you can use `:help lua-guide` as a
reference for how Neovim integrates Lua.
- :help lua-guide
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
Kickstart Guide:
TODO: The very first thing you should do is to run the command `:Tutor` in Neovim.
If you don't know what this means, type the following:
- <escape key>
- :
- Tutor
- <enter key>
(If you already know the Neovim basics, you can skip this step.)
Once you've completed that, you can continue working through **AND READING** the rest
of the kickstart init.lua.
Next, run AND READ `:help`.
This will open up a help window with some basic information
about reading, navigating and searching the builtin help documentation.
This should be the first place you go to look when you're stuck or confused
with something. It's one of my favorite Neovim features.
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
which is very useful when you're not exactly sure of what you're looking for.
I have left several `:help X` comments throughout the init.lua
These are hints about where to find more information about the relevant settings,
plugins or Neovim features used in Kickstart.
NOTE: Look for lines like this
Throughout the file. These are for you, the reader, to help you understand what is happening.
Feel free to delete them once you know what you're doing, but they should serve as a guide
for when you are first encountering a few different constructs in your Neovim config.
If you experience any errors while trying to install kickstart, run `:checkhealth` for more info.
I hope you enjoy your Neovim journey,
- TJ
P.S. You can delete this when you're done too. It's your config now! :)
--]]
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = true
-- [[ Setting options ]]
-- See `:help vim.o`
-- NOTE: You can change these options as you wish!
-- For more options, you can see `:help option-list`
-- Make line numbers default
vim.o.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
-- vim.o.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
vim.o.mouse = 'a'
-- Don't show the mode, since it's already in the status line
vim.o.showmode = false
-- Sync clipboard between OS and Neovim.
-- Schedule the setting after `UiEnter` because it can increase startup-time.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.schedule(function()
vim.o.clipboard = 'unnamedplus'
end)
-- Enable break indent
vim.o.breakindent = true
-- Save undo history
vim.o.undofile = true
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
vim.o.ignorecase = true
vim.o.smartcase = true
-- Keep signcolumn on by default
vim.o.signcolumn = 'yes'
-- Decrease update time
vim.o.updatetime = 250
-- Decrease mapped sequence wait time
vim.o.timeoutlen = 300
-- Configure how new splits should be opened
vim.o.splitright = true
vim.o.splitbelow = true
-- Sets how neovim will display certain whitespace characters in the editor.
-- See `:help 'list'`
-- and `:help 'listchars'`
--
-- Notice listchars is set using `vim.opt` instead of `vim.o`.
-- It is very similar to `vim.o` but offers an interface for conveniently interacting with tables.
-- See `:help lua-options`
-- and `:help lua-options-guide`
vim.o.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '' }
-- Preview substitutions live, as you type!
vim.o.inccommand = 'split'
-- Show which line your cursor is on
vim.o.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.o.scrolloff = 10
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
-- instead raise a dialog asking if you wish to save the current file(s)
-- See `:help 'confirm'`
vim.o.confirm = true
require 'custom.options'
-- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`
-- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch`
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Diagnostic keymaps
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
-- is not what someone will guess without a bit more experience.
--
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
-- or just use <C-\><C-n> to exit terminal mode
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
--
-- See `:help wincmd` for a list of all window commands
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
require 'custom.keymaps'
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.hl.on_yank()`
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.hl.on_yank()
end,
})
-- [[ Install `lazy.nvim` plugin manager ]]
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
if vim.v.shell_error ~= 0 then
error('Error cloning lazy.nvim:\n' .. out)
end
end
---@type vim.Option
local rtp = vim.opt.rtp
rtp:prepend(lazypath)
-- [[ Configure and install plugins ]]
--
-- To check the current status of your plugins, run
-- :Lazy
--
-- You can press `?` in this menu for help. Use `:q` to close the window
--
-- To update plugins you can run
-- :Lazy update
--
-- NOTE: Here is where you install your plugins.
require('lazy').setup({
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically
-- NOTE: Plugins can also be added by using a table,
-- with the first argument being the link and the following
-- keys can be used to configure plugin behavior/loading/etc.
--
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
--
-- Alternatively, use `config = function() ... end` for full control over the configuration.
-- If you prefer to call `setup` explicitly, use:
-- {
-- 'lewis6991/gitsigns.nvim',
-- config = function()
-- require('gitsigns').setup({
-- -- Your gitsigns configuration here
-- })
-- end,
-- }
--
-- Here is a more advanced example where we pass configuration
-- options to `gitsigns.nvim`.
--
-- See `:help gitsigns` to understand what the configuration keys do
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
-- Load plugins via lazy.nvim
require('lazy').setup('plugins.spec', {
change_detection = { enabled = true, notify = false },
performance = {
rtp = {
disabled_plugins = {
'gzip',
'tarPlugin',
'tohtml',
'tutor',
'zipPlugin',
},
},
},
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
--
-- This is often very useful to both group configuration, as well as handle
-- lazy loading plugins that don't need to be loaded immediately at startup.
--
-- For example, in the following configuration, we use:
-- event = 'VimEnter'
--
-- which loads which-key before all the UI elements are loaded. Events can be
-- normal autocommands events (`:help autocmd-events`).
--
-- Then, because we use the `opts` key (recommended), the configuration runs
-- after the plugin has been loaded as `require(MODULE).setup(opts)`.
{ -- Useful plugin to show you pending keybinds.
'folke/which-key.nvim',
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
opts = {
-- delay between pressing a key and opening which-key (milliseconds)
-- this setting is independent of vim.o.timeoutlen
delay = 0,
icons = {
-- set icon mappings to true if you have a Nerd Font
mappings = vim.g.have_nerd_font,
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
keys = vim.g.have_nerd_font and {} or {
Up = '<Up> ',
Down = '<Down> ',
Left = '<Left> ',
Right = '<Right> ',
C = '<C-…> ',
M = '<M-…> ',
D = '<D-…> ',
S = '<S-…> ',
CR = '<CR> ',
Esc = '<Esc> ',
ScrollWheelDown = '<ScrollWheelDown> ',
ScrollWheelUp = '<ScrollWheelUp> ',
NL = '<NL> ',
BS = '<BS> ',
Space = '<Space> ',
Tab = '<Tab> ',
F1 = '<F1>',
F2 = '<F2>',
F3 = '<F3>',
F4 = '<F4>',
F5 = '<F5>',
F6 = '<F6>',
F7 = '<F7>',
F8 = '<F8>',
F9 = '<F9>',
F10 = '<F10>',
F11 = '<F11>',
F12 = '<F12>',
},
},
-- Document existing key chains
spec = {
{ '<leader>s', group = '[S]earch' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
},
},
},
-- NOTE: Plugins can specify dependencies.
--
-- The dependencies are proper plugin specifications as well - anything
-- you do for a plugin at the top level, you can do for a dependency.
--
-- Use the `dependencies` key to specify the dependencies of a particular plugin
{ -- Fuzzy Finder (files, lsp, etc)
'nvim-telescope/telescope.nvim',
event = 'VimEnter',
dependencies = {
'nvim-lua/plenary.nvim',
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
'nvim-telescope/telescope-fzf-native.nvim',
-- `build` is used to run some command when the plugin is installed/updated.
-- This is only run then, not every time Neovim starts up.
build = 'make',
-- `cond` is a condition used to determine whether this plugin should be
-- installed and loaded.
cond = function()
return vim.fn.executable 'make' == 1
end,
},
{ 'nvim-telescope/telescope-ui-select.nvim' },
-- Useful for getting pretty icons, but requires a Nerd Font.
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
},
config = function()
-- Telescope is a fuzzy finder that comes with a lot of different things that
-- it can fuzzy find! It's more than just a "file finder", it can search
-- many different aspects of Neovim, your workspace, LSP, and more!
--
-- The easiest way to use Telescope, is to start by doing something like:
-- :Telescope help_tags
--
-- After running this command, a window will open up and you're able to
-- type in the prompt window. You'll see a list of `help_tags` options and
-- a corresponding preview of the help.
--
-- Two important keymaps to use while in Telescope are:
-- - Insert mode: <c-/>
-- - Normal mode: ?
--
-- This opens a window that shows you all of the keymaps for the current
-- Telescope picker. This is really useful to discover what Telescope can
-- do as well as how to actually do it!
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
-- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()`
--
-- defaults = {
-- mappings = {
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
-- },
-- },
-- pickers = {}
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
},
},
}
-- Enable Telescope extensions if they are installed
pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'ui-select')
-- Telescope keymaps are now handled by custom.plugins.telescope
end,
},
-- LSP Plugins
{
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
},
},
},
{
-- Main LSP Configuration
'neovim/nvim-lspconfig',
dependencies = {
-- Useful status updates for LSP.
{ 'j-hui/fidget.nvim', opts = {} },
-- Allows extra capabilities provided by blink.cmp
'saghen/blink.cmp',
},
config = function()
-- Brief aside: **What is LSP?**
--
-- LSP is an initialism you've probably heard, but might not understand what it is.
--
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
-- and language tooling communicate in a standardized fashion.
--
-- In general, you have a "server" which is some tool built to understand a particular
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
-- processes that communicate with some "client" - in this case, Neovim!
--
-- LSP provides Neovim with features like:
-- - Go to definition
-- - Find references
-- - Autocompletion
-- - Symbol Search
-- - and more!
--
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
-- and elegantly composed help section, `:help lsp-vs-treesitter`
-- This function gets run when an LSP attaches to a particular buffer.
-- That is to say, every time a new file is opened that is associated with
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
-- function will be executed to configure the current buffer
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
callback = function(event)
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
-- to define small helper and utility functions so you don't have to repeat yourself.
--
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local map = function(keys, func, desc, mode)
mode = mode or 'n'
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
-- Rename the variable under your cursor.
-- Most Language Servers support renaming across files, etc.
map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
-- Execute a code action, usually your cursor needs to be on top of an error
-- or a suggestion from your LSP for this to activate.
map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
-- Find references for the word under your cursor.
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
-- Jump to the implementation of the word under your cursor.
-- Useful when your language has ways of declaring types without an actual implementation.
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
-- Jump to the definition of the word under your cursor.
-- This is where a variable was first declared, or where a function is defined, etc.
-- To jump back, press <C-t>.
map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
-- WARN: This is not Goto Definition, this is Goto Declaration.
-- For example, in C this would take you to the header.
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
-- Fuzzy find all the symbols in your current document.
-- Symbols are things like variables, functions, types, etc.
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
-- Fuzzy find all the symbols in your current workspace.
-- Similar to document symbols, except searches over your entire project.
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
-- Jump to the type of the word under your cursor.
-- Useful when you're not sure what type a variable is and you want to see
-- the definition of its *type*, not where it was *defined*.
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
---@param client vim.lsp.Client
---@param method vim.lsp.protocol.Method
---@param bufnr? integer some lsp support methods only in specific files
---@return boolean
local function client_supports_method(client, method, bufnr)
if vim.fn.has 'nvim-0.11' == 1 then
return client:supports_method(method, bufnr)
else
return client.supports_method(method, { bufnr = bufnr })
end
end
-- The following two autocommands are used to highlight references of the
-- word under your cursor when your cursor rests there for a little while.
-- See `:help CursorHold` for information about when this is executed
--
-- When you move your cursor, the highlights will be cleared (the second autocommand).
local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.clear_references,
})
vim.api.nvim_create_autocmd('LspDetach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
callback = function(event2)
vim.lsp.buf.clear_references()
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
end,
})
end
-- The following code creates a keymap to toggle inlay hints in your
-- code, if the language server you are using supports them
--
-- This may be unwanted, since they displace some of your code
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
map('<leader>th', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
end, '[T]oggle Inlay [H]ints')
end
end,
})
-- Diagnostic Config
-- See :help vim.diagnostic.Opts
vim.diagnostic.config {
severity_sort = true,
float = { border = 'rounded', source = 'if_many' },
underline = { severity = vim.diagnostic.severity.ERROR },
signs = vim.g.have_nerd_font and {
text = {
[vim.diagnostic.severity.ERROR] = '󰅚 ',
[vim.diagnostic.severity.WARN] = '󰀪 ',
[vim.diagnostic.severity.INFO] = '󰋽 ',
[vim.diagnostic.severity.HINT] = '󰌶 ',
},
} or {},
virtual_text = {
source = 'if_many',
spacing = 2,
format = function(diagnostic)
local diagnostic_message = {
[vim.diagnostic.severity.ERROR] = diagnostic.message,
[vim.diagnostic.severity.WARN] = diagnostic.message,
[vim.diagnostic.severity.INFO] = diagnostic.message,
[vim.diagnostic.severity.HINT] = diagnostic.message,
}
return diagnostic_message[diagnostic.severity]
end,
},
}
-- LSP servers and clients are able to communicate to each other what features they support.
-- By default, Neovim doesn't support everything that is in the LSP specification.
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
local capabilities = require('blink.cmp').get_lsp_capabilities()
-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
--
-- Add any additional override configuration in the following tables. Available keys are:
-- - cmd (table): Override the default command used to start the server
-- - filetypes (table): Override the default list of associated filetypes for the server
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
-- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
-- clangd = {},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
-- Some languages (like typescript) have entire language plugins that can be useful:
-- https://github.com/pmizio/typescript-tools.nvim
--
-- But for many setups, the LSP (`ts_ls`) will work just fine
-- ts_ls = {},
--
lua_ls = {
-- cmd = { ... },
filetypes = { 'lua', 'luau' },
-- capabilities = {},
settings = {
Lua = {
completion = {
callSnippet = 'Replace',
},
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
-- diagnostics = { disable = { 'missing-fields' } },
},
},
},
}
for server_name, server in pairs(servers) do
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
end
end,
},
{ -- Autoformat
'stevearc/conform.nvim',
event = { 'BufWritePre' },
cmd = { 'ConformInfo' },
keys = {
{
'<leader>f',
function()
require('conform').format { async = true, lsp_format = 'fallback' }
end,
mode = '',
desc = '[F]ormat buffer',
},
},
opts = {
notify_on_error = false,
format_on_save = function(bufnr)
-- Disable "format_on_save lsp_fallback" for languages that don't
-- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true }
if disable_filetypes[vim.bo[bufnr].filetype] then
return nil
else
return {
timeout_ms = 500,
lsp_format = 'fallback',
}
end
end,
formatters_by_ft = {
lua = { 'stylua' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
-- You can use 'stop_after_first' to run the first available formatter from the list
-- javascript = { "prettierd", "prettier", stop_after_first = true },
},
},
},
{ -- Autocompletion
'saghen/blink.cmp',
event = 'VimEnter',
version = '1.*',
dependencies = {
-- Snippet Engine
{
'L3MON4D3/LuaSnip',
version = '2.*',
build = (function()
-- Build Step is needed for regex support in snippets.
-- This step is not supported in many windows environments.
-- Remove the below condition to re-enable on windows.
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
return
end
return 'make install_jsregexp'
end)(),
dependencies = {
-- `friendly-snippets` contains a variety of premade snippets.
-- See the README about individual language/framework/plugin snippets:
-- https://github.com/rafamadriz/friendly-snippets
-- {
-- 'rafamadriz/friendly-snippets',
-- config = function()
-- require('luasnip.loaders.from_vscode').lazy_load()
-- end,
-- },
},
opts = {},
},
'folke/lazydev.nvim',
},
--- @module 'blink.cmp'
--- @type blink.cmp.Config
opts = {
keymap = {
-- 'default' (recommended) for mappings similar to built-in completions
-- <c-y> to accept ([y]es) the completion.
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
-- 'super-tab' for tab to accept
-- 'enter' for enter to accept
-- 'none' for no mappings
--
-- For an understanding of why the 'default' preset is recommended,
-- you will need to read `:help ins-completion`
--
-- No, but seriously. Please read `:help ins-completion`, it is really good!
--
-- All presets have the following mappings:
-- <tab>/<s-tab>: move to right/left of your snippet expansion
-- <c-space>: Open menu or open docs if already open
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
-- <c-e>: Hide menu
-- <c-k>: Toggle signature help
--
-- See :h blink-cmp-config-keymap for defining your own keymap
preset = 'default',
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
},
appearance = {
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = 'mono',
},
completion = {
-- By default, you may press `<c-space>` to show the documentation.
-- Optionally, set `auto_show = true` to show the documentation after a delay.
documentation = { auto_show = false, auto_show_delay_ms = 500 },
},
sources = {
default = { 'lsp', 'path', 'snippets', 'lazydev' },
providers = {
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
},
},
snippets = { preset = 'luasnip' },
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
-- which automatically downloads a prebuilt binary when enabled.
--
-- By default, we use the Lua implementation instead, but you may enable
-- the rust implementation via `'prefer_rust_with_warning'`
--
-- See :h blink-cmp-config-fuzzy for more information
fuzzy = { implementation = 'lua' },
-- Shows a signature help window while you type arguments for a function
signature = { enabled = true },
},
},
{ -- You can easily change to a different colorscheme.
-- Change the name of the colorscheme plugin below, and then
-- change the command in the config to whatever the name of that colorscheme is.
--
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
'folke/tokyonight.nvim',
priority = 1000, -- Make sure to load this before all the other start plugins.
config = function()
---@diagnostic disable-next-line: missing-fields
require('tokyonight').setup {
styles = {
comments = { italic = false }, -- Disable italics in comments
},
}
-- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night'
end,
},
-- Highlight todo, notes, etc in comments
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
{ -- Collection of various small independent plugins/modules
'echasnovski/mini.nvim',
config = function()
-- Better Around/Inside textobjects
--
-- Examples:
-- - va) - [V]isually select [A]round [)]paren
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
-- - ci' - [C]hange [I]nside [']quote
require('mini.ai').setup { n_lines = 500 }
-- Add/delete/replace surroundings (brackets, quotes, etc.)
--
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
require('mini.surround').setup()
-- Simple and easy statusline.
-- You could remove this setup call if you don't like it,
-- and try some other statusline plugin
local statusline = require 'mini.statusline'
-- set use_icons to true if you have a Nerd Font
statusline.setup { use_icons = vim.g.have_nerd_font }
-- You can configure sections in the statusline by overriding their
-- default behavior. For example, here we set the section for
-- cursor location to LINE:COLUMN
---@diagnostic disable-next-line: duplicate-set-field
statusline.section_location = function()
return '%2l:%-2v'
end
-- ... and there is more!
-- Check out: https://github.com/echasnovski/mini.nvim
end,
},
{ -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = {
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {
enable = true,
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
-- If you are experiencing weird indenting issues, add the language to
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
additional_vim_regex_highlighting = { 'ruby' },
},
indent = { enable = true, disable = { 'ruby' } },
},
-- There are additional nvim-treesitter modules that you can use to interact
-- with nvim-treesitter. You should go explore a few and see what interests you:
--
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
},
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
-- init.lua. If you want these files, they are in the repository, so you can just download them and
-- place them in the correct locations.
-- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart
--
-- Here are some example plugins that I've included in the Kickstart repository.
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
--
-- require 'kickstart.plugins.debug',
-- require 'kickstart.plugins.indent_line',
-- require 'kickstart.plugins.lint',
-- require 'kickstart.plugins.autopairs',
-- require 'kickstart.plugins.neo-tree',
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- This is the easiest way to modularize your config.
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
{ import = 'custom.plugins' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!
-- In normal mode type `<space>sh` then write `lazy.nvim-plugin`
-- you can continue same window with `<space>sr` which resumes last telescope search
}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
icons = vim.g.have_nerd_font and {} or {
cmd = '',
config = '🛠',
event = '📅',
ft = '📂',
init = '',
keys = '🗝',
plugin = '🔌',
runtime = '💻',
require = '🌙',
source = '📄',
start = '🚀',
task = '📌',
lazy = '💤 ',
},
},
})
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

0
lua/core/autocmds.lua Normal file
View File

13
lua/core/bootstrap.lua Normal file
View File

@ -0,0 +1,13 @@
-- Lazy.nvim installation
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable',
lazypath,
}
end
vim.opt.rtp:prepend(lazypath)

98
lua/core/health.lua Normal file
View File

@ -0,0 +1,98 @@
-- Health check for the modular Neovim configuration
local M = {}
local check_version = function()
local verstr = tostring(vim.version())
if not vim.version.ge then
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
return
end
if vim.version.ge(vim.version(), '0.10-dev') then
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
else
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
end
end
local check_external_reqs = function()
-- Basic utils
for _, exe in ipairs { 'git', 'make', 'unzip' } do
local is_executable = vim.fn.executable(exe) == 1
if is_executable then
vim.health.ok(string.format("Found executable: '%s'", exe))
else
vim.health.warn(string.format("Could not find executable: '%s'", exe))
end
end
-- Search tools
for _, exe in ipairs { 'rg', 'fd' } do
local is_executable = vim.fn.executable(exe) == 1
if is_executable then
vim.health.ok(string.format("Found search tool: '%s'", exe))
else
vim.health.warn(string.format("Could not find search tool: '%s' (required for Telescope)", exe))
end
end
end
local check_lsp_servers = function()
-- Check for LSP servers installed via Nix
local servers = {
{ name = 'clangd', desc = 'C/C++ language server' },
{ name = 'pyright', desc = 'Python language server' },
{ name = 'ruff', desc = 'Python linter/formatter' },
{ name = 'nixd', desc = 'Nix language server' },
{ name = 'texlab', desc = 'LaTeX language server' },
{ name = 'cmake-language-server', desc = 'CMake language server' },
}
vim.health.start('LSP Servers (via Nix/Home Manager)')
for _, server in ipairs(servers) do
local is_executable = vim.fn.executable(server.name) == 1
if is_executable then
vim.health.ok(string.format("Found %s: '%s'", server.desc, server.name))
else
vim.health.info(string.format("Not found: '%s' (%s) - install via Nix if needed", server.name, server.desc))
end
end
end
local check_formatters = function()
-- Check for formatters installed via Nix
local formatters = {
{ name = 'stylua', filetype = 'lua' },
{ name = 'clang-format', filetype = 'c/cpp' },
{ name = 'alejandra', filetype = 'nix' },
}
vim.health.start('Formatters (via Nix/Home Manager)')
for _, formatter in ipairs(formatters) do
local is_executable = vim.fn.executable(formatter.name) == 1
if is_executable then
vim.health.ok(string.format("Found formatter for %s: '%s'", formatter.filetype, formatter.name))
else
vim.health.info(string.format("Not found: '%s' (%s) - install via Nix if needed", formatter.name, formatter.filetype))
end
end
end
function M.check()
vim.health.start('Modular Neovim Configuration')
vim.health.info [[NOTE: Not every warning needs to be fixed.
Only install tools for languages you actually use.
All language servers and formatters should be installed via Nix/Home Manager.]]
local uv = vim.uv or vim.loop
vim.health.info('System Information: ' .. vim.inspect(uv.os_uname()))
check_version()
check_external_reqs()
check_lsp_servers()
check_formatters()
end
return M

View File

@ -1,29 +0,0 @@
return {
'saghen/blink.cmp',
dependencies = {
"giuxtaposition/blink-cmp-copilot",
},
opts = {
sources = {
default = { "lsp", "path", "copilot", "buffer" },
providers = {
copilot = {
name = "copilot",
module = "blink-cmp-copilot",
score_offset = 100, -- High priority to show Copilot near the top
async = true,
},
},
},
keymap = {
preset = 'default',
accept = '<C-y>', -- Your preferred accept key
},
appearance = {
-- Show source of completion (LSP/Copilot/Buffer)
use_nvim_cmp_as_default = false,
nerd_font_variant = 'mono',
},
fuzzy = {},
},
}

View File

@ -1,35 +0,0 @@
return {
-- Use copilot.lua for API access (no UI)
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
config = function()
require("copilot").setup({
suggestion = { enabled = false }, -- Disable inline ghost text
panel = { enabled = false }, -- Disable suggestion panel
filetypes = {
yaml = false,
markdown = false,
help = false,
gitcommit = false,
gitrebase = false,
hgcommit = false,
svn = false,
cvs = false,
["."] = false,
},
copilot_node_command = 'node', -- Node.js version must be > 18.x
server_opts_overrides = {},
})
end,
},
-- Bridge between copilot.lua and blink.cmp
{
"giuxtaposition/blink-cmp-copilot",
dependencies = {
"zbirenbaum/copilot.lua",
},
},
}

View File

@ -1,157 +0,0 @@
-- ~/dlond/nvim/lua/custom/plugins/debug.lua
-- Debug Adapter Protocol (DAP) setup, integrating kickstart's UI preferences
return {
-- Main DAP plugin
{
'mfussenegger/nvim-dap',
dependencies = {
-- UI for nvim-dap
{
'rcarriga/nvim-dap-ui',
dependencies = { 'nvim-neotest/nvim-nio' }, -- nvim-dap-ui often needs nio
config = function()
local asyn = require 'plenary.async'
local dapui = require 'dapui'
dapui.setup {
-- Borrowed icon and control settings from kickstart/plugins/debug.lua
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '',
play = '',
step_into = '',
step_over = '',
step_out = '',
step_back = 'b', -- Kickstart uses 'b', nvim-dap default might be different
run_last = '▶▶',
terminate = '',
disconnect = '',
},
},
-- You can customize layouts, floating window behavior, etc.
-- layouts = { ... },
-- floating = { ... },
}
-- Automatically open/close dapui when DAP session starts/stops
local dap = require 'dap'
dap.listeners.after.event_initialized['dapui_config'] = function()
dapui.open()
end
dap.listeners.before.event_terminated['dapui_config'] = function()
dapui.close()
end
dap.listeners.before.event_exited['dapui_config'] = function()
dapui.close()
end
end,
},
-- Optional: Virtual text for DAP (shows variable values inline)
-- { 'theHamsta/nvim-dap-virtual-text', opts = {} },
-- If you need Go debugging, you would add 'leoluz/nvim-dap-go' here
-- and call its setup in the nvim-dap config function.
-- { 'leoluz/nvim-dap-go' },
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
local async = require 'plenary.async'
-- Configure the LLDB DAP adapter for C/C++
-- Assumes 'lldb-dap' executable is in PATH (from pkgs.llvmPackages_XX.lldb)
dap.adapters.lldb = {
type = 'executable',
command = 'lldb-dap',
name = 'lldb-dap (Nix)',
}
dap.configurations.cpp = {
{
name = 'Launch C/C++ (lldb-dap)',
type = 'lldb',
request = 'launch',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
-- local utils = require 'custom.utils'
-- local target = utils:get_target()
-- return utils.pick_executable(vim.fn.getcwd() .. '/' .. target)
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = {},
-- Ensure your C/C++ project is compiled with debug symbols (e.g., -g flag with clang/gcc)
},
}
dap.configurations.c = dap.configurations.cpp -- Use same config for C
-- Python DAP configuration (using debugpy)
-- Ensure python3Packages.debugpy is in your home.packages
dap.adapters.python = {
type = 'executable',
command = 'python', -- Should be the python from your Nix env
args = { '-m', 'debugpy.adapter' },
}
dap.configurations.python = {
{
type = 'python',
request = 'launch',
name = 'Launch Python file',
program = '${file}', -- Debug the current file
pythonPath = function()
local venv = os.getenv 'VIRTUAL_ENV'
if venv then
return venv .. '/bin/python'
end
-- Fallback to trying to find python3, then python in PATH
-- This could be made more robust by getting python path from Nix if needed
local py3 = vim.fn.executable 'python3'
if py3 ~= 0 and py3 ~= '' then
return py3
end
return 'python'
end,
},
}
-- If you added 'leoluz/nvim-dap-go' as a dependency:
-- require('dap-go').setup() -- Call its setup function
-- Launch and Control
vim.keymap.set('n', '<leader>dc', function()
async.run(function()
dap.continue()
if not dapui.windows or vim.tbl_isempty(dapui.windows) then
dapui.open()
end
end)
end, { desc = 'DAP: [C]ontinue show UI (async-safe)' })
vim.keymap.set('n', '<leader>db', dap.toggle_breakpoint, { desc = 'DAP: Toggle [B]reakpoint' })
vim.keymap.set('n', '<leader>dl', dap.run_last, { desc = 'DAP: Run [L]ast' })
-- DAP: Stepping
vim.keymap.set('n', '<leader>di', dap.step_into, { desc = 'DAP: Step [I]nto' })
vim.keymap.set('n', '<leader>dk', dap.step_over, { desc = 'DAP: Step [O]ver (k)' })
vim.keymap.set('n', '<leader>do', dap.step_out, { desc = 'DAP: Step [O]ut' })
vim.keymap.set('n', '<leader>dx', function()
async.run(function()
dap.run_to_cursor()
end)
end, { desc = 'DAP: Run to Cursor (x) (asyn-safe)' })
-- DAP: Termination
vim.keymap.set('n', '<leader>dt', function()
async.run(function()
dap.terminate()
dapui.close()
end)
end, { desc = 'DAP: [T]erminate (async-safe)' })
-- DAP: UI
vim.keymap.set('n', '<leader>dr', dap.repl.open, { desc = 'DAP: Open [R]EPL' })
vim.keymap.set('n', '<leader>du', dapui.toggle, { desc = 'DAP: Toggle [U]I' })
end,
},
}

View File

@ -1,73 +0,0 @@
return {
-- Fugitive - Git integration
{
'tpope/vim-fugitive',
cmd = { 'Git', 'G', 'Gdiff', 'Gread', 'Gwrite', 'Ggrep', 'GMove', 'GDelete', 'GBrowse', 'GRemove' },
keys = {
{ '<leader>gs', '<cmd>Git<cr>', desc = 'Git status' },
{ '<leader>gd', '<cmd>Gdiff<cr>', desc = 'Git diff' },
{ '<leader>gc', '<cmd>Git commit<cr>', desc = 'Git commit' },
{ '<leader>gb', '<cmd>Git blame<cr>', desc = 'Git blame' },
{ '<leader>gl', '<cmd>Git log<cr>', desc = 'Git log' },
{ '<leader>gp', '<cmd>Git push<cr>', desc = 'Git push' },
{ '<leader>gf', '<cmd>Git fetch<cr>', desc = 'Git fetch' },
},
},
-- Gitsigns - Git gutter and hunk operations
{
'lewis6991/gitsigns.nvim',
opts = {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
on_attach = function(bufnr)
local gitsigns = require('gitsigns')
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']c', function()
if vim.wo.diff then
vim.cmd.normal({']c', bang = true})
else
gitsigns.nav_hunk('next')
end
end, { desc = 'Next git hunk' })
map('n', '[c', function()
if vim.wo.diff then
vim.cmd.normal({'[c', bang = true})
else
gitsigns.nav_hunk('prev')
end
end, { desc = 'Previous git hunk' })
-- Actions
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'Stage hunk' })
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'Reset hunk' })
map('v', '<leader>hs', function() gitsigns.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end, { desc = 'Stage hunk' })
map('v', '<leader>hr', function() gitsigns.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end, { desc = 'Reset hunk' })
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'Stage buffer' })
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'Undo stage hunk' })
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'Reset buffer' })
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'Preview hunk' })
map('n', '<leader>hb', function() gitsigns.blame_line{full=true} end, { desc = 'Blame line' })
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = 'Toggle line blame' })
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'Diff this' })
map('n', '<leader>hD', function() gitsigns.diffthis('~') end, { desc = 'Diff this ~' })
map('n', '<leader>td', gitsigns.toggle_deleted, { desc = 'Toggle deleted' })
-- Text object
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'Select hunk' })
end,
},
},
}

View File

@ -1,17 +0,0 @@
-- You can add your own plugins here or in other files in this directory!
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {
-- { import = 'custom.plugins.completion' },
-- { import = 'custom.plugins.theme' },
-- { import = 'custom.plugins.avante' },
{ import = 'custom.plugins.copilot' },
{ import = 'custom.plugins.debug' },
{ import = 'custom.plugins.formatting' },
{ import = 'custom.plugins.git' },
{ import = 'custom.plugins.lsp' },
{ import = 'custom.plugins.nvim-tmux-navigator' },
{ import = 'custom.plugins.telescope' },
{ import = 'custom.plugins.treesitter' },
}

View File

@ -1,3 +0,0 @@
return {
require 'custom.plugins.lsp.lsp',
}

View File

@ -1,91 +0,0 @@
-- ~/dlond/nvim/lua/custom/plugins/lsp.lua
-- LSP configuration, assuming LSP servers are installed via Nix/Home Manager
return {
{
'neovim/nvim-lspconfig',
-- only load when editing these filetypes (optional)
ft = {
'c',
'cpp',
'objc',
'objcpp',
'cuda',
'cmake',
--
'go',
'nix',
'python',
'rust',
'tex',
},
opts = function()
local lspconfig = require 'lspconfig'
local capabilities = {}
pcall(function()
capabilities = require('blink.cmp').get_lsp_capabilities()
end)
local util = require 'lspconfig.util'
local query_driver = table.concat({
'/nix/store/*/bin/clang*',
'/opt/homebrew/opt/llvm/bin/clang*',
'/usr/bin/clang*',
}, ';')
local servers = {
clangd = {
cmd = {
'clangd',
'--background-index',
'--clang-tidy',
'--header-insertion=never',
'--query-driver=' .. query_driver,
'--compile-commands-dir=build',
'--resource-dir=' .. (function()
local ok, result = pcall(vim.fn.systemlist, { 'clang++', '--print-resource-dir' })
if ok and result and result[1] then
return result[1]
else
return '/usr/lib/clang/19/include' -- fallback
end
end)(),
},
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },
root_dir = util.root_pattern('CMakeLists.txt', '.git'),
single_file_support = true,
},
pyright = {
settings = {
python = {
analysis = {
autoSearchPaths = true,
diagnosticMode = 'openFilesOnly',
useLibraryCodeForTypes = true,
typeCheckingMode = 'basic',
},
},
},
positionEncoding = 'utf-8',
},
ruff = {},
nixd = {},
texlab = {},
cmake = {
cmd = { 'cmake-language-server' },
filetypes = { 'cmake' },
root_dir = util.root_pattern('CMakeLists.txt', '.git'),
},
}
for name, config in pairs(servers) do
config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, config.capabilities or {})
lspconfig[name].setup(config)
end
end,
},
}

View File

@ -1,11 +0,0 @@
return {
{
'christoomey/vim-tmux-navigator',
config = function()
vim.keymap.set('n', '<C-h>', ':TmuxNavigateLeft<CR>', { desc = 'Navigate to left tmux pane' })
vim.keymap.set('n', '<C-j>', ':TmuxNavigateDown<CR>', { desc = 'Navigate to lower tmux pane' })
vim.keymap.set('n', '<C-k>', ':TmuxNavigateUp<CR>', { desc = 'Navigate to upper tmux pane' })
vim.keymap.set('n', '<C-l>', ':TmuxNavigateRight<CR>', { desc = 'Navigate to right tmux pane' })
end,
},
}

View File

@ -1,85 +0,0 @@
return {
-- ========================================
-- Telescope Override
-- ========================================
{
'nvim-telescope/telescope.nvim',
-- Ensure dependencies are loaded
dependencies = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
},
{ 'nvim-telescope/telescope-ui-select.nvim' },
},
opts = { -- Use opts to merge/override defaults
pickers = {
find_files = {
-- Use rg for finding files (ensure rg is installed via Nix/Home Manager)
find_command = { 'rg', '--files', '--hidden', '-g', '!.git' },
},
},
-- Configure extensions
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
},
-- Configuration for fzf-native extension
fzf = {
fuzzy = true, -- Enable fuzzy matching
override_generic_sorter = true, -- Override the generic sorter
override_file_sorter = true, -- Override the file sorter
case_mode = 'smart_case', -- Ignore case unless capitals are used
},
},
},
-- The config function ensures extensions are loaded after setup
config = function(_, opts)
require('telescope').setup(opts)
-- Load extensions after setup
pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'ui-select')
-- *** ADD TELESCOPE KEYMAPS HERE ***
local builtin = require 'telescope.builtin'
-- Add the find_files keymap
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
-- Add other Telescope keymaps from kickstart's init.lua (uncomment to enable)
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
-- Fuzzy search in current buffer (corrected function body)
vim.keymap.set('n', '<leader>/', function()
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer' })
-- Search in open files (corrected function body)
vim.keymap.set('n', '<leader>s/', function()
builtin.live_grep {
grep_open_files = true,
prompt_title = 'Live Grep in Open Files',
}
end, { desc = '[S]earch [/] in Open Files' })
-- Search Neovim files (corrected function body)
vim.keymap.set('n', '<leader>sn', function()
builtin.find_files { cwd = vim.fn.stdpath 'config' }
end, { desc = '[S]earch [N]eovim files' })
end,
},
}

View File

@ -1,52 +0,0 @@
return {
-- ========================================
-- Treesitter Configuration Override
-- ========================================
{
'nvim-treesitter/nvim-treesitter',
-- build = ':TSUpdate', -- Keep build command if needed from kickstart
-- main = 'nvim-treesitter.configs', -- Keep if needed from kickstart
event = { 'BufReadPost', 'BufNewFile' },
build = ':TSUpdate',
opts = { -- Use opts to merge/override defaults
ensure_installed = {
'bash',
'c',
'cmake',
'cpp',
'diff',
'html',
'lua',
'luadoc',
'make',
'markdown',
'markdown_inline',
'nix',
'python',
'query',
'vim',
'vimdoc',
'yaml',
},
auto_install = true,
-- Keep other kickstart defaults like highlight/indent settings unless you want to change them
highlight = {
enable = true,
-- additional_vim_regex_highlighting = { 'ruby' }, -- Keep if needed
},
indent = {
enable = true,
-- disable = { 'ruby' }, -- Keep if needed
},
},
config = function(_, opts)
require('nvim-treesitter.configs').setup(opts)
end,
-- If kickstart used a config function for treesitter and you need to replicate
-- parts of it that aren't handled by opts, add it here.
-- config = function(_, opts)
-- require('nvim-treesitter.configs').setup(opts)
-- end,
},
}

View File

@ -1,69 +0,0 @@
-- local async = require 'plenary.async'
-- local pickers = require 'telescope.pickers'
-- local finders = require 'telescope.finders'
-- local sorters = require('telescope.config').values
-- local actions = require 'telescope.actions'
-- local action_state = require 'telescope.actions.state'
--
-- local function collect_executables(start_dir)
-- local results = {}
--
-- -- Add '.', start_dir so it works with your fd version
-- local fd = vim.fn.systemlist {
-- 'fd',
-- '.',
-- start_dir,
-- '--exec',
-- 'file',
-- '{}',
-- }
--
-- for _, line in ipairs(fd) do
-- local path, typeinfo = line:match '^(.-):%s*(.+)$'
-- if path and not path:match 'CMakeFiles' and typeinfo and (typeinfo:match 'Mach%-O' or typeinfo:match 'ELF') then
-- table.insert(results, path)
-- end
-- end
--
-- return results
-- end
--
-- local function pick_executable(start_dir)
-- return async.wrap(function(_start_dir, on_choice)
-- local executables = collect_executables(_start_dir)
--
-- if #executables == 0 then
-- vim.notify('No executables found in ' .. _start_dir, vim.log.levels.WARN)
-- on_choice(nil)
-- return
-- end
--
-- pickers
-- .new({}, {
-- prompt_title = 'Select Executable',
-- finder = finders.new_table { results = executables },
-- sorter = sorters.generic_sorter {},
-- attach_mappings = function(_, map)
-- actions.select_default:replace(function(prompt_bufnr)
-- local entry = action_state.get_selected_entry()
-- actions.close(prompt_bufnr)
-- on_choice(entry.value)
-- end)
-- map('i', '<Esc>', function(bufnr)
-- actions.close(bufnr)
-- on_choice(nil)
-- end)
-- map('n', 'q', function(bufnr)
-- actions.close(bufnr)
-- on_choice(nil)
-- end)
-- return true
-- end,
-- })
-- :find()
-- end, 2)(start_dir)
-- end
--
-- return {
-- pick_executable = pick_executable,
-- }

View File

@ -1,52 +0,0 @@
--[[
--
-- This file is not required for your own configuration,
-- but helps people determine if their system is setup correctly.
--
--]]
local check_version = function()
local verstr = tostring(vim.version())
if not vim.version.ge then
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
return
end
if vim.version.ge(vim.version(), '0.10-dev') then
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
else
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
end
end
local check_external_reqs = function()
-- Basic utils: `git`, `make`, `unzip`
for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do
local is_executable = vim.fn.executable(exe) == 1
if is_executable then
vim.health.ok(string.format("Found executable: '%s'", exe))
else
vim.health.warn(string.format("Could not find executable: '%s'", exe))
end
end
return true
end
return {
check = function()
vim.health.start 'kickstart.nvim'
vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth`
Fix only warnings for plugins and languages you intend to use.
Mason will give warnings for languages that are not installed.
You do not need to install, unless you want to use those languages!]]
local uv = vim.uv or vim.loop
vim.health.info('System Information: ' .. vim.inspect(uv.os_uname()))
check_version()
check_external_reqs()
end,
}

View File

@ -1,8 +0,0 @@
-- autopairs
-- https://github.com/windwp/nvim-autopairs
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
opts = {},
}

View File

@ -1,127 +0,0 @@
-- debug.lua
--
-- Shows how to use the DAP plugin to debug your code.
--
-- Primarily focused on configuring the debugger for Go, but can
-- be extended to other languages as well. That's why it's called
-- kickstart.nvim and not kitchen-sink.nvim ;)
return {
-- NOTE: Yes, you can install new plugins here!
'mfussenegger/nvim-dap',
-- NOTE: And you can specify dependencies as well
dependencies = {
-- Creates a beautiful debugger UI
'rcarriga/nvim-dap-ui',
-- Required dependency for nvim-dap-ui
'nvim-neotest/nvim-nio',
-- Add your own debuggers here
'leoluz/nvim-dap-go',
},
keys = {
-- Basic debugging keymaps, feel free to change to your liking!
{
'<F5>',
function()
require('dap').continue()
end,
desc = 'Debug: Start/Continue',
},
{
'<F1>',
function()
require('dap').step_into()
end,
desc = 'Debug: Step Into',
},
{
'<F2>',
function()
require('dap').step_over()
end,
desc = 'Debug: Step Over',
},
{
'<F3>',
function()
require('dap').step_out()
end,
desc = 'Debug: Step Out',
},
{
'<leader>b',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>B',
function()
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end,
desc = 'Debug: Set Breakpoint',
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{
'<F7>',
function()
require('dapui').toggle()
end,
desc = 'Debug: See last session result.',
},
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup {
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '',
play = '',
step_into = '',
step_over = '',
step_out = '',
step_back = 'b',
run_last = '▶▶',
terminate = '',
disconnect = '',
},
},
}
-- Change breakpoint icons
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
-- local breakpoint_icons = vim.g.have_nerd_font
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
-- for type, icon in pairs(breakpoint_icons) do
-- local tp = 'Dap' .. type
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
-- end
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close
-- Install golang specific config
require('dap-go').setup {
delve = {
-- On Windows delve must be run attached or it crashes.
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
detached = vim.fn.has 'win32' == 0,
},
}
end,
}

View File

@ -1,61 +0,0 @@
-- Adds git related signs to the gutter, as well as utilities for managing changes
-- NOTE: gitsigns is already included in init.lua but contains only the base
-- config. This will add also the recommended keymaps.
return {
{
'lewis6991/gitsigns.nvim',
opts = {
on_attach = function(bufnr)
local gitsigns = require 'gitsigns'
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']c', function()
if vim.wo.diff then
vim.cmd.normal { ']c', bang = true }
else
gitsigns.nav_hunk 'next'
end
end, { desc = 'Jump to next git [c]hange' })
map('n', '[c', function()
if vim.wo.diff then
vim.cmd.normal { '[c', bang = true }
else
gitsigns.nav_hunk 'prev'
end
end, { desc = 'Jump to previous git [c]hange' })
-- Actions
-- visual mode
map('v', '<leader>hs', function()
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'git [s]tage hunk' })
map('v', '<leader>hr', function()
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'git [r]eset hunk' })
-- normal mode
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
map('n', '<leader>hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' })
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
map('n', '<leader>hD', function()
gitsigns.diffthis '@'
end, { desc = 'git [D]iff against last commit' })
-- Toggles
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
end,
},
},
}

View File

@ -1,9 +0,0 @@
return {
{ -- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help ibl`
main = 'ibl',
opts = {},
},
}

View File

@ -1,60 +0,0 @@
return {
{ -- Linting
'mfussenegger/nvim-lint',
event = { 'BufReadPre', 'BufNewFile' },
config = function()
local lint = require 'lint'
lint.linters_by_ft = {
markdown = { 'markdownlint' },
}
-- To allow other plugins to add linters to require('lint').linters_by_ft,
-- instead set linters_by_ft like this:
-- lint.linters_by_ft = lint.linters_by_ft or {}
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
--
-- However, note that this will enable a set of default linters,
-- which will cause errors unless these tools are available:
-- {
-- clojure = { "clj-kondo" },
-- dockerfile = { "hadolint" },
-- inko = { "inko" },
-- janet = { "janet" },
-- json = { "jsonlint" },
-- markdown = { "vale" },
-- rst = { "vale" },
-- ruby = { "ruby" },
-- terraform = { "tflint" },
-- text = { "vale" }
-- }
--
-- You can disable the default linters by setting their filetypes to nil:
-- lint.linters_by_ft['clojure'] = nil
-- lint.linters_by_ft['dockerfile'] = nil
-- lint.linters_by_ft['inko'] = nil
-- lint.linters_by_ft['janet'] = nil
-- lint.linters_by_ft['json'] = nil
-- lint.linters_by_ft['markdown'] = nil
-- lint.linters_by_ft['rst'] = nil
-- lint.linters_by_ft['ruby'] = nil
-- lint.linters_by_ft['terraform'] = nil
-- lint.linters_by_ft['text'] = nil
-- Create autocommand which carries out the actual linting
-- on the specified events.
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup,
callback = function()
-- Only run the linter in buffers that you can modify in order to
-- avoid superfluous noise, notably within the handy LSP pop-ups that
-- describe the hovered symbol using Markdown.
if vim.bo.modifiable then
lint.try_lint()
end
end,
})
end,
},
}

View File

@ -1,25 +0,0 @@
-- Neo-tree is a Neovim plugin to browse the file system
-- https://github.com/nvim-neo-tree/neo-tree.nvim
return {
'nvim-neo-tree/neo-tree.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
},
lazy = false,
keys = {
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
},
opts = {
filesystem = {
window = {
mappings = {
['\\'] = 'close_window',
},
},
},
},
}

View File

@ -0,0 +1,126 @@
-- Blink.cmp Configuration
local M = {}
function M.setup()
require('blink.cmp').setup({
-- Keymap configuration
keymap = {
preset = 'default',
['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
['<C-e>'] = { 'hide' },
['<C-y>'] = { 'select_and_accept' },
['<C-p>'] = { 'select_prev', 'fallback' },
['<C-n>'] = { 'select_next', 'fallback' },
['<C-b>'] = { 'scroll_documentation_up', 'fallback' },
['<C-f>'] = { 'scroll_documentation_down', 'fallback' },
['<Tab>'] = { 'snippet_forward', 'fallback' },
['<S-Tab>'] = { 'snippet_backward', 'fallback' },
},
-- Appearance configuration
appearance = {
use_nvim_cmp_as_default = true,
nerd_font_variant = 'mono',
},
-- Sources configuration with Copilot integration
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer', 'copilot' },
providers = {
copilot = {
name = 'copilot',
module = 'blink-cmp-copilot',
score_offset = 100,
async = true,
transform_items = function(_, items)
-- Add copilot icon to copilot suggestions
for _, item in ipairs(items) do
item.kind = 'Copilot'
end
return items
end,
},
},
},
-- Command line configuration (new API)
cmdline = {
enabled = false, -- Disable cmdline completion for now
},
-- Signature help configuration
signature = {
enabled = true,
window = {
border = 'rounded',
},
},
-- Completion configuration
completion = {
accept = {
-- Auto-insert brackets for functions
auto_brackets = {
enabled = true,
},
},
menu = {
draw = {
columns = {
{ 'label', 'label_description', gap = 1 },
{ 'kind_icon', 'kind' }
},
},
border = 'rounded',
winblend = 0,
},
documentation = {
auto_show = true,
auto_show_delay_ms = 200,
window = {
border = 'rounded',
},
},
ghost_text = {
enabled = true,
},
},
-- Fuzzy matching configuration
fuzzy = {
-- Use Rust implementation for better performance
implementation = 'prefer_rust_with_warning',
-- Allow typos based on keyword length
max_typos = function(keyword)
return math.floor(#keyword / 4)
end,
-- Track frequently/recently used items
use_frecency = true,
-- Boost items matching nearby words
use_proximity = true,
-- Prebuilt binaries configuration
prebuilt_binaries = {
download = true,
},
},
-- Snippet configuration
snippets = {
expand = function(snippet)
-- Use native snippet expansion if available
if vim.snippet then
vim.snippet.expand(snippet)
else
-- Fallback to basic expansion
local insert = string.gsub(snippet, '%$%d+', '')
vim.api.nvim_put({ insert }, 'c', true, true)
end
end,
},
})
end
return M

View File

@ -0,0 +1,158 @@
-- Debug Adapters Configuration
local M = {}
-- Helper function to find Python executable
-- In Nix environments, use whatever Python is in PATH
local function get_python_path()
-- Use the Python from current environment (Nix or system)
if vim.fn.executable('python3') == 1 then
return vim.fn.exepath('python3')
elseif vim.fn.executable('python') == 1 then
return vim.fn.exepath('python')
else
-- Fallback to system Python
return '/usr/bin/python3'
end
end
function M.setup()
local dap = require('dap')
-- Setup all language-specific adapters
M.setup_python(dap)
M.setup_cpp(dap)
-- Add more adapters as needed
-- M.setup_rust(dap)
-- M.setup_go(dap)
-- M.setup_javascript(dap)
end
-- Python debugger configuration
function M.setup_python(dap)
dap.adapters.python = {
type = 'executable',
command = vim.fn.exepath('python3') ~= '' and vim.fn.exepath('python3') or 'python',
args = { '-m', 'debugpy.adapter' },
}
dap.configurations.python = {
{
type = 'python',
request = 'launch',
name = 'Launch file',
program = '${file}',
pythonPath = get_python_path,
},
{
type = 'python',
request = 'launch',
name = 'Launch file with arguments',
program = '${file}',
args = function()
local args_string = vim.fn.input('Arguments: ')
return vim.split(args_string, ' ')
end,
pythonPath = get_python_path,
},
{
type = 'python',
request = 'attach',
name = 'Attach to running process',
processId = require('dap.utils').pick_process,
pythonPath = get_python_path,
},
}
end
-- C/C++/Rust debugger configuration (using codelldb)
function M.setup_cpp(dap)
-- CodeLLDB adapter
dap.adapters.codelldb = {
type = 'server',
port = '${port}',
executable = {
command = 'codelldb',
args = { '--port', '${port}' },
},
}
-- Alternative: Use lldb-vscode if codelldb is not available
dap.adapters.lldb = {
type = 'executable',
command = '/usr/bin/lldb-vscode', -- Adjust path as needed
name = 'lldb',
}
-- C++ configuration
dap.configurations.cpp = {
{
name = 'Launch',
type = 'codelldb',
request = 'launch',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = {},
runInTerminal = false,
},
{
name = 'Launch with arguments',
type = 'codelldb',
request = 'launch',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = function()
local args_string = vim.fn.input('Arguments: ')
return vim.split(args_string, ' ')
end,
runInTerminal = false,
},
{
name = 'Attach to process',
type = 'codelldb',
request = 'attach',
pid = require('dap.utils').pick_process,
args = {},
},
}
-- Share C++ configuration with C and Rust
dap.configurations.c = dap.configurations.cpp
dap.configurations.rust = dap.configurations.cpp
end
-- Example: Go debugger configuration (commented out)
-- function M.setup_go(dap)
-- dap.adapters.delve = {
-- type = 'server',
-- port = '${port}',
-- executable = {
-- command = 'dlv',
-- args = { 'dap', '-l', '127.0.0.1:${port}' },
-- },
-- }
--
-- dap.configurations.go = {
-- {
-- type = 'delve',
-- name = 'Debug',
-- request = 'launch',
-- program = '${file}',
-- },
-- {
-- type = 'delve',
-- name = 'Debug test',
-- request = 'launch',
-- mode = 'test',
-- program = '${file}',
-- },
-- }
-- end
return M

View File

@ -0,0 +1,38 @@
-- Debug Configuration (DAP)
local M = {}
function M.setup()
local dap = require('dap')
local dapui = require('dapui')
-- Setup DAP UI with icons and controls
dapui.setup({
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '',
play = '',
step_into = '',
step_over = '',
step_out = '',
step_back = 'b',
run_last = '▶▶',
terminate = '',
disconnect = '',
},
},
})
-- Automatically open/close DAP UI on debug events
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close
-- Configure debug adapters for different languages
require('plugins.config.debug.adapters').setup()
-- Setup debug keymaps
require('plugins.config.debug.keymaps').setup()
end
return M

View File

@ -0,0 +1,59 @@
-- Debug Keymaps Configuration
local M = {}
function M.setup()
local dap = require('dap')
local dapui = require('dapui')
-- Function key mappings for common debug operations
vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' })
vim.keymap.set('n', '<F10>', dap.step_over, { desc = 'Debug: Step Over' })
vim.keymap.set('n', '<F11>', dap.step_into, { desc = 'Debug: Step Into' })
vim.keymap.set('n', '<F12>', dap.step_out, { desc = 'Debug: Step Out' })
-- Breakpoint management
vim.keymap.set('n', '<leader>db', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' })
vim.keymap.set('n', '<leader>dB', function()
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end, { desc = 'Debug: Set Conditional Breakpoint' })
vim.keymap.set('n', '<leader>lp', function()
dap.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))
end, { desc = 'Debug: Set Log Point' })
-- DAP UI controls
vim.keymap.set('n', '<F7>', dapui.toggle, { desc = 'Debug: Toggle UI' })
vim.keymap.set('n', '<leader>de', dapui.eval, { desc = 'Debug: Eval under cursor' })
vim.keymap.set('v', '<leader>de', dapui.eval, { desc = 'Debug: Eval selection' })
-- REPL and additional features
vim.keymap.set('n', '<leader>dr', dap.repl.open, { desc = 'Debug: Open REPL' })
vim.keymap.set('n', '<leader>dl', dap.run_last, { desc = 'Debug: Run Last' })
-- Widget-based inspections
vim.keymap.set('n', '<leader>dh', function()
require('dap.ui.widgets').hover()
end, { desc = 'Debug: Hover Variables' })
vim.keymap.set('n', '<leader>ds', function()
local widgets = require('dap.ui.widgets')
widgets.centered_float(widgets.scopes)
end, { desc = 'Debug: View Scopes' })
vim.keymap.set('n', '<leader>df', function()
local widgets = require('dap.ui.widgets')
widgets.centered_float(widgets.frames)
end, { desc = 'Debug: View Frames' })
-- Session management
vim.keymap.set('n', '<leader>dt', dap.terminate, { desc = 'Debug: Terminate Session' })
vim.keymap.set('n', '<leader>dc', dap.run_to_cursor, { desc = 'Debug: Continue to Cursor' })
-- Create visual indicators for breakpoints
vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = 'DapBreakpoint', linehl = '', numhl = '' })
vim.fn.sign_define('DapBreakpointCondition', { text = '🟡', texthl = 'DapBreakpoint', linehl = '', numhl = '' })
vim.fn.sign_define('DapBreakpointRejected', { text = '', texthl = 'DapBreakpoint', linehl = '', numhl = '' })
vim.fn.sign_define('DapLogPoint', { text = '📝', texthl = 'DapLogPoint', linehl = '', numhl = '' })
vim.fn.sign_define('DapStopped', { text = '▶️', texthl = 'DapStopped', linehl = 'DapStopped', numhl = 'DapStopped' })
end
return M

View File

@ -0,0 +1,59 @@
-- Editor Enhancement Configuration
local M = {}
function M.setup_mini()
-- Better Around/Inside textobjects
require('mini.ai').setup { n_lines = 500 }
-- Add/delete/replace surroundings (brackets, quotes, etc.)
require('mini.surround').setup()
-- Simple and easy statusline
local statusline = require 'mini.statusline'
statusline.setup { use_icons = vim.g.have_nerd_font }
-- Custom statusline location section
---@diagnostic disable-next-line: duplicate-set-field
statusline.section_location = function()
return '%2l:%-2v'
end
end
function M.setup_illuminate()
require('illuminate').configure({
delay = 200,
large_file_cutoff = 2000,
large_file_overrides = {
providers = { 'lsp' },
},
providers = {
'lsp',
'treesitter',
'regex',
},
filetypes_denylist = {
'dirbuf',
'dirvish',
'fugitive',
'alpha',
'NvimTree',
'lazy',
'neogitstatus',
'Trouble',
'lir',
'Outline',
'spectre_panel',
'toggleterm',
'DressingSelect',
'TelescopePrompt',
},
under_cursor = true,
})
end
function M.setup()
M.setup_mini()
M.setup_illuminate()
end
return M

View File

@ -0,0 +1,69 @@
-- Git Configuration
local M = {}
function M.setup_gitsigns()
require('gitsigns').setup({
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
on_attach = function(bufnr)
local gitsigns = require('gitsigns')
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']c', function()
if vim.wo.diff then
vim.cmd.normal({']c', bang = true})
else
gitsigns.nav_hunk('next')
end
end, { desc = 'Jump to next git [c]hange' })
map('n', '[c', function()
if vim.wo.diff then
vim.cmd.normal({'[c', bang = true})
else
gitsigns.nav_hunk('prev')
end
end, { desc = 'Jump to previous git [c]hange' })
-- Actions
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'Git [s]tage hunk' })
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'Git [r]eset hunk' })
map('v', '<leader>hs', function()
gitsigns.stage_hunk({vim.fn.line('.'), vim.fn.line('v')})
end, { desc = 'Git [s]tage hunk' })
map('v', '<leader>hr', function()
gitsigns.reset_hunk({vim.fn.line('.'), vim.fn.line('v')})
end, { desc = 'Git [r]eset hunk' })
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'Git [S]tage buffer' })
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'Git [u]ndo stage hunk' })
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'Git [R]eset buffer' })
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'Git [p]review hunk' })
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'Git [b]lame line' })
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'Git [d]iff against index' })
map('n', '<leader>hD', function()
gitsigns.diffthis('@')
end, { desc = 'Git [D]iff against last commit' })
-- Toggles
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
-- Text object
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'Select git hunk' })
end,
})
end
return M

View File

@ -0,0 +1,26 @@
-- LSP Configuration Module
local M = {}
function M.setup()
local lspconfig = require 'lspconfig'
-- Get capabilities from blink.cmp if available
local capabilities = {}
pcall(function()
capabilities = require('blink.cmp').get_lsp_capabilities()
end)
-- Load server configurations
local servers = require('plugins.config.lsp.servers').get_servers()
-- Setup each server with capabilities
for name, config in pairs(servers) do
config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, config.capabilities or {})
lspconfig[name].setup(config)
end
-- Setup LSP keymaps
require('plugins.config.lsp.keymaps').setup()
end
return M

View File

@ -0,0 +1,57 @@
-- LSP Keymaps Configuration
local M = {}
function M.setup()
-- Setup keymaps when LSP attaches to a buffer
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('lsp-attach-keymaps', { clear = true }),
callback = function(event)
-- Helper function to define keymaps
local map = function(keys, func, desc, mode)
mode = mode or 'n'
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
-- Navigation keymaps (using kickstart.nvim patterns)
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype definition')
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
-- Symbol operations
map('grn', vim.lsp.buf.rename, '[G]oto [R]e[n]ame')
map('gra', vim.lsp.buf.code_action, '[G]oto code [A]ction', { 'n', 'x' })
map('gO', require('telescope.builtin').lsp_document_symbols, '[G]oto [O]pen document symbols')
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[G]oto [W]orkspace symbols')
-- Documentation
map('K', vim.lsp.buf.hover, 'Hover Documentation')
-- Formatting
map('<leader>f', function()
vim.lsp.buf.format { async = true }
end, '[F]ormat buffer')
-- The following keymaps are available but not mapped by default:
-- vim.lsp.buf.signature_help - Show function signature help
-- vim.lsp.buf.add_workspace_folder - Add workspace folder
-- vim.lsp.buf.remove_workspace_folder - Remove workspace folder
-- vim.lsp.buf.list_workspace_folders - List workspace folders
-- Optional: Add a message when LSP attaches
local client = vim.lsp.get_client_by_id(event.data.client_id)
if client then
vim.notify('LSP attached: ' .. client.name, vim.log.levels.INFO)
end
end,
})
-- Diagnostic keymaps (available globally, not just when LSP attaches)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
end
return M

View File

@ -0,0 +1,88 @@
-- LSP Server Configurations
local M = {}
local util = require 'lspconfig.util'
-- Query driver for clangd to find compilers in various locations
local function get_clangd_query_driver()
return table.concat({
'/nix/store/*/bin/clang*',
'/opt/homebrew/opt/llvm/bin/clang*',
'/usr/bin/clang*',
}, ';')
end
-- Get clang resource directory
local function get_clang_resource_dir()
local ok, result = pcall(vim.fn.systemlist, { 'clang++', '--print-resource-dir' })
if ok and result and result[1] then
return result[1]
else
return '/usr/lib/clang/19/include' -- fallback
end
end
function M.get_servers()
return {
-- C/C++ Language Server
clangd = {
cmd = {
'clangd',
'--background-index',
'--clang-tidy',
'--header-insertion=never',
'--query-driver=' .. get_clangd_query_driver(),
'--compile-commands-dir=build',
'--resource-dir=' .. get_clang_resource_dir(),
},
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },
root_dir = util.root_pattern('CMakeLists.txt', '.git'),
single_file_support = true,
},
-- Python Language Server
pyright = {
settings = {
python = {
analysis = {
autoSearchPaths = true,
diagnosticMode = 'openFilesOnly',
useLibraryCodeForTypes = true,
typeCheckingMode = 'basic',
},
},
},
positionEncoding = 'utf-8',
},
-- Python Linter/Formatter
ruff = {},
-- Nix Language Server
nixd = {},
-- LaTeX Language Server
texlab = {},
-- CMake Language Server
cmake = {
cmd = { 'cmake-language-server' },
filetypes = { 'cmake' },
root_dir = util.root_pattern('CMakeLists.txt', '.git'),
},
-- Add more servers here as needed
-- Example:
-- rust_analyzer = {
-- settings = {
-- ['rust-analyzer'] = {
-- checkOnSave = {
-- command = 'clippy',
-- },
-- },
-- },
-- },
}
end
return M

View File

@ -0,0 +1,84 @@
-- Telescope Configuration
local M = {}
function M.setup()
local telescope = require('telescope')
local builtin = require('telescope.builtin')
telescope.setup({
defaults = {
prompt_prefix = '> ',
selection_caret = '> ',
path_display = { 'truncate' },
sorting_strategy = 'ascending',
layout_config = {
horizontal = {
prompt_position = 'top',
preview_width = 0.55,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
},
pickers = {
find_files = {
-- Use rg for finding files (ensure rg is installed via Nix/Home Manager)
find_command = { 'rg', '--files', '--hidden', '-g', '!.git' },
},
},
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
},
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = 'smart_case',
},
},
})
-- Load extensions
pcall(telescope.load_extension, 'fzf')
pcall(telescope.load_extension, 'ui-select')
-- Setup keymaps
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
-- Fuzzy search in current buffer
vim.keymap.set('n', '<leader>/', function()
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer' })
-- Search in open files
vim.keymap.set('n', '<leader>s/', function()
builtin.live_grep {
grep_open_files = true,
prompt_title = 'Live Grep in Open Files',
}
end, { desc = '[S]earch [/] in Open Files' })
-- Search in neovim config
vim.keymap.set('n', '<leader>sn', function()
builtin.find_files { cwd = vim.fn.stdpath 'config' }
end, { desc = '[S]earch [N]eovim files' })
end
return M

57
lua/plugins/config/ui.lua Normal file
View File

@ -0,0 +1,57 @@
-- UI Configuration
local M = {}
function M.setup_which_key()
local wk = require 'which-key'
wk.setup({
delay = 0,
icons = {
mappings = vim.g.have_nerd_font,
keys = vim.g.have_nerd_font and {} or {
Up = '<Up> ',
Down = '<Down> ',
Left = '<Left> ',
Right = '<Right> ',
C = '<C-…> ',
M = '<M-…> ',
D = '<D-…> ',
S = '<S-…> ',
CR = '<CR> ',
Esc = '<Esc> ',
ScrollWheelDown = '<ScrollWheelDown> ',
ScrollWheelUp = '<ScrollWheelUp> ',
NL = '<NL> ',
BS = '<BS> ',
Space = '<Space> ',
Tab = '<Tab> ',
F1 = '<F1>',
F2 = '<F2>',
F3 = '<F3>',
F4 = '<F4>',
F5 = '<F5>',
F6 = '<F6>',
F7 = '<F7>',
F8 = '<F8>',
F9 = '<F9>',
F10 = '<F10>',
F11 = '<F11>',
F12 = '<F12>',
},
},
})
-- Document existing key chains
wk.add {
{ '<leader>c', group = '[C]ode' },
{ '<leader>d', group = '[D]ocument/[D]ebug' },
{ '<leader>r', group = '[R]ename' },
{ '<leader>s', group = '[S]earch' },
{ '<leader>w', group = '[W]orkspace' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>g', group = '[G]it' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
}
end
return M

View File

@ -0,0 +1,24 @@
-- Auto-pairs - Automatically close brackets, quotes, etc.
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
opts = {
check_ts = true,
ts_config = {
lua = { 'string', 'source' },
javascript = { 'string', 'template_string' },
},
disable_filetype = { 'TelescopePrompt', 'spectre_panel' },
fast_wrap = {
map = '<M-e>',
chars = { '{', '[', '(', '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], '%s+', ''),
offset = 0,
end_key = '$',
keys = 'qwertyuiopzxcvbnmasdfghjkl',
check_comma = true,
highlight = 'PmenuSel',
highlight_grey = 'LineNr',
},
},
}

View File

@ -0,0 +1,12 @@
-- Blink.cmp - Modern completion plugin
return {
'saghen/blink.cmp',
lazy = false, -- Lazy loading handled internally
dependencies = {
'giuxtaposition/blink-cmp-copilot',
},
version = 'v0.*', -- Use stable releases
config = function()
require('plugins.config.blink').setup()
end,
}

View File

@ -0,0 +1,21 @@
-- GitHub Copilot integration
return {
'zbirenbaum/copilot.lua',
cmd = 'Copilot',
event = 'InsertEnter',
opts = {
suggestion = { enabled = false }, -- Disable inline ghost text (handled by blink.cmp)
panel = { enabled = false }, -- Disable panel view
filetypes = {
yaml = false,
markdown = false,
help = false,
gitcommit = false,
gitrebase = false,
hgcommit = false,
svn = false,
cvs = false,
['.'] = false,
},
},
}

View File

@ -0,0 +1,20 @@
-- Debug Adapter Protocol (DAP) support
return {
'mfussenegger/nvim-dap',
dependencies = {
-- DAP UI
{
'rcarriga/nvim-dap-ui',
dependencies = { 'nvim-neotest/nvim-nio' },
},
-- Virtual text for debugging
{
'theHamsta/nvim-dap-virtual-text',
opts = {},
},
},
config = function()
require('plugins.config.debug').setup()
end,
}

View File

@ -0,0 +1,36 @@
-- Editor enhancement plugins
return {
-- Collection of various small independent plugins/modules
{
'echasnovski/mini.nvim',
config = function()
require('plugins.config.editor').setup_mini()
end,
},
-- Highlight, edit, and navigate code
{
'nvim-treesitter/nvim-treesitter-textobjects',
event = 'VeryLazy',
dependencies = { 'nvim-treesitter/nvim-treesitter' },
},
-- Detect tabstop and shiftwidth automatically
{ 'tpope/vim-sleuth' },
-- Comment plugin
{
'numToStr/Comment.nvim',
event = 'VeryLazy',
opts = {},
},
-- Highlight word under cursor
{
'RRethy/vim-illuminate',
event = { 'BufReadPost', 'BufNewFile' },
config = function()
require('plugins.config.editor').setup_illuminate()
end,
},
}

26
lua/plugins/spec/git.lua Normal file
View File

@ -0,0 +1,26 @@
-- Git integration plugins
return {
-- Fugitive - Git integration
{
'tpope/vim-fugitive',
cmd = { 'Git', 'G', 'Gdiff', 'Gread', 'Gwrite', 'Ggrep', 'GMove', 'GDelete', 'GBrowse', 'GRemove' },
keys = {
{ '<leader>gs', '<cmd>Git<cr>', desc = 'Git status' },
{ '<leader>gd', '<cmd>Gdiff<cr>', desc = 'Git diff' },
{ '<leader>gc', '<cmd>Git commit<cr>', desc = 'Git commit' },
{ '<leader>gb', '<cmd>Git blame<cr>', desc = 'Git blame' },
{ '<leader>gl', '<cmd>Git log<cr>', desc = 'Git log' },
{ '<leader>gp', '<cmd>Git push<cr>', desc = 'Git push' },
{ '<leader>gf', '<cmd>Git fetch<cr>', desc = 'Git fetch' },
},
},
-- Gitsigns - Git gutter and hunk operations
{
'lewis6991/gitsigns.nvim',
event = 'VeryLazy',
config = function()
require('plugins.config.git').setup_gitsigns()
end,
},
}

View File

@ -0,0 +1,33 @@
-- Indent guides - Show vertical lines at indentation levels
return {
'lukas-reineke/indent-blankline.nvim',
event = { 'BufReadPost', 'BufNewFile' },
main = 'ibl',
opts = {
indent = {
char = '',
tab_char = '',
},
scope = {
enabled = true,
show_start = true,
show_end = false,
injected_languages = false,
highlight = { 'Function', 'Label' },
},
exclude = {
filetypes = {
'help',
'alpha',
'dashboard',
'neo-tree',
'Trouble',
'lazy',
'mason',
'notify',
'toggleterm',
'lazyterm',
},
},
},
}

25
lua/plugins/spec/init.lua Normal file
View File

@ -0,0 +1,25 @@
-- Main plugin loader - imports all plugin specifications
return {
-- UI and Theme
{ import = 'plugins.spec.ui' },
{ import = 'plugins.spec.editor' },
{ import = 'plugins.spec.autopairs' },
{ import = 'plugins.spec.indent-line' },
-- Core functionality
{ import = 'plugins.spec.lsp' },
{ import = 'plugins.spec.treesitter' },
{ import = 'plugins.spec.telescope' },
{ import = 'plugins.spec.blink' },
-- Git integration
{ import = 'plugins.spec.git' },
-- Development tools
{ import = 'plugins.spec.copilot' },
{ import = 'plugins.spec.debug' },
{ import = 'plugins.spec.formatting' },
-- Navigation
{ import = 'plugins.spec.nvim-tmux-navigator' },
}

26
lua/plugins/spec/lsp.lua Normal file
View File

@ -0,0 +1,26 @@
-- LSP Plugin Specification
return {
{
'neovim/nvim-lspconfig',
event = { 'BufReadPost', 'BufNewFile' },
dependencies = {
{ 'j-hui/fidget.nvim', opts = {} },
'folke/lazydev.nvim',
},
config = function()
require('plugins.config.lsp').setup()
end,
},
-- LazyDev for better Neovim Lua development
{
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
},
}

View File

@ -0,0 +1,11 @@
-- Tmux navigation integration
return {
'christoomey/vim-tmux-navigator',
keys = {
{ '<C-h>', ':TmuxNavigateLeft<CR>', desc = 'Navigate to left tmux pane' },
{ '<C-j>', ':TmuxNavigateDown<CR>', desc = 'Navigate to down tmux pane' },
{ '<C-k>', ':TmuxNavigateUp<CR>', desc = 'Navigate to up tmux pane' },
{ '<C-l>', ':TmuxNavigateRight<CR>', desc = 'Navigate to right tmux pane' },
{ '<C-\\>', ':TmuxNavigatePrevious<CR>', desc = 'Navigate to previous tmux pane' },
},
}

View File

@ -0,0 +1,21 @@
-- Telescope - Fuzzy finder
return {
'nvim-telescope/telescope.nvim',
event = 'VimEnter',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
},
{ 'nvim-telescope/telescope-ui-select.nvim' },
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
},
config = function()
require('plugins.config.telescope').setup()
end,
}

View File

@ -0,0 +1,45 @@
-- Treesitter - Syntax highlighting and text objects
return {
'nvim-treesitter/nvim-treesitter',
event = { 'BufReadPost', 'BufNewFile' },
build = ':TSUpdate',
main = 'nvim-treesitter.configs',
opts = {
ensure_installed = {
'bash',
'c',
'cmake',
'cpp',
'diff',
'html',
'lua',
'luadoc',
'make',
'markdown',
'markdown_inline',
'nix',
'python',
'query',
'vim',
'vimdoc',
'yaml',
},
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = false,
node_decremental = '<bs>',
},
},
},
}

29
lua/plugins/spec/ui.lua Normal file
View File

@ -0,0 +1,29 @@
-- UI and Theme plugins
return {
-- Color scheme
{
'folke/tokyonight.nvim',
priority = 1000,
init = function()
vim.cmd.colorscheme 'tokyonight-night'
vim.cmd.hi 'Comment gui=none'
end,
},
-- Which-key for keybind hints
{
'folke/which-key.nvim',
event = 'VimEnter',
config = function()
require('plugins.config.ui').setup_which_key()
end,
},
-- Todo comments highlighting
{
'folke/todo-comments.nvim',
event = 'VimEnter',
dependencies = { 'nvim-lua/plenary.nvim' },
opts = { signs = false }
},
}