Clean up config: fix broken plugin specs, dedupe options/keymaps, drop dead code

- lspsaga: custom keys lived outside config(), so setup({}) ran empty and
  they never worked; moved into setup() and updated to the plugin's current
  option schema (finder_action_keys/definition_action_keys/move_in_saga
  are stale names in the installed version)
- catppuccin: fixed a stray `as = "catppuccin"` key left outside the plugin
  table; wrapped as { "catppuccin/nvim", name = "catppuccin" }
- options: consolidated the three competing sources (vimrc, init.lua,
  custom/options.lua) into custom/options.lua alone; hlsearch/wrap were
  silently landing opposite to what init.lua's own comments said, purely
  from require-order. custom/options.lua now loads first in the require
  chain since colorizer.lua and others need termguicolors set before their
  own setup() runs
- removed duplicate keymaps that were dead on arrival due to load order
  (<leader>rn, <leader>sf/sg/sh, jj, <leader>y, mapleader x3, manual
  C-h/j/k/l vs vim-tmux-navigator)
- removed dead code: smart_format, root_dir/fallback_root_dir, toggleterm's
  unused _LAZYGIT_TOGGLE/_NODE_TOGGLE/_PYTHON_TOGGLE globals, unused local
  cmp, stale commented blocks, lua/custom/startup.lua
- removed unused plugins: mini.icons, telescope-dap.nvim,
  startup-nvim/startup.nvim (malformed spec, never actually required),
  plus leftover ALE globals with no ALE plugin installed
- vim.loop.* -> vim.uv.*, vim.diagnostic.goto_prev/next ->
  vim.diagnostic.jump({count=...}) for 0.12.5
- guard vim.treesitter.start() at the top of init.lua: the system's
  bundled Lua highlight query is currently ahead of the available
  tree-sitter-lua grammar (a packaging skew, confirmed nvim-treesitter is
  fully up to date), which was throwing on every Lua buffer and taking
  omnifunc/foldexpr down with it; now falls back to regex highlighting
  with a single notify instead

Verified end-to-end against a real Neovim 0.12.5 headless instance with a
fresh plugin install: no load errors, lspsaga's custom keys now actually
apply, and the treesitter guard was confirmed against the real environment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jVh2Lhn386JAvjSFCHUhn
This commit is contained in:
2026-08-27 22:27:37 +02:00
co-authored by Claude Sonnet 5
parent b512fd2ff3
commit 2646541406
12 changed files with 70 additions and 207 deletions
+44 -79
View File
@@ -44,11 +44,31 @@ vim.cmd([[source ~/repos/nvim-kickstart/lua/custom/vimrc]])
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
---------- treesitter.start guard >------------------------------
-- Neovim's own bundled ftplugin/<lang>.lua calls vim.treesitter.start()
-- unconditionally. When the system's bundled highlight queries are ahead of
-- the currently available parser/grammar (a packaging/version skew, not a
-- config issue), that call throws and takes down the whole FileType autocmd
-- chain for the buffer (breaking omnifunc/foldexpr along with it). Guard it
-- here, before any buffer can trigger it, so a mismatch just falls back to
-- regex syntax highlighting instead of erroring.
do
local orig_start = vim.treesitter.start
vim.treesitter.start = function(...)
local ok, err = pcall(orig_start, ...)
if not ok then
vim.notify_once('treesitter.start failed, falling back to regex highlighting: ' .. tostring(err),
vim.log.levels.WARN)
end
end
end
---------- </treesitter.start guard ------------------------------
-- Install package manager
-- https://github.com/folke/lazy.nvim
-- `:help lazy.nvim.txt` for more info
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',
@@ -77,9 +97,7 @@ require('lazy').setup({
-- seems i need this regardless
'neovim/nvim-lspconfig',
{
'williamboman/mason.nvim', config = true
},
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
{
-- Autocompletion
@@ -133,7 +151,8 @@ require('lazy').setup({
-- Fuzzy Finder (files, lsp, etc)
{
'nvim-telescope/telescope.nvim', version = '*',
'nvim-telescope/telescope.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
@@ -153,36 +172,25 @@ require('lazy').setup({
{ -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
branch="main",
branch = "main",
lazy = false,
build = ':TSUpdate',
-- config = function()
-- require('nvim-treesitter.configs').setup({
-- ensure_installed = { 'bash', 'php', 'rust', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
-- auto_install = true,
-- highlight = {
-- enable = true,
-- additional_vim_regex_highlighting = { 'ruby' },
-- },
-- indent = { enable = true, disable = { 'ruby' } },
-- })
-- end,
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
branch="main"
branch = "main"
},
init = function()
local ensureInstalled = {
'lua', 'python', 'typescript',
-- ... your parsers
}
local alreadyInstalled = require('nvim-treesitter.config').get_installed()
local parsersToInstall = vim.iter(ensureInstalled)
:filter(function(parser)
return not vim.tbl_contains(alreadyInstalled, parser)
end)
:totable()
require('nvim-treesitter').install(parsersToInstall)
local ensureInstalled = {
'lua', 'python', 'typescript',
-- ... your parsers
}
local alreadyInstalled = require('nvim-treesitter.config').get_installed()
local parsersToInstall = vim.iter(ensureInstalled)
:filter(function(parser)
return not vim.tbl_contains(alreadyInstalled, parser)
end)
:totable()
require('nvim-treesitter').install(parsersToInstall)
end,
},
@@ -202,48 +210,8 @@ require('lazy').setup({
{ import = 'custom.plugins' },
}, {})
-- [[ Setting options ]]
-- See `:help vim.o`
-- NOTE: You can change these options as you wish!
-- Set highlight on search
vim.o.hlsearch = false
-- Make line numbers default
vim.wo.number = true
-- Enable mouse mode
vim.o.mouse = 'a'
-- Sync clipboard between OS and Neovim.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.o.clipboard = 'unnamedplus'
-- Enable break indent
vim.o.breakindent = true
-- Save undo history
vim.o.undofile = true
-- Case-insensitive searching UNLESS \C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
-- Keep signcolumn on by default
vim.wo.signcolumn = 'yes'
-- Decrease update time
vim.o.updatetime = 250
vim.o.timeoutlen = 300
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- NOTE: You should make sure your terminal supports this
vim.o.termguicolors = true
-- [[ Basic Keymaps ]]
-- See lua/custom/options.lua for vim.opt settings
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
@@ -272,17 +240,13 @@ vim.api.nvim_create_autocmd('TextYankPost', {
-- See `:help telescope.builtin`
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
vim.keymap.set('n', '[d', function() vim.diagnostic.jump({ count = -1 }) end,
{ desc = 'Go to previous diagnostic message' })
vim.keymap.set('n', ']d', function() vim.diagnostic.jump({ count = 1 }) end, { desc = 'Go to next diagnostic message' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
-- Setup neovim lua configuration
-- require('neodev').setup()
-- [[ Configure nvim-cmp ]]
-- See `:help cmp`
local cmp = require 'cmp'
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}
@@ -296,8 +260,10 @@ end
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et
-- options.lua sets vim.opt.termguicolors, which colorizer.lua (and others) need
-- already set by the time they run their setup() calls, so it loads first
require('custom.options')
require('custom.catppuccin')
-- require('custom.startup')
require('custom.lua-line')
require('custom.telescope')
require('custom.lspconfig')
@@ -305,7 +271,6 @@ require('custom.nvim-cmp')
require('custom.toggleterm')
require('custom.autopairs')
require('custom.colorizer')
require('custom.options')
require('custom.keymaps')
require('custom.harpoon')
require('custom.mason')