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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user