10 aug 2026

This commit is contained in:
2026-08-10 13:18:23 +02:00
parent 91773e0a00
commit a775122059
36 changed files with 433 additions and 461 deletions
+73
View File
@@ -0,0 +1,73 @@
require("actions-preview").setup {
-- options for vim.diff(): https://neovim.io/doc/user/lua.html#vim.diff()
diff = {
ctxlen = 3,
},
highlight_command = {
-- require("actions-preview.highlight").delta(),
-- require("actions-preview.highlight").diff_so_fancy(),
-- require("actions-preview.highlight").diff_highlight(),
},
-- priority list of preferred backend
backend = { "snacks", "nui" },
-- options related to telescope.nvim
telescope = vim.tbl_extend(
"force",
require("telescope.themes").get_dropdown(),
-- a table for customizing content
{
-- a function to make a table containing the values to be displayed.
-- fun(action: Action): { title: string, client_name: string|nil }
make_value = nil,
-- a function to make a function to be used in `display` of a entry.
-- see also `:h telescope.make_entry` and `:h telescope.pickers.entry_display`.
-- fun(values: { index: integer, action: Action, title: string, client_name: string }[]): function
make_make_display = nil,
}
),
-- options for nui.nvim components
nui = {
-- component direction. "col" or "row"
dir = "col",
-- keymap for selection component: https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/menu#keymap
keymap = nil,
-- options for nui Layout component: https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/layout
layout = {
position = "50%",
size = {
width = "60%",
height = "100%",
},
min_width = 40,
min_height = 10,
relative = "editor",
},
-- options for preview area: https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup
preview = {
size = "80%",
border = {
style = "rounded",
padding = { 0, 1 },
},
},
-- options for selection area: https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/menu
select = {
size = "20%",
border = {
style = "rounded",
padding = { 0, 1 },
},
},
},
--- options for snacks picker
---@type snacks.picker.Config
snacks = {
layout = { rpreset = "default" },
},
}
+3
View File
@@ -0,0 +1,3 @@
local npairs = require('nvim-autopairs')
npairs.setup({})
+34
View File
@@ -0,0 +1,34 @@
require("bufferline").setup ({
options = {
diagnostics = "nvim_lsp",
diagnostics_indicator = function(count, level, diagnostics_dict, context)
local s = " "
for e, n in pairs(diagnostics_dict) do
local sym = e == "error" and ""
or (e == "warning" and "" or "")
s = s .. n .. sym
end
return s
end,
show_close_icon = false,
show_buffer_close_icons = false,
always_show_bufferline = true,
offsets = {
{
filetype = "NvimTree",
text = "Explorer",
text_align = "center",
},
{
filetype = "snacks_layout_box",
},
},
vim.api.nvim_create_autocmd({ "BufAdd", "BufDelete" }, {
callback = function()
vim.schedule(function()
pcall(nvim_bufferline)
end)
end,
})
},
})
+106
View File
@@ -0,0 +1,106 @@
local dap = require('dap')
dap.adapters.python = function(cb, config)
if config.request == 'attach' then
---@diagnostic disable-next-line: undefined-field
local port = (config.connect or config).port
---@diagnostic disable-next-line: undefined-field
local host = (config.connect or config).host or '127.0.0.1'
cb({
type = 'server',
port = assert(port, '`connect.port` is required for a python `attach` configuration'),
host = host,
options = {
source_filetype = 'python',
},
})
else
cb({
type = 'executable',
command = 'path/to/virtualenvs/debugpy/bin/python',
args = { '-m', 'debugpy.adapter' },
options = {
source_filetype = 'python',
},
})
end
end
dap.configurations.python = {
{
-- The first three options are required by nvim-dap
type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
request = 'launch';
name = "Launch file";
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
program = "${file}"; -- This configuration will launch the current file if used.
pythonPath = function()
-- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
-- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
-- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
return cwd .. '/venv/bin/python'
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
return cwd .. '/.venv/bin/python'
else
return '/home/zach/miniconda3/bin/python'
end
end;
},
}
dap.adapters.lldb = {
type = 'executable',
command = '/usr/bin/lldb-vscode', -- adjust as needed, must be absolute path
name = 'lldb'
}
dap.configurations.cpp = {
{
name = 'Launch',
type = 'lldb',
request = 'launch',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = {},
-- 💀
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
--
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
--
-- Otherwise you might get the following error:
--
-- Error on launch: Failed to attach to the target process
--
-- But you should be aware of the implications:
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
-- runInTerminal = false,
},
}
dap.adapters["pwa-node"] = {
type = "server",
host = "localhost",
port = "${port}",
executable = {
command = "node",
-- 💀 Make sure to update this path to point to your installation
args = {"/home/zach/.config/nvim/java-dap/js-debug/src/dapDebugServer.js", "${port}"},
}
}
dap.configurations.javascript = {
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "${file}",
cwd = "${workspaceFolder}",
},
}
+51
View File
@@ -0,0 +1,51 @@
local icons = require("assets.icons").icons
require('gitsigns').setup {
signs = {
add = { text = icons.git.added },
change = { text = icons.git.modified },
delete = { text = icons.git.removed },
topdelete = { text = icons.git.removed },
changedelete = { text = icons.git.modified },
untracked = { text = '' },
},
signs_staged = {
add = { text = icons.git.added },
change = { text = icons.git.modified },
delete = { text = icons.git.removed },
topdelete = { text = icons.git.removed },
changedelete = { text = icons.git.modified },
untracked = { text = '' },
},
signs_staged_enable = true,
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
follow_files = true
},
auto_attach = true,
attach_to_untracked = false,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
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,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1
},
}
+34
View File
@@ -0,0 +1,34 @@
local harpoon = require("harpoon")
harpoon:setup()
local conf = require("telescope.config").values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end
require("telescope.pickers").new({}, {
prompt_title = "Harpoon",
finder = require("telescope.finders").new_table({
results = file_paths,
}),
previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}),
}):find()
end
vim.keymap.set("n", "<C-e>", function() toggle_telescope(harpoon:list()) end,
{ desc = "Open harpoon window" })
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<C-1>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<C-2>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<C-3>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<C-4>", function() harpoon:list():select(4) end)
vim.keymap.set("n", "<C-S-P>", function() harpoon:list():prev() end)
vim.keymap.set("n", "<C-S-N>", function() harpoon:list():next() end)
+154
View File
@@ -0,0 +1,154 @@
vim.notify = require('notify')
local icons = require("assets.icons").icons
local dap = require('dap')
require('notify').setup({
-- background_colour = "#000000",
render = "wrapped-default",
animation = "slide",
timeout = 6000,
max_width = 50,
minimum_width = 50,
level = "info",
fps = 60,
icons = {
ERROR = icons.diagnostics.Error,
WARN = icons.diagnostics.Warn,
INFO = icons.diagnostics.Info,
DEBUG = "",
TRACE = "",
},
on_open = function(win)
-- vim.api.nvim_win_set_option(win, 'wrap', true)
vim.api.nvim_win_set_option(win, 'breakat', ' ')
end,
})
-- Utility functions shared between progress reports for LSP and DAP
local client_notifs = {}
local function get_notif_data(client_id, token)
if not client_notifs[client_id] then
client_notifs[client_id] = {}
end
if not client_notifs[client_id][token] then
client_notifs[client_id][token] = {}
end
return client_notifs[client_id][token]
end
local spinner_frames = { "", "", "", "", "", "", "", "" }
local function update_spinner(client_id, token)
local notif_data = get_notif_data(client_id, token)
if notif_data.spinner then
local new_spinner = (notif_data.spinner + 1) % #spinner_frames
notif_data.spinner = new_spinner
notif_data.notification = vim.notify(nil, nil, {
hide_from_history = true,
icon = spinner_frames[new_spinner],
replace = notif_data.notification,
})
vim.defer_fn(function()
update_spinner(client_id, token)
end, 100)
end
end
local function format_title(title, client_name)
return client_name .. (#title > 0 and ": " .. title or "")
end
local function format_message(message, percentage)
return (percentage and percentage .. "%\t" or "") .. (message or "")
end
-- vim.lsp.handlers["$/progress"] = function(_, result, ctx)
-- local client_id = ctx.client_id
--
-- local val = result.value
--
-- if not val.kind then
-- return
-- end
--
-- local notif_data = get_notif_data(client_id, result.token)
--
-- if val.kind == "begin" then
-- local message = format_message(val.message, val.percentage)
--
-- notif_data.notification = vim.notify(message, "info", {
-- title = format_title(val.title, vim.lsp.get_client_by_id(client_id).name),
-- icon = spinner_frames[1],
-- timeout = false,
-- hide_from_history = false,
-- })
--
-- notif_data.spinner = 1
-- update_spinner(client_id, result.token)
-- elseif val.kind == "report" and notif_data then
-- notif_data.notification = vim.notify(format_message(val.message, val.percentage), "info", {
-- replace = notif_data.notification,
-- hide_from_history = false,
-- })
-- elseif val.kind == "end" and notif_data then
-- notif_data.notification =
-- vim.notify(val.message and format_message(val.message) or "Complete", "info", {
-- icon = "",
-- replace = notif_data.notification,
-- timeout = 6000,
-- })
--
-- notif_data.spinner = nil
-- end
-- end
--
-- local severity = {
-- "error",
-- "warn",
-- "info",
-- "info", -- map both hint and info to info?
-- }
-- vim.lsp.handlers["window/showMessage"] = function(err, method, params, client_id)
-- vim.notify(method.message, severity[params.type])
-- end
--
-- dap.listeners.before['event_progressStart']['progress-notifications'] = function(session, body)
-- local notif_data = get_notif_data("dap", body.progressId)
--
-- local message = format_message(body.message, body.percentage)
-- notif_data.notification = vim.notify(message, "info", {
-- title = format_title(body.title, session.config.type),
-- icon = spinner_frames[1],
-- timeout = false,
-- hide_from_history = false,
-- })
--
-- notif_data.notification.spinner = 1,
-- update_spinner("dap", body.progressId)
-- end
--
-- dap.listeners.before['event_progressUpdate']['progress-notifications'] = function(session, body)
-- local notif_data = get_notif_data("dap", body.progressId)
-- notif_data.notification = vim.notify(format_message(body.message, body.percentage), "info", {
-- replace = notif_data.notification,
-- hide_from_history = false,
-- })
-- end
--
-- dap.listeners.before['event_progressEnd']['progress-notifications'] = function(session, body)
-- local notif_data = client_notifs["dap"][body.progressId]
-- notif_data.notification = vim.notify(body.message and format_message(body.message) or "Complete", "info", {
-- icon = "",
-- replace = notif_data.notification,
-- timeout = 6000
-- })
-- notif_data.spinner = nil
-- end
+7
View File
@@ -0,0 +1,7 @@
local popup = require('nui.popup')
local Popup = popup({
border = {
style = "shadow",
}
})
+4
View File
@@ -0,0 +1,4 @@
require("region-folding").setup({
region_text = { start = "<think>", ending = "</think>" },
fold_indicator = "",
})