Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ spell/
# lazy-lock.json in version control - see https://lazy.folke.io/usage/lockfile
# For the official `nvim-lua/kickstart.nvim` git repository, we leave it ignored to avoid unneeded
# merge conflicts.
lazy-lock.json
# lazy-lock.json

.DS_Store
173 changes: 173 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# AGENTS.md

Agent-facing contributor guide for this Neovim config repository.

## Repository Snapshot

- Project type: personal/forked `kickstart.nvim` configuration.
- Primary language: Lua.
- Entry point: `init.lua`.
- Additional modules: `lua/custom/**` and `lua/kickstart/**`.
- Plugin manager: `lazy.nvim`.
- Lockfile: `lazy-lock.json` (tracks plugin versions).

## Sources Used For This Guide

- `README.md`
- `.stylua.toml`
- `init.lua`
- `lua/custom/**/*.lua`
- `lua/kickstart/**/*.lua`

## Cursor/Copilot Rules

- No `.cursorrules` file found.
- No `.cursor/rules/` directory found.
- No `.github/copilot-instructions.md` found.
- Therefore: follow this `AGENTS.md` + existing repository conventions.

## Environment and Prerequisites

- Neovim target: latest stable or nightly (README states this explicitly).
- External tools commonly expected:
- `git`, `make`, `unzip`, `rg` (checked by `lua/kickstart/health.lua`).
- Often useful: `fd`, `tree-sitter` CLI.
- Formatters used by config: `stylua`, `prettier`, `bean-format`.
- If tooling is missing, prefer graceful degradation over hard failure.

## Build / Lint / Test Commands

This repo is a config repo, so "build" and "test" are mostly lint/health/smoke checks.

## Quick Command Matrix

- Full format check:
- `stylua --check .`
- Apply Lua formatting:
- `stylua .`
- Sync/install plugins headlessly:
- `nvim --headless "+Lazy! sync" +qa`
- Run kickstart health checks headlessly:
- `nvim --headless "+checkhealth kickstart" +qa`
- Open once for runtime/plugin errors (manual smoke):
- `nvim`

## Single-Test Guidance (Important)

There is no formal unit-test framework (no `busted`, `plenary` test suite, `make test`, etc.).

Use one of these "single check" equivalents when you need narrow validation:

- Single file syntax check (if Lua compiler available):
- `luac -p path/to/file.lua`
- Single module load check in Neovim:
- `nvim --headless "+lua require('custom.plugins.opencode')" +qa`
- Replace module path as needed.
- Single feature health check:
- `nvim --headless "+checkhealth kickstart" +qa`
- Read only the section relevant to your change.

If a task asks for "run one test", use a module-load or syntax check above and report it as a targeted smoke test.

## Validation Order For Agents

When making code changes, run checks in this order unless task says otherwise:

1. `stylua --check .`
2. Targeted module/syntax check for changed file(s).
3. `nvim --headless "+checkhealth kickstart" +qa` for broader sanity.

If a command is unavailable locally, state it clearly and provide the exact command for humans/CI.
If a command is unavailable locally, state it clearly and provide the exact command for the local machine.

## Code Style: Formatting

Formatting rules are authoritative in `.stylua.toml`:

- Indentation: 2 spaces.
- Max column width: 160.
- Line endings: Unix.
- Quote style: `AutoPreferSingle` (prefer single quotes).
- Call parentheses: `None` where valid (`require 'x'` style).
- Collapse simple statements: always.

Never hand-format against Stylua output; run Stylua instead.

## Code Style: Imports and Module Structure

- Prefer local requires near first use:
- `local builtin = require 'telescope.builtin'`
- For plugin specs, return a Lua table from module root:
- `return { ... }`
- Keep plugin declarations declarative (`opts`) unless imperative setup is necessary (`config = function() ... end`).
- In `init.lua`, follow existing kickstart ordering and comment style.
- Avoid introducing new top-level globals.

## Code Style: Types and Annotations

This repo uses LuaLS annotations heavily. Preserve and extend when useful:

- `---@module 'lazy'`
- `---@type LazySpec`
- Plugin-specific types where available (e.g. `Gitsigns.Config`, `conform.setupOpts`).
- Use `---@diagnostic disable-next-line: ...` only when justified and narrowly scoped.

Do not remove useful annotations just to reduce lines.

## Code Style: Naming Conventions

- Modules/files:
- lower_snake_case for filenames where practical.
- plugin files grouped by feature under `lua/custom/plugins/enable/` (active) and `lua/custom/plugins/disable/` (inactive).
- Local variables/functions:
- descriptive lower_snake_case.
- short names only for conventional temporary values (`buf`, `opts`, `client`).
- Augroup names:
- stable, descriptive strings (e.g. `'NeoTreeAutoRefresh'`, `'kickstart-lsp-highlight'`).
- Keymap descriptions:
- concise, action-oriented, consistent bracket hints used by which-key.

## Code Style: Error Handling and Resilience

- Prefer non-fatal behavior for optional dependencies.
- Example pattern already used: `pcall(require('telescope').load_extension, 'fzf')`.
- Guard external tool usage with `vim.fn.executable(...)` when needed.
- Use `vim.notify(..., vim.log.levels.WARN/ERROR)` for actionable user-facing issues.
- Keep startup robust: avoid hard errors for optional plugin features.

## Plugin and Dependency Conventions

- Add plugins through `lazy` specs, keeping structure consistent with existing blocks.
- When adding a new plugin, prefer putting it under `lua/custom/plugins/enable/*.lua` (or other custom modules) instead of editing upstream kickstart blocks in `init.lua`, to minimize merge conflicts with upstream updates.
- To disable a custom plugin without deleting its spec, move it to `lua/custom/plugins/disable/`.
- Prefer minimal configuration first (`opts = {}`), then extend only if needed.
- Respect platform guards (e.g., `make` checks, Windows conditionals).
- Do not edit lockfile manually; let lazy manage `lazy-lock.json` updates.

## Custom Keymap and Layout Conventions

- Keep **custom** keymaps in `lua/custom/keymaps.lua`.
- Keep upstream kickstart keymaps in `init.lua` unless intentionally overriding behavior.
- If adding a new `<leader>` namespace in `lua/custom/keymaps.lua`, also register its group in which-key (`init.lua` `which-key` spec).
- Keep layout/window helper logic centralized in `lua/custom/layout.lua` (for example `focus_main_window()`), and reuse it from plugin modules instead of duplicating sidebar/window filtering logic.
- If a plugin needs startup window choreography, call `require('custom.layout')` helpers rather than re-implementing window focus rules.

## Editing and Change Scope

- Keep changes minimal and local to the requested task.
- Do not refactor unrelated sections opportunistically.
- Preserve existing comments unless they become inaccurate.
- Maintain ASCII unless file already relies on Unicode symbols/icons.

## Change Hygiene For Agents

- Before finalizing: run formatting + at least one targeted runtime check.
- Mention exactly what you validated and what you could not validate.
- If no formal tests exist, explicitly say "no unit test suite in this repo".
- Include file paths in reports so reviewers can jump directly.

## When Unsure

- Follow existing patterns in nearby files first.
- Prefer reversible, low-risk changes.
- Ask for clarification only when ambiguity materially changes behavior.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ External Requirements:
- Language Setup:
- If you want to write Typescript, you need `npm`
- If you want to write Golang, you will need `go`
- If you want to lint Markdown, install `markdownlint-cli2` (via `npm i -g markdownlint-cli2` or Mason)
- etc.

> [!NOTE]
Expand Down
39 changes: 28 additions & 11 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ 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 = false
vim.g.have_nerd_font = true

-- [[ Setting options ]]
-- See `:help vim.o`
Expand Down Expand Up @@ -127,7 +127,7 @@ vim.o.ignorecase = true
vim.o.smartcase = true

-- Keep signcolumn on by default
vim.o.signcolumn = 'yes'
vim.o.signcolumn = 'yes:1'

-- Decrease update time
vim.o.updatetime = 250
Expand All @@ -138,6 +138,8 @@ vim.o.timeoutlen = 300
-- Configure how new splits should be opened
vim.o.splitright = true
vim.o.splitbelow = true
-- Doesn't work well with WezTerm mux server; disable for now and revisit later.
vim.opt.termsync = false

-- Sets how neovim will display certain whitespace characters in the editor.
-- See `:help 'list'`
Expand Down Expand Up @@ -184,7 +186,7 @@ vim.diagnostic.config {
virtual_lines = false, -- Text shows up underneath the line, with virtual lines

-- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d`
jump = { float = true },
jump = { on_jump = function() vim.diagnostic.open_float() end },
}

vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
Expand Down Expand Up @@ -230,6 +232,10 @@ vim.api.nvim_create_autocmd('TextYankPost', {
callback = function() vim.hl.on_yank() end,
})

require 'custom.beancount'
require 'custom.keymaps'
require 'custom.treesitter'

-- [[ 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'
Expand Down Expand Up @@ -318,6 +324,7 @@ require('lazy').setup({
spec = {
{ '<leader>s', group = '[S]earch', mode = { 'n', 'v' } },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>w', group = '[W]indows' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } }, -- Enable gitsigns recommended keymaps first
{ 'gr', group = 'LSP Actions', mode = { 'n' } },
},
Expand Down Expand Up @@ -621,6 +628,12 @@ require('lazy').setup({
if path ~= vim.fn.stdpath 'config' and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) then return end
end

local config_path = vim.fn.stdpath 'config'
local runtime_files = vim.tbl_filter(
function(file) return file ~= config_path and file ~= (config_path .. '/after') end,
vim.api.nvim_get_runtime_file('', true)
)

client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
runtime = {
version = 'LuaJIT',
Expand All @@ -630,7 +643,7 @@ require('lazy').setup({
checkThirdParty = false,
-- NOTE: this is a lot slower and will cause issues when working on your own configuration.
-- See https://github.com/neovim/nvim-lspconfig/issues/3189
library = vim.tbl_extend('force', vim.api.nvim_get_runtime_file('', true), {
library = vim.tbl_extend('force', runtime_files, {
'${3rd}/luv/library',
'${3rd}/busted/library',
}),
Expand All @@ -653,6 +666,7 @@ require('lazy').setup({
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
-- You can add other tools here that you want Mason to install
'prettier',
})

require('mason-tool-installer').setup { ensure_installed = ensure_installed }
Expand Down Expand Up @@ -696,6 +710,9 @@ require('lazy').setup({
end,
formatters_by_ft = {
lua = { 'stylua' },
json = { 'prettier' },
yaml = { 'prettier' },
beancount = { 'bean-format' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
Expand Down Expand Up @@ -930,17 +947,17 @@ require('lazy').setup({
-- 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 recommended keymaps
require 'kickstart.plugins.indent_line',
require 'kickstart.plugins.lint',
require 'kickstart.plugins.autopairs',
require 'kickstart.plugins.neo-tree',
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommended keymaps

-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- NOTE: The import below automatically loads enabled custom plugins from `lua/custom/plugins/enable/*.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' },
{ import = 'custom.plugins.enable' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!
Expand Down
34 changes: 34 additions & 0 deletions lazy-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
"auto-session": { "branch": "main", "commit": "62437532b38495551410b3f377bcf4aaac574ebe" },
"blame.nvim": { "branch": "main", "commit": "179da7aaacce7c52874af636255ede72dd6fe796" },
"blink.cmp": { "branch": "main", "commit": "451168851e8e2466bc97ee3e026c3dcb9141ce07" },
"codediff.nvim": { "branch": "main", "commit": "832f1ecc5f8b15a44cf7537e31d3266d657775b1" },
"conform.nvim": { "branch": "master", "commit": "086a40dc7ed8242c03be9f47fbcee68699cc2395" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"fidget.nvim": { "branch": "main", "commit": "889e2e96edef4e144965571d46f7a77bcc4d0ddf" },
"gitsigns.nvim": { "branch": "main", "commit": "e1fb5425c8812214209b3f24eaa582c6c552cf98" },
"guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" },
"indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25f609e7fca78af7cede4f9fa3af8a94b1c4950b" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" },
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
"mini.nvim": { "branch": "main", "commit": "3923662bf3d6ca49a9503f8d7196ea0450983e6a" },
"neo-tree.nvim": { "branch": "main", "commit": "84c75e7a7e443586f60508d12fc50f90d9aee14e" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" },
"nvim-lint": { "branch": "master", "commit": "4b03656c09c1561f89b6aa0665c15d292ba9499d" },
"nvim-lspconfig": { "branch": "master", "commit": "8e2084bf5e40c79c1f42210a6ef96a0a4793a763" },
"nvim-treesitter": { "branch": "main", "commit": "539abf6da5ee8702e37b82cc953131dadd570da2" },
"nvim-web-devicons": { "branch": "master", "commit": "40e9d5a6cc3db11b309e39593fc7ac03bb844e38" },
"opencode.nvim": { "branch": "main", "commit": "df533d6da724109bf08446392db860fdceddbd0c" },
"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": "cfb85dcf7f822b79224e9e6aef9e8c794211b20b" },
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
"tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
}
11 changes: 11 additions & 0 deletions lua/custom/beancount.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
local warned_missing_bean_format = false

vim.api.nvim_create_autocmd('FileType', {
pattern = 'beancount',
group = vim.api.nvim_create_augroup('beancount-format-check', { clear = true }),
callback = function()
if warned_missing_bean_format or vim.fn.executable 'bean-format' == 1 then return end
warned_missing_bean_format = true
vim.notify('bean-format not found. Install it with: uv tool install beancount', vim.log.levels.WARN, { title = 'conform.nvim' })
end,
})
1 change: 1 addition & 0 deletions lua/custom/keymaps.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vim.keymap.set('n', '<leader>wR', function() require('custom.layout').reset_ide_layout() end, { desc = '[W]indows: [R]eset IDE layout' })
Loading
Loading