diff --git a/.gitignore b/.gitignore index 005b535b..8a192cab 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ test.sh nvim spell/ -lazy-lock.json diff --git a/WARP.md b/WARP.md new file mode 100644 index 00000000..725135f8 --- /dev/null +++ b/WARP.md @@ -0,0 +1,119 @@ +# WARP.md + +This file provides guidance to WARP (warp.dev) when working with code in this repository. + +## Overview + +This is a Neovim configuration based on kickstart.nvim - a minimal, single-file starter configuration designed to be fully understood and customized. The configuration uses the Lazy.nvim plugin manager and focuses on LSP-based development with modern tooling. + +## Key Commands + +### Plugin Management +- View plugins: `:Lazy` +- Update plugins: `:Lazy update` +- Check health: `:checkhealth` + +### LSP and Development +- Install/manage language servers: `:Mason` +- Format buffer: `f` (uses conform.nvim) +- View diagnostics: `:Telescope diagnostics` or `sd` +- Lint: Configured via nvim-lint (runs automatically on BufEnter, BufWritePost, InsertLeave) + +### Testing and Linting +- Format Lua: Uses `stylua` (configured in `.stylua.toml`) + - Column width: 160 + - Single quotes preferred + - No call parentheses + - 2 space indent + +### Telescope (Fuzzy Finder) +- Search files: `sf` +- Search help: `sh` +- Search keymaps: `sk` +- Live grep: `sg` +- Search word: `sw` +- Search Neovim files: `sn` +- Find buffers: `` + +## Architecture + +### Configuration Structure +- **init.lua**: Single-file configuration containing all core settings, keymaps, and plugin setup +- **lua/kickstart/**: Optional kickstart plugins (debug, lint, neo-tree, autopairs, indent_line, gitsigns) + - These are NOT loaded by default - must be explicitly required in init.lua +- **lua/custom/plugins/**: Directory for user-added custom plugins + - Plugins placed here are automatically loaded if `{ import = 'custom.plugins' }` is uncommented in init.lua + +### Plugin Management +Uses Lazy.nvim as the plugin manager. Lazy automatically clones itself on first run if not present. Plugin specifications are defined in the `require('lazy').setup({})` call in init.lua. + +### LSP Configuration +- **mason.nvim**: Automatic installation of LSP servers and tools +- **mason-lspconfig.nvim**: Bridges Mason and lspconfig +- **mason-tool-installer.nvim**: Ensures required tools are installed +- **nvim-lspconfig**: Core LSP configuration +- **blink.cmp**: Autocompletion with LSP integration +- **LuaSnip**: Snippet engine + +LSP servers are defined in the `servers` table in init.lua. Currently only `lua_ls` is configured. Add servers by editing this table. + +### Formatting and Linting +- **conform.nvim**: Format on save (disabled for C/C++ by default) +- **nvim-lint**: Linting framework (configure linters in lua/kickstart/plugins/lint.lua) + +### Key Integrations +- **Telescope**: Fuzzy finder for files, LSP symbols, diagnostics, etc. +- **Treesitter**: Syntax highlighting and code understanding +- **gitsigns**: Git integration in gutter +- **which-key**: Displays pending keybinds +- **mini.nvim**: Multiple small utilities (statusline, surround, text objects) + +### Leader Key +Space is configured as the leader key (``). All leader-based keymaps follow mnemonic patterns: +- `s*`: Search commands +- `t*`: Toggle commands +- `h*`: Git hunk operations + +### Completion +Uses blink.cmp with default preset: +- `` to accept completion +- `` to open menu/docs +- `/` or `/` to navigate +- `/` for snippet navigation + +## Development Guidelines + +### Adding New Language Support +1. Add LSP server to `servers` table in init.lua (line ~673) +2. Add server name to `ensure_installed` if auto-install is desired (line ~716) +3. Configure formatter in `formatters_by_ft` table (line ~769) +4. Add linter configuration in lua/kickstart/plugins/lint.lua if needed + +### Adding Plugins +Two approaches: +1. **Quick**: Add to the plugin list in `require('lazy').setup({})` in init.lua +2. **Organized**: Create a new file in `lua/custom/plugins/` and uncomment the import line in init.lua (~987) + +### Optional Features +Kickstart includes optional plugins that must be explicitly required: +- Debug Adapter Protocol (DAP): `require 'kickstart.plugins.debug'` +- Linting: `require 'kickstart.plugins.lint'` +- Neo-tree file explorer: `require 'kickstart.plugins.neo-tree'` +- Auto-pairs: `require 'kickstart.plugins.autopairs'` +- Indent line: `require 'kickstart.plugins.indent_line'` +- Gitsigns keymaps: `require 'kickstart.plugins.gitsigns'` + +### Configuration Philosophy +This is NOT a distribution - it's a starting point. The entire configuration is in init.lua by design so you can read and understand every line. As you learn, you may want to split it into modules using the `lua/custom/` directory. + +### Nerd Font +Set `vim.g.have_nerd_font = true` in init.lua (line 94) if you have a Nerd Font installed for proper icon display. + +## Important Notes + +- The configuration targets Neovim stable and nightly versions only +- lazy-lock.json is gitignored in this repo but recommended to track in forks +- Leader key must be set before plugins load (currently done on line 90-91) +- All keymaps use `vim.keymap.set()` - see `:help vim.keymap.set()` +- LSP keymaps are only set when LSP attaches to a buffer +- Diagnostic configuration is at line ~631 with severity sorting and custom signs diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000..b8883fe0 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,23 @@ +{ + "LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" }, + "blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" }, + "conform.nvim": { "branch": "master", "commit": "238f542a118984a88124fc915d5b981680418707" }, + "fidget.nvim": { "branch": "main", "commit": "64463022a1f2ff1318ab22a2ea4125ed9313a483" }, + "gitsigns.nvim": { "branch": "main", "commit": "42d6aed4e94e0f0bbced16bbdcc42f57673bd75e" }, + "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "fe661093f4b05136437b531e7f959af2a2ae66c8" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, + "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, + "mini.nvim": { "branch": "main", "commit": "8dccba88fc4dce006ca0ad668067c9e0d5ce7702" }, + "nvim-lspconfig": { "branch": "master", "commit": "92ee7d42320edfbb81f3cad851314ab197fa324a" }, + "nvim-treesitter": { "branch": "main", "commit": "5a7e5638e7d220575b1c22c8a2e099b52231886e" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "a8c2223ea6b185701090ccb1ebc7f4e41c4c9784" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, + "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } +}