diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e033bc6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +lazy-lock.json diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..b9af04c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,70 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Overview + +Personal Neovim configuration using [lazy.nvim](https://github.com/folke/lazy.nvim) as the plugin manager. All Lua code lives under the `holger` namespace in `lua/holger/`. + +## Architecture + +**Entry point:** `init.lua` loads two modules: +- `holger.core` — Neovim options and keymaps (`lua/holger/core/`) +- `holger.lazy` — bootstraps lazy.nvim and loads all plugins + +**Plugin loading:** `lua/holger/lazy.lua` calls `require("lazy").setup()` with two import paths: +- `holger.plugins` — all files in `lua/holger/plugins/` (each returns a lazy.nvim spec table) +- `holger.plugins.lsp` — files in `lua/holger/plugins/lsp/` + +**Adding a plugin:** Create a new file in `lua/holger/plugins/` that returns a lazy.nvim spec table. It will be auto-imported. + +## Key Configuration + +- **Leader key:** `` +- **Colorscheme:** catppuccin +- **Indentation:** 2 spaces, expandtab + +## LSP Stack + +- `mason.nvim` — installs LSP servers and tools +- `mason-lspconfig.nvim` — bridges Mason with nvim-lspconfig; auto-installs: `ts_ls`, `html`, `cssls`, `tailwindcss`, `lua_ls`, `pyright`, `eslint` +- `mason-tool-installer.nvim` — installs formatters/linters: `prettier`, `stylua`, `isort`, `black`, `pylint`, `eslint_d` +- `cmp-nvim-lsp` (`lua/holger/plugins/lsp/lspconfig.lua`) — sets up capabilities via `vim.lsp.config("*", ...)` (native Neovim LSP API) + +## Formatting & Linting + +- **conform.nvim** — formats on save; `mp` to format manually + - JS/TS/CSS/HTML/JSON/YAML/Markdown/GraphQL → prettier + - Lua → stylua + - Python → isort + black +- **nvim-lint** — lints on BufEnter/BufWritePost/InsertLeave; `l` to trigger manually + - Python → pylint + +## Key Keymaps + +| Key | Action | +|-----|--------| +| `jk` (insert) | Exit insert mode | +| `ee` | Toggle nvim-tree file explorer | +| `ef` | Toggle explorer on current file | +| `ff` | Telescope find files | +| `fs` | Telescope live grep | +| `fr` | Telescope recent files | +| `fc` | Grep string under cursor | +| `s` / `S` | Flash jump / Flash treesitter jump | +| `mp` | Format file (conform) | +| `l` | Trigger linting | +| `sv/sh` | Split window vertical/horizontal | +| `nh` | Clear search highlights | + +## Notable Plugins + +- **telescope.nvim** — fuzzy finder with fzf-native extension +- **nvim-treesitter** — syntax highlighting and incremental selection (``) +- **nvim-cmp** — completion engine with LuaSnip snippets and LSP/buffer/path sources +- **flash.nvim** — enhanced motion with jump labels; integrated into `/` search +- **neorg** — note-taking, workspace at `~/notes` +- **auto-session** — automatic session save/restore +- **which-key** — displays keybinding hints +- **fugitive** — Git integration +- **trouble.nvim** — diagnostics list diff --git a/init.lua b/init.lua index ca37cd7..8b95921 100644 --- a/init.lua +++ b/init.lua @@ -1,2 +1,3 @@ require("holger.core") require("holger.lazy") +require("holger.lsp") diff --git a/lua/holger/core/options.lua b/lua/holger/core/options.lua index 97612e8..b213322 100644 --- a/lua/holger/core/options.lua +++ b/lua/holger/core/options.lua @@ -34,3 +34,5 @@ opt.clipboard:append("unnamedplus") -- use system clipboard as default register -- split windows opt.splitright = true -- split vertical window to the right opt.splitbelow = true -- split horiziontal window to the bottom + +opt.timeoutlen = 500 -- time to wait for a mapped sequence to complete (ms) diff --git a/lua/holger/lazy.lua b/lua/holger/lazy.lua index 63020d9..277c4f4 100644 --- a/lua/holger/lazy.lua +++ b/lua/holger/lazy.lua @@ -1,5 +1,5 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then +if not vim.uv.fs_stat(lazypath) then vim.fn.system({ "git", "clone", diff --git a/lua/holger/plugins/auto-session.lua b/lua/holger/plugins/auto-session.lua index 64a062b..93fda32 100644 --- a/lua/holger/plugins/auto-session.lua +++ b/lua/holger/plugins/auto-session.lua @@ -4,8 +4,8 @@ return { local auto_session = require("auto-session") auto_session.setup({ - auto_restore_enabled = false, - auto_session_suppress_dirs = { "~/", "~/Dev/", "~/Downloads", "~/Documents", "~/Desktop/" }, + auto_restore = false, + suppressed_dirs = { "~/", "~/Dev/", "~/Downloads", "~/Documents", "~/Desktop/" }, }) local keymap = vim.keymap diff --git a/lua/holger/plugins/comment.lua b/lua/holger/plugins/comment.lua deleted file mode 100644 index ecc93c4..0000000 --- a/lua/holger/plugins/comment.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - "numToStr/Comment.nvim", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - "JoosepAlviste/nvim-ts-context-commentstring", - }, - config = function() - -- import comment plugin safely - local comment = require("Comment") - - local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim") - - -- enable comment - comment.setup({ - -- for commenting tsx, jsx, svelte, html files - pre_hook = ts_context_commentstring.create_pre_hook(), - }) - end, -} diff --git a/lua/holger/plugins/linting.lua b/lua/holger/plugins/linting.lua index 9614883..4527149 100644 --- a/lua/holger/plugins/linting.lua +++ b/lua/holger/plugins/linting.lua @@ -10,47 +10,8 @@ return { local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) - local function file_in_cwd(file_name) - return vim.fs.find(file_name, { - upward = true, - stop = vim.loop.cwd():match("(.+)/"), - path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)), - type = "file", - })[1] - end - - local function remove_linter(linters, linter_name) - for k, v in pairs(linters) do - if v == linter_name then - linters[k] = nil - break - end - end - end - - local function linter_in_linters(linters, linter_name) - for k, v in pairs(linters) do - if v == linter_name then - return true - end - end - return false - end - - local function remove_linter_if_missing_config_file(linters, linter_name, config_file_name) - if linter_in_linters(linters, linter_name) and not file_in_cwd(config_file_name) then - remove_linter(linters, linter_name) - end - end - local function try_linting() local linters = lint.linters_by_ft[vim.bo.filetype] - - -- if linters then - -- -- remove_linter_if_missing_config_file(linters, "eslint_d", ".eslintrc.cjs") - -- remove_linter_if_missing_config_file(linters, "eslint_d", "eslint.config.js") - -- end - lint.try_lint(linters) end diff --git a/lua/holger/plugins/lualine.lua b/lua/holger/plugins/lualine.lua index 3698644..16e6671 100644 --- a/lua/holger/plugins/lualine.lua +++ b/lua/holger/plugins/lualine.lua @@ -14,6 +14,7 @@ return { fg = "#c3ccdc", bg = "#112638", inactive_bg = "#2c3043", + semilightgray = "#6c7a9c", } local my_lualine_theme = { diff --git a/lua/holger/plugins/neorg.lua b/lua/holger/plugins/neorg.lua index c20d3b6..b00d02b 100644 --- a/lua/holger/plugins/neorg.lua +++ b/lua/holger/plugins/neorg.lua @@ -1,6 +1,6 @@ return { "nvim-neorg/neorg", - lazy = false, -- load immediately + ft = "norg", version = "*", -- latest stable release dependencies = { "nvim-lua/plenary.nvim" }, -- Neorg requires plenary config = function() diff --git a/lua/holger/plugins/substitute.lua b/lua/holger/plugins/substitute.lua index 852cc82..dcb958a 100644 --- a/lua/holger/plugins/substitute.lua +++ b/lua/holger/plugins/substitute.lua @@ -7,8 +7,6 @@ return { substitute.setup() -- set keymaps - local keymap = vim.keymap -- for conciseness - vim.keymap.set("n", "r", substitute.operator, { desc = "Substitute with motion" }) vim.keymap.set("n", "rr", substitute.line, { desc = "Substitute line" }) vim.keymap.set("n", "R", substitute.eol, { desc = "Substitute to end of line" }) diff --git a/lua/holger/plugins/which-key.lua b/lua/holger/plugins/which-key.lua index d004051..9ddfba1 100644 --- a/lua/holger/plugins/which-key.lua +++ b/lua/holger/plugins/which-key.lua @@ -1,10 +1,6 @@ return { "folke/which-key.nvim", event = "VeryLazy", - init = function() - vim.o.timeout = true - vim.o.timeoutlen = 500 - end, opts = { -- your configuration comes here -- or leave it empty to use the default settings