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
+33 -68
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,23 +172,12 @@ 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 = {
@@ -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')
+1 -2
View File
@@ -47,5 +47,4 @@ require("catppuccin").setup({
},
})
-- setup must be called before loading
vim.cmd.colorscheme "catppuccin"
-- colorscheme is applied in custom/colortheme.lua, loaded after this file
-8
View File
@@ -1,5 +1,3 @@
vim.g.mapleader = ' '
local keymap = vim.keymap
keymap.set('i', 'jj', '<ESC>')
@@ -56,12 +54,6 @@ keymap.set('n', '<leader>gh', ':DiffviewFileHistory %<CR>', { silent = true })
-- toggleterm
keymap.set('n', '<M-1>', '<cmd>ToggleTerm direction=horizontal<cr>', { silent = true })
-- vim-sneak
-- keymap.set('n', 'f', '<Plug>Sneak_s', { silent = true })
-- keymap.set('n', 'F', '<Plug>Sneak_S', { silent = true })
-- keymap.set('n', 's', 's', { silent = true })
-- easymotion
keymap.set('n', '<leader>f', '<Plug>(easymotion-prefix)', { silent = true })
keymap.set('n', '<leader>fs', '<Plug>(easymotion-sn)', { silent = true })
-9
View File
@@ -33,15 +33,6 @@ vim.filetype.add({
})
-- vim.api.nvim_set_keymap("n", "<C-A-k>", ":lua require('kulala').jump_prev()<CR>", { noremap = true, silent = true })
-- vim.api.nvim_set_keymap("n", "<C-A-j>", ":lua require('kulala').jump_next()<CR>", { noremap = true, silent = true })
-- vim.api.nvim_set_keymap("n", "<C-A-l>", ":lua require('kulala').run()<CR>", { noremap = true, silent = true })
-- vim.api.nvim_set_keymap("n", "<C-A-v>", ":lua require('kulala').toggle_view()<CR>", { noremap = true, silent = true })
-- vim.api.nvim_set_keymap("n", "<C-A-e>", ":lua require('kulala').set_selected_env()<CR>",
-- { noremap = true, silent = true })
-- vim.api.nvim_set_keymap("n", "<C-A-k>", ":lua require('kulala').jump_prev()<CR>", { noremap = true, silent = true })
-- vim.api.nvim_set_keymap("n", "<C-A-j>", ":lua require('kulala').jump_next()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<leader>rr", ":lua require('kulala').run()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<leader>rv", ":lua require('kulala').toggle_view()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<leader>re", ":lua require('kulala').set_selected_env()<CR>",
+2 -32
View File
@@ -7,24 +7,6 @@
local keymap = vim.keymap -- for conciseness
-- smart format with null-ls if available
local function smart_format()
vim.lsp.buf.format({
filter = function(client)
local ft = vim.bo.filetype
if ft == "rust" then
return client.name == "rust_analyzer"
end
-- Prefer null-ls for all non-Rust, otherwise allow anything
if vim.tbl_contains({ "null-ls", "lua_ls", "jsonls", "tsserver" }, client.name) then
return true
end
return false
end,
timeout_ms = 3000,
})
end
---------- border >------------------------------
do
local orig_floating_preview = vim.lsp.util.open_floating_preview
@@ -55,11 +37,9 @@ local on_attach = function(_, bufnr)
keymap.set("n", "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>", opts)
keymap.set("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
-- keymap.set("n", "<leader>l", smart_format, opts)
keymap.set("n", "<leader>l", function()
vim.lsp.buf.format()
end, { desc = "Format code function" })
keymap.set("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
keymap.set(
"n",
"<leader>cbf",
@@ -121,15 +101,6 @@ setup_server("rust_analyzer", {
-- PHP LSPs
local util = vim.lsp.util
local root_dir = function(fname)
return util.root_pattern("composer.json", ".git")(fname)
or util.path.dirname(fname)
end
local fallback_root_dir = function(fname)
return util.root_pattern("composer.json", ".git")(fname) or util.path.dirname(fname)
end
-- start it manually :LspStart phpactor
-- setup_server("phpactor", {
@@ -186,13 +157,12 @@ setup_server("intelephense", {
-- phpcs / phpstan configs
vim.g.nvim_phpcs_config_phpcs_path = 'phpcs'
vim.g.nvim_phpcs_config_phpcbf_path = 'phpcbf'
vim.g.ale_php_phpstan_executable = '~/.config/composer/vendor/bin/phpstan'
local phpcs_config = "~/repos/configs/phpcs.xml"
local phpcs_config_new = "~/repos/dotfiles/phpcs.xml"
if vim.loop.fs_stat(phpcs_config_new) then
if vim.uv.fs_stat(phpcs_config_new) then
vim.g.nvim_phpcs_config_phpcs_standard = phpcs_config_new
elseif vim.loop.fs_stat(phpcs_config) then
elseif vim.uv.fs_stat(phpcs_config) then
vim.g.nvim_phpcs_config_phpcs_standard = phpcs_config
end
+2 -2
View File
@@ -8,7 +8,7 @@ local phpstan_global_config = vim.fn.expand("~/repos/dotfiles/php/phpstan-global
-- local config itself (that also picks up its `includes:`, e.g. a baseline)
local function phpstan_config_arg(root)
for _, name in ipairs({ "phpstan.neon", "phpstan.neon.dist" }) do
if vim.loop.fs_stat(root .. "/" .. name) then
if vim.uv.fs_stat(root .. "/" .. name) then
return nil
end
end
@@ -47,7 +47,7 @@ null_ls.setup({
timeout = 60000, -- a cold run easily exceeds null-ls' 5s default
condition = function(utils)
return utils.root_has_file({ "phpstan.neon", "phpstan.neon.dist" })
or vim.loop.fs_stat(phpstan_global_config) ~= nil
or vim.uv.fs_stat(phpstan_global_config) ~= nil
end,
}),
null_ls.builtins.diagnostics.phpcs.with({
+10 -1
View File
@@ -15,9 +15,10 @@ opt.expandtab = true
opt.autoindent = true
opt.wrap = false
opt.breakindent = true
-- scroll offset
vim.opt.scrolloff = 8
opt.scrolloff = 8
-- search settings
opt.smartcase = true
@@ -29,6 +30,9 @@ opt.termguicolors = true
opt.background = 'dark'
opt.signcolumn = 'yes'
-- mouse
opt.mouse = 'a'
-- clipboard
opt.clipboard:append 'unnamedplus'
@@ -37,3 +41,8 @@ opt.splitright = true
opt.splitbelow = true
opt.iskeyword:append '-'
-- undo & responsiveness
opt.undofile = true
opt.updatetime = 250
opt.timeoutlen = 300
+11 -17
View File
@@ -22,29 +22,26 @@ return {
-- vs-code like icons for autocompletion
"onsails/lspkind.nvim",
"catppuccin/nvim",
as = "catppuccin",
{ "startup-nvim/startup.nvim", dependencies = "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" },
{ "catppuccin/nvim", name = "catppuccin" },
{
'nvimdev/lspsaga.nvim',
config = function()
require('lspsaga').setup({})
require('lspsaga').setup({
-- use enter to open file from the finder
finder = {
keys = { toggle_or_open = "<CR>" },
},
-- use enter to open file with definition preview
definition = {
keys = { edit = "<CR>" },
},
})
end,
dependencies = {
'nvim-treesitter/nvim-treesitter', -- optional
'nvim-tree/nvim-web-devicons', -- optional
},
move_in_saga = { prev = "<C-k>", next = "<C-j>" },
-- use enter to open file with finder
finder_action_keys = {
open = "<CR>",
},
-- use enter to open file with definition preview
definition_action_keys = {
edit = "<CR>",
},
},
-- Debugger
@@ -60,7 +57,6 @@ return {
"theHamsta/nvim-dap-virtual-text",
dependencies = "mfussenegger/nvim-dap",
},
"nvim-telescope/telescope-dap.nvim",
-- autoclose parens, brackets, quotes, etc...
"windwp/nvim-autopairs",
@@ -102,8 +98,6 @@ return {
}
},
{ 'echasnovski/mini.icons', version = false },
{
-- HTTP REST-Client Interface
'mistweaverco/kulala.nvim',
-10
View File
@@ -1,10 +0,0 @@
-- import comment plugin safely
local setup, startup = pcall(require, "startup")
if not setup then
return
end
-- enable startup
startup.setup({
theme = "dashboard"
})
-3
View File
@@ -60,9 +60,6 @@ vim.keymap.set('n', '<leader>/', function()
end, { desc = '[/] Fuzzily search in current buffer' })
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
-18
View File
@@ -43,21 +43,3 @@ end
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })
function _LAZYGIT_TOGGLE()
lazygit:toggle()
end
local node = Terminal:new({ cmd = "node", hidden = true })
function _NODE_TOGGLE()
node:toggle()
end
local python = Terminal:new({ cmd = "python3", hidden = true })
function _PYTHON_TOGGLE()
python:toggle()
end
-26
View File
@@ -1,26 +1,6 @@
set number
set hlsearch
set incsearch
set smartcase
set ignorecase
set wrap
set linebreak
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
set splitright splitbelow
set timeoutlen=1000
set number
set relativenumber
set scrolloff=10
syntax on
filetype indent on
set smartindent
let mapleader = " "
imap jj <Esc>
imap <C-l> <Del>
nnoremap <Leader>ü "+p
@@ -41,7 +21,6 @@ nnoremap <leader>a ggVG
nnoremap ,b :buffers<CR>
" nnoremap <leader>t :Explorer<CR>
" use leader e instead
nnoremap <leader>y "+yy
vnoremap <leader>y "+y
":nnoremap <Leader>s :%s/\<<C-r><C-w>\>/
@@ -51,11 +30,6 @@ vnoremap <leader>y "+y
vnoremap <C-r> "hy:%s/<C-r>h//gc<left><left><left>
let g:python3_host_prog="/usr/bin/python3"
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" nnoremap <C-d> <C-d>zz
" nnoremap <C-u> <C-u>zz