refactor: simplify startup profiles and ignore local tooling configs

This commit is contained in:
2026-05-30 15:01:30 +08:00
parent 5cba0307a3
commit 94699474c7
36 changed files with 604 additions and 1166 deletions
+52
View File
@@ -0,0 +1,52 @@
local M = {}
function M.setup()
require("gitsigns").setup({
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
untracked = { text = "" },
},
signs_staged = {
add = { text = "" },
change = { text = "" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
untracked = { text = "" },
},
signs_staged_enable = true,
signcolumn = true,
numhl = false,
linehl = false,
word_diff = false,
watch_gitdir = { follow_files = true },
auto_attach = true,
attach_to_untracked = false,
current_line_blame = true,
current_line_blame_opts = {
virt_text = true,
virt_text_pos = "eol",
delay = 1000,
ignore_whitespace = false,
virt_text_priority = 100,
use_focus = true,
},
current_line_blame_formatter = "<author>, <author_time:%R> - <summary>",
sign_priority = 6,
update_debounce = 100,
max_file_length = 40000,
preview_config = {
border = "single",
style = "minimal",
relative = "cursor",
row = 0,
col = 1,
},
})
end
return M
+11
View File
@@ -0,0 +1,11 @@
local M = {}
function M.setup()
require("lualine").setup({
options = {
theme = "auto",
},
})
end
return M
+7
View File
@@ -0,0 +1,7 @@
local M = {}
function M.setup()
require("nvim-tree").setup({})
end
return M
+102
View File
@@ -0,0 +1,102 @@
local M = {}
function M.setup()
local ok_configs, ts_configs = pcall(require, "nvim-treesitter.configs")
if not ok_configs then
vim.schedule(function()
vim.notify("nvim-treesitter is not available yet. Run :lua vim.pack.update() and restart.",
vim.log.levels.WARN)
end)
return
end
ts_configs.setup({
ensure_installed = {
"bash",
"c",
"diff",
"html",
"javascript",
"jsdoc",
"json",
"jsonc",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"printf",
"python",
"query",
"regex",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"xml",
"yaml",
},
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
textobjects = {
move = {
enable = true,
goto_next_start = {
["]f"] = "@function.outer",
["]c"] = "@class.outer",
["]a"] = "@parameter.inner",
},
goto_next_end = {
["]F"] = "@function.outer",
["]C"] = "@class.outer",
["]A"] = "@parameter.inner",
},
goto_previous_start = {
["[f"] = "@function.outer",
["[c"] = "@class.outer",
["[a"] = "@parameter.inner",
},
goto_previous_end = {
["[F"] = "@function.outer",
["[C"] = "@class.outer",
["[A"] = "@parameter.inner",
},
},
},
})
local ok_move, move = pcall(require, "nvim-treesitter.textobjects.move")
if not ok_move then
return
end
for name, fn in pairs(move) do
if name:find("goto") == 1 then
move[name] = function(query, ...)
if vim.wo.diff then
local config = ts_configs.get_module("textobjects.move")[name]
for key, textobject in pairs(config or {}) do
if query == textobject and key:find("[%]%[][cC]") then
vim.cmd("normal! " .. key)
return
end
end
end
return fn(query, ...)
end
end
end
end
return M
+36
View File
@@ -0,0 +1,36 @@
local M = {}
function M.setup()
local wk = require("which-key")
wk.setup({
preset = "helix",
})
wk.add({
{ mode = { "n", "v" } },
{ "<leader>c", group = "code" },
{ "<leader>f", group = "file/find" },
{ "<leader>g", group = "git" },
{ "<leader>q", group = "quit/session" },
{ "<leader>s", group = "search" },
{ "<leader>u", group = "ui" },
{ "<leader>x", group = "diagnostics/quickfix" },
{ "[", group = "prev" },
{ "]", group = "next" },
{ "g", group = "goto" },
{ "gs", group = "surround" },
{ "z", group = "fold" },
{ "gx", desc = "Open with system app" },
})
vim.keymap.set("n", "<leader>?", function()
wk.show({ global = false })
end, { desc = "Buffer Keymaps (which-key)" })
vim.keymap.set("n", "<c-w><space>", function()
wk.show({ keys = "<c-w>", loop = true })
end, { desc = "Window Hydra Mode (which-key)" })
end
return M
+9
View File
@@ -0,0 +1,9 @@
local M = {}
function M.setup()
vim.keymap.set("n", "<leader>w", function()
require("nvim-window").pick()
end, { desc = "Jump to window" })
end
return M