fix(pack): move plugins out from lua runtime path

This commit is contained in:
2026-04-15 05:07:29 +02:00
parent 0211ed53a1
commit 1293be93aa
16 changed files with 6 additions and 6 deletions
+5
View File
@@ -0,0 +1,5 @@
---@diagnostic disable-next-line: missing-fields
require("Comment").setup({
--ignore empty lines
ignore = "^$",
})
+60
View File
@@ -0,0 +1,60 @@
local fzf = require("fzf-lua")
local wide = {
width = 160,
height = 30,
preview = { horizontal = "right:50%" },
}
fzf.setup({
winopts = {
width = 80,
height = 30,
row = 0.5,
col = 0.5,
backdrop = 100,
},
keymap = {
builtin = {
false,
["<C-o>"] = "toggle-fullscreen",
},
fzf = {
false,
["ctrl-q"] = "select-all+accept",
["ctrl-y"] = "accept",
},
},
files = {
hidden = true,
no_ignore = true,
previewer = false,
},
grep = {
hidden = true,
rg_opts = "--iglob=!.venv --iglob=!vendor "
.. require("fzf-lua.defaults").defaults.grep.rg_opts,
winopts = wide,
},
oldfiles = {
cwd_only = true,
previewer = false,
include_current_session = true,
},
buffers = {
sort_lastused = true,
previewer = false,
},
highlights = {
winopts = wide,
},
})
vim.keymap.set("n", "<leader>ff", fzf.files)
vim.keymap.set("n", "<leader>fr", fzf.oldfiles)
vim.keymap.set("n", "<leader>fg", fzf.live_grep)
vim.keymap.set("n", "<leader>fG", function()
fzf.live_grep({ cwd = vim.fn.expand("%:p:h") })
end)
vim.keymap.set("n", "<leader>fb", fzf.buffers)
vim.keymap.set("n", "<leader>fh", fzf.highlights)
+48
View File
@@ -0,0 +1,48 @@
require("gitsigns").setup({
preview_config = {
border = "single",
},
on_attach = function(bufnr)
local gs = require("gitsigns")
vim.keymap.set("n", "<leader>gv", gs.select_hunk, { buffer = bufnr })
vim.keymap.set("n", "<leader>gs", gs.stage_hunk, { buffer = bufnr })
vim.keymap.set("x", "<leader>gs", function()
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
end, { buffer = bufnr })
vim.keymap.set("n", "<leader>gr", gs.reset_hunk, { buffer = bufnr })
vim.keymap.set(
"x",
"<leader>gr",
":Gitsigns reset_hunk<CR>",
{ buffer = bufnr }
)
vim.keymap.set("n", "<leader>g?", gs.preview_hunk, { buffer = bufnr })
vim.keymap.set("n", "<leader>gb", function()
gs.blame_line({ full = true, ignore_whitespace = true })
end, { buffer = bufnr })
vim.keymap.set({ "n", "x" }, "]g", function()
gs.nav_hunk("next", {
wrap = true,
foldopen = true,
navigation_message = true,
greedy = true,
preview = true,
count = 1,
target = "all",
})
end)
vim.keymap.set({ "n", "x" }, "[g", function()
gs.nav_hunk("prev", {
wrap = true,
foldopen = true,
navigation_message = true,
greedy = true,
preview = true,
count = 1,
target = "all",
})
end)
end,
attach_to_untracked = false,
sign_priority = 100,
})
+1
View File
@@ -0,0 +1 @@
require("grug-far").setup()
+55
View File
@@ -0,0 +1,55 @@
require("mason-auto-install").setup({
packages = {
{
"bash-language-server",
dependencies = { "shellcheck", "shfmt" },
},
-- "clangd",
{
"cmake-language-server",
dependencies = { "golines" },
},
"gopls",
"hyprls",
{
"intelephense",
dependencies = { "phpcs" },
},
"jedi-language-server",
{
"lemminx",
dependencies = { "xmlformatter" },
},
{
"lua-language-server",
dependencies = { "stylua" },
},
"mesonlsp",
"oxfmt",
"oxlint",
"ruff",
"pyright",
"pyrefly",
{
"prettier",
filetypes = {
"json",
"jsonc",
"markdown",
"html",
"css",
"scss",
"less",
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
},
},
"rust-analyzer",
"svelte-language-server",
"tailwindcss-language-server",
"tsgo",
"zls",
},
})
+1
View File
@@ -0,0 +1 @@
require("mason").setup()
+151
View File
@@ -0,0 +1,151 @@
local dap = require("dap")
local log = require("log")
vim.api.nvim_set_hl(0, "DebugPC", {
bg = "NONE",
fg = "NONE",
})
vim.api.nvim_create_user_command(
"Debug",
---@param opts vim.api.keyset.create_user_command.command_args
function(opts)
local cfgs = dap.configurations[vim.bo.filetype]
if not cfgs then
log.error(
"No configurations available for filetype %s",
vim.bo.filetype
)
return
end
local function run_config(cfg)
local all_args = vim.fn.split(opts.args)
cfg.program = all_args[1]
local args = {}
for i = 2, #all_args do
table.insert(args, all_args[i])
end
cfg.args = args
dap.run(cfg)
end
if #cfgs == 1 then
run_config(cfgs[1])
return
end
local names = {}
for _, c in ipairs(cfgs) do
table.insert(names, c.name)
end
vim.ui.select(names, {
prompt = "Select DAP configuration to use:",
}, function(choice, idx)
if choice and idx then
run_config(cfgs[idx])
end
end)
end,
{
nargs = "+",
---@param ArgLead string
---@param CmdLine string
complete = function(ArgLead, CmdLine, CursorPos)
local _, spaces = CmdLine:sub(1, CursorPos):gsub("%s+", "")
if spaces == 1 then
return vim.fn.getcompletion(ArgLead, "file")
end
end,
}
)
-- https://sourceware.org/gdb/current/onlinedocs/gdb#Debugger-Adapter-Protocol
dap.adapters.gdb = {
type = "executable",
command = "gdb",
args = { "--interpreter=dap" },
}
dap.adapters.lldb = {
type = "executable",
command = "lldb-dap",
}
dap.adapters.python = {
type = "executable",
command = "python",
args = { "-m", "debugpy.adapter" },
}
dap.configurations.c = {
{
type = "gdb",
request = "launch",
name = "Launch",
program = function()
local path = vim.fn.input({
prompt = "Path to executable: ",
default = vim.fn.getcwd() .. "/",
completion = "file",
})
return (path and path ~= "") and path or dap.ABORT
end,
cwd = "${workspaceFolder}",
stopAtBeginningOfMainSubprogram = false,
},
}
-- dap.configurations.c = {
-- {
-- type = "lldb",
-- request = "launch",
-- name = "Launch",
-- program = function()
-- local path = vim.fn.input({
-- prompt = "Path to executable: ",
-- default = vim.fn.getcwd() .. "/",
-- completion = "file",
-- })
-- return (path and path ~= "") and path or dap.ABORT
-- end,
-- cwd = "${workspaceFolder}",
-- stopAtBeginningOfMainSubprogram = false,
-- console = "internalConsole",
-- },
-- }
dap.configurations.cpp = dap.configurations.c
dap.configurations.python = {
{
type = "python",
request = "launch",
name = "Launch",
program = function()
local path = vim.fn.input({
prompt = "Path to executable: ",
default = vim.fn.getcwd() .. "/",
completion = "file",
})
return (path and path ~= "") and path or dap.ABORT
end,
cwd = "${workspaceFolder}",
},
}
vim.keymap.set("n", "<Leader>db", dap.toggle_breakpoint)
vim.keymap.set("n", "<Leader>df", dap.focus_frame)
vim.keymap.set("n", "<PageUp>", dap.up)
vim.keymap.set("n", "<PageDown>", dap.down)
vim.keymap.set({ "n", "x" }, "<Leader>dh", require("dap.hover"))
vim.keymap.set({ "n", "x" }, "<Leader>dr", dap.repl.toggle)
vim.keymap.set("n", "<F2>", dap.step_into)
vim.keymap.set("n", "<F3>", dap.step_over)
vim.keymap.set("n", "<F4>", dap.step_out)
vim.keymap.set("n", "<F5>", dap.continue)
vim.keymap.set("n", "<F9>", dap.terminate)
+1
View File
@@ -0,0 +1 @@
require("lsp").setup()
+250
View File
@@ -0,0 +1,250 @@
local util = require("util")
local function override_highlights()
-- File Icon
local hl = util.get_hl_source("NvimTreeFileIcon")
vim.api.nvim_set_hl(0, "NvimTreeFileIcon", { fg = hl.fg, bg = nil })
-- Symlink Icon
hl = util.get_hl_source("NvimTreeSymlinkIcon")
vim.api.nvim_set_hl(0, "NvimTreeSymlinkIcon", { fg = hl.fg, bg = nil })
end
local function disable_highlights()
-- File types
vim.cmd.highlight({ "clear NvimTreeExecFile" })
vim.cmd.highlight({
"link NvimTreeExecFile NONE",
bang = true,
})
vim.cmd.highlight({ "clear NvimTreeImageFile" })
vim.cmd.highlight({
"link NvimTreeImageFile NONE",
bang = true,
})
vim.cmd.highlight({ "clear NvimTreeSpecialFile" })
vim.cmd.highlight({
"link NvimTreeSpecialFile NONE",
bang = true,
})
vim.cmd.highlight({ "clear NvimTreeSymlink" })
vim.cmd.highlight({
"link NvimTreeSymlink NONE",
bang = true,
})
end
vim.keymap.set("n", "<leader>tt", function()
require("nvim-tree.api").tree.toggle({ find_file = true, focus = false })
end)
---@class nvim_tree.api.decorator.UserDecorator
local Decorator = require("nvim-tree.api").Decorator
---@class GitIgnoreDecorator: nvim_tree.api.decorator.UserDecorator
local GitIgnoreDecorator = Decorator:extend()
function GitIgnoreDecorator:new()
self.enabled = true
self.highlight_range = "name"
self.icon_placement = "none"
self.file_hl = "NvimTreeGitFileIgnoredHL"
self.folder_hl = "NvimTreeGitFolderIgnoredHL"
end
---@param node Node
---@return string? highlight_group
function GitIgnoreDecorator:highlight_group(node)
local status = node.git_status
if not status then
return
end
if status.file == "!!" then
return self.file_hl
elseif status.dir and status.dir.direct == "!!" then
return self.folder_hl
end
end
local signs = require("lsp.diagnostic").signs
require("nvim-tree").setup({
on_attach = function(bufnr)
local function opts(desc)
return {
desc = "nvim-tree: " .. desc,
buffer = bufnr,
noremap = true,
silent = true,
nowait = true,
}
end
local api = require("nvim-tree.api")
api.map.on_attach.default(bufnr)
vim.keymap.del("n", "D", { buffer = bufnr })
vim.keymap.del("n", "bt", { buffer = bufnr })
vim.keymap.set("n", "d", api.fs.trash, opts("Trash"))
vim.keymap.set(
"n",
"bd",
api.marks.bulk.trash,
opts("Trash Bookmarked")
)
vim.keymap.set("n", "<C-l>", api.node.open.edit, opts("Open"))
vim.keymap.set(
"n",
"<C-h>",
api.node.navigate.parent_close,
opts("Close Directory")
)
end,
hijack_cursor = true,
hijack_netrw = false,
view = {
width = 50,
preserve_window_proportions = true,
},
renderer = {
full_name = true,
root_folder_label = function(path)
local label = vim.fn.fnamemodify(path, ":~")
local git_head = vim.fn.FugitiveHead()
if git_head ~= "" then
label = label .. ("  %s"):format(git_head)
end
return label
end,
special_files = {},
decorators = {
"Git",
GitIgnoreDecorator,
"Open",
"Modified",
"Bookmark",
"Diagnostics",
"Copied",
"Cut",
},
highlight_modified = "icon",
highlight_bookmarks = "name",
highlight_clipboard = "all",
indent_markers = {
enable = true,
icons = {
corner = "",
none = "",
},
},
icons = {
git_placement = "after",
diagnostics_placement = "signcolumn",
bookmarks_placement = "after",
symlink_arrow = " -> ",
show = {
file = true,
folder = true,
folder_arrow = false,
bookmarks = false,
},
web_devicons = {
file = {
color = false,
},
},
glyphs = {
modified = "*",
git = {
unstaged = "M",
staged = "M",
unmerged = "!",
renamed = "R",
untracked = "?",
deleted = "D",
ignored = " ",
},
},
},
},
update_focused_file = {
enable = true,
},
diagnostics = {
enable = true,
show_on_dirs = true,
icons = {
hint = signs.text[vim.diagnostic.severity.HINT],
info = signs.text[vim.diagnostic.severity.INFO],
warning = signs.text[vim.diagnostic.severity.WARN],
error = signs.text[vim.diagnostic.severity.ERROR],
},
},
modified = {
enable = true,
},
filters = {
git_ignored = false,
custom = { "^\\.git$" },
},
live_filter = {
prefix = "Filter: ",
always_show_folders = false,
},
filesystem_watchers = {
enable = true,
},
actions = {
use_system_clipboard = false,
change_dir = {
enable = false,
},
expand_all = {
exclude = { ".venv", "build" },
},
open_file = {
window_picker = {
enable = false,
},
},
},
notify = {
threshold = vim.log.levels.WARN,
absolute_path = false,
},
help = {
sort_by = "desc",
},
sync_root_with_cwd = true,
git = {
show_on_open_dirs = false,
},
})
override_highlights()
disable_highlights()
vim.api.nvim_create_autocmd("QuitPre", {
callback = function()
local tree_wins = {}
local floating_wins = {}
local wins = vim.api.nvim_list_wins()
for _, w in ipairs(wins) do
local bufname =
vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(w))
if bufname:match("NvimTree_") ~= nil then
table.insert(tree_wins, w)
end
if vim.api.nvim_win_get_config(w).relative ~= "" then
table.insert(floating_wins, w)
end
end
if 1 == #wins - #floating_wins - #tree_wins then
-- Should quit, so we close all invalid windows.
for _, w in ipairs(tree_wins) do
vim.api.nvim_win_close(w, true)
end
end
end,
})
+66
View File
@@ -0,0 +1,66 @@
local log = require("log")
local languages = {
"bash",
"zsh",
"python",
"c",
"cpp",
"lua",
"luadoc",
"vim",
"vimdoc",
"php",
"rust",
"comment",
"gitcommit",
"xml",
"sql",
"html",
"json",
"gotmpl",
"markdown",
"go",
"svelte",
"scss",
"tsx",
"typescript",
"yaml",
}
local ts = require("nvim-treesitter")
ts.setup({
install_dir = string.format("%s/nvim-treesitter", vim.fn.stdpath("data")),
})
ts.install(languages):await(function(err)
if err then
log.error("Error: %s", err)
return
end
---@diagnostic disable-next-line: redefined-local
ts.update():await(function(err)
if err then
log.error("Error: %s", err)
return
end
local filetypes = {}
for _, lang in ipairs(languages) do
for _, ft in ipairs(vim.treesitter.language.get_filetypes(lang)) do
if not vim.list_contains(filetypes, ft) then
table.insert(filetypes, ft)
end
end
end
vim.api.nvim_create_autocmd("FileType", {
pattern = filetypes,
callback = function()
vim.treesitter.start()
vim.wo.foldmethod = "expr"
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
end,
})
end)
end)
+35
View File
@@ -0,0 +1,35 @@
require("oil").setup({
default_file_explorer = true,
columns = {
-- "icon",
"permissions",
"size",
"mtime",
},
delete_to_trash = true,
float = {
max_width = 80,
max_height = 20,
},
skip_confirm_for_simple_edits = true,
watch_for_changes = false,
keymaps = {
["<Esc>"] = "actions.close",
["q"] = "actions.close",
["<C-s>"] = false,
["<C-h>"] = "actions.parent",
["<C-l>"] = "actions.select",
["<C-r>"] = "actions.refresh",
},
view_options = {
show_hidden = true,
natural_order = false,
},
win_options = {
colorcolumn = "",
},
})
vim.keymap.set("n", "<leader>fe", function()
vim.cmd.Oil("--float")
end)
+29
View File
@@ -0,0 +1,29 @@
require("onedark").setup({ style = "darker" })
local c = require("onedark.colors")
local highlights = {
["@string.special.url"] = { fg = "NONE", fmt = "NONE" },
["@lsp.type.macro.gotmpl"] = { fg = "NONE", fmt = "NONE" },
Cursor = { fg = c.bg, bg = c.fg, fmt = "NONE" },
FloatTitle = { fg = c.orange, bg = c.bg_d },
NormalFloat = { bg = c.bg_d },
FloatBorder = { bg = c.bg_d },
TabLine = { fg = c.grey, bg = c.bg1 },
TabLineSel = { fg = c.fg, bg = c.bg2 },
TabLineFill = { bg = c.bg1 },
EndOfBuffer = { fg = "NONE", bg = "NONE" },
NvimTreeIndentMarker = { fg = c.bg3 },
TelescopeNormal = { bg = c.bg_d },
TelescopeTitle = { fg = c.orange, bg = c.bg_d },
TelescopePromptBorder = { fg = c.grey, bg = c.bg_d },
TelescopeResultsBorder = { fg = c.grey, bg = c.bg_d },
TelescopePreviewBorder = { fg = c.grey, bg = c.bg_d },
DiffAdd = { bg = "#1a2f22" },
DiffChange = { bg = "#15304a" },
DiffDelete = { bg = "#311c1e" },
GitDeleted = { fg = c.red },
GitDirty = { fg = c.yellow },
GitNew = { fg = c.green },
}
require("onedark").set_options("highlights", highlights)
require("onedark").load()
+9
View File
@@ -0,0 +1,9 @@
require("outline").setup({
outline_window = {
relative_width = false,
split_command = "aboveleft 40vsp",
focus_on_open = false,
},
})
vim.keymap.set("n", "<leader>o", "<cmd>Outline<CR>")
+1
View File
@@ -0,0 +1 @@
vim.keymap.set("n", "<leader>u", require("undotree").toggle)
+69
View File
@@ -0,0 +1,69 @@
local function open_git_status()
local previous_win = vim.api.nvim_get_current_win()
vim.cmd("leftabove vertical G")
vim.api.nvim_win_set_width(0, 50)
vim.api.nvim_set_option_value("winfixwidth", true, { scope = "local" })
vim.api.nvim_set_current_win(previous_win)
end
local function get_git_status_win()
local current_tabpage = vim.api.nvim_get_current_tabpage()
for _, win in ipairs(vim.api.nvim_tabpage_list_wins(current_tabpage)) do
local buf = vim.api.nvim_win_get_buf(win)
local buftype = vim.api.nvim_get_option_value("buftype", { buf = buf })
if
buftype == "nowrite"
and vim.api.nvim_buf_get_name(buf):match("^fugitive://.*%.git//$")
then
return win
end
end
end
local function toggle_git_status()
local win = get_git_status_win()
if win then
vim.api.nvim_win_close(win, false)
return
end
open_git_status()
end
vim.api.nvim_create_user_command("Glog", function(opts)
local mods = opts.mods ~= "" and (opts.mods .. " ") or ""
vim.cmd(
mods
.. "Git log --graph --all --decorate --date=short "
.. "--format=format:'%h %ad {%an}%d %s' "
.. opts.args
)
end, { nargs = "*", desc = "Pretty git log via fugitive" })
vim.keymap.set("n", "<leader>gl", vim.cmd.Glog)
vim.keymap.set("n", "<leader>gd", vim.cmd.Gvdiffsplit)
vim.keymap.set("n", "<leader>gD", function()
vim.cmd.Gvdiffsplit("HEAD")
end)
vim.keymap.set("n", "<leader>gh", vim.cmd.Ghdiffsplit)
vim.keymap.set("n", "<leader>gH", function()
vim.cmd.Ghdiffsplit("HEAD")
end)
vim.keymap.set("n", "<leader>gc", function()
vim.cmd.G("commit")
end)
vim.keymap.set("n", "<leader>ga", function()
vim.cmd.G("commit --amend")
end)
vim.keymap.set("n", "<leader>gp", function()
vim.cmd.G("push")
end)
vim.keymap.set("n", "<leader>gg", toggle_git_status)
vim.api.nvim_create_autocmd("User", {
pattern = "GitRefresh",
group = vim.api.nvim_create_augroup("ow.fugitive", { clear = true }),
callback = function()
vim.fn["fugitive#ReloadStatus"]()
end,
})