Move files out of their respective fs structure into program dirs in root and symlink dotfils using HM.

This commit is contained in:
Martin Larsson 2025-01-16 23:49:38 +00:00
parent 10bab010b7
commit fb2adb4547
72 changed files with 9 additions and 0 deletions

31
nvim/lua/plugs/arrow.lua Normal file
View file

@ -0,0 +1,31 @@
return {
"otavioschwanck/arrow.nvim",
event = "VeryLazy",
lazy = true,
opts = {
show_icons = true,
leader_key = ",",
global_bookmarks = false,
separate_by_branch = true,
custom_actions = {
open = function(filename, _)
vim.cmd(string.format(":drop %s", filename))
end,
},
mappings = {
edit = "e",
delete_mode = "d",
clear_all_items = "C",
toggle = "s",
open_vertical = "v",
open_horizontal = "h",
quit = "q",
remove = "x",
next_item = "n",
prev_item = "p",
},
window = {
border = "rounded",
}
}
}

View file

@ -0,0 +1,20 @@
return {
"rmagatti/auto-session",
opts = {
log_level = "error",
auto_session_suppress_dirs = {
"/",
"~/",
"~/Projects",
"~/Downloads",
"~/Development",
"~/Dev",
"~/Dev/Git",
"~/.config",
"~/dev/git/.dotfiles",
},
},
init = function()
vim.o.sessionoptions = "localoptions"
end
}

123
nvim/lua/plugs/ayu.lua Normal file
View file

@ -0,0 +1,123 @@
local function force_color_from_reference_on_others(others, reference)
local reference_hl = vim.api.nvim_get_hl(0, { name = reference })
for _, member in ipairs(others) do
local property = vim.api.nvim_get_hl(0, { name = member })
property.fg = reference_hl.fg
vim.api.nvim_set_hl(0, member, property)
end
end
local function reset_hl_groups_for_ft(groups_to_reset)
for _, group in ipairs(groups_to_reset) do
local ft = group[1]
local groups = group[2]
vim.api.nvim_create_autocmd("FileType", {
pattern = ft,
callback = function()
for _, group_name in ipairs(groups) do
vim.api.nvim_set_hl(0, group_name, {})
end
end,
})
end
end
return {
"Shatur/neovim-ayu",
config = function()
local is_mirage = true
local ayu = require("ayu")
local colors = require("ayu.colors")
colors.generate(is_mirage)
local overrides = {
global_variable = {
underline = true,
italic = true,
},
member_variable = {
bold = true,
},
namespace = {
italic = true,
fg = colors.markup,
},
pre_process = {
fg = colors.keyword,
},
default_type = {
fg = colors.regexp
},
type = {
fg = colors.entity,
},
}
ayu.setup({
mirage = is_mirage, -- Set to `true` to use `mirage` variant instead of `dark` for dark background.
terminal = false, -- Set to `false` to let terminal manage its own colors.
overrides = {
-- TRANSPARENCY
Normal = { bg = "none" },
NormalFloat = { bg = "none" },
ColorColumn = { bg = "none" },
SignColumn = { bg = "none" },
Folded = { bg = "none" },
FoldColumn = { bg = "none" },
CursorColumn = { bg = "none" },
VertSplit = { bg = "none" },
CursorLineNr = { bg = "none" },
-- TRANSPARENCY
["@property"] = overrides.member_variable,
["PreProc"] = overrides.pre_process,
--CPP
["@lsp.typemod.variable.fileScope.cpp"] = overrides.global_variable,
["@lsp.type.namespace.cpp"] = overrides.namespace,
["@type.builtin.cpp"] = overrides.default_type,
-- CPP
--
-- Rust
["@lsp.type.struct.rust"] = overrides.type,
["@lsp.type.namespace.rust"] = overrides.namespace,
["@lsp.type.builtinType.rust"] = overrides.default_type,
-- Rust
--
-- C
["@lsp.typemod.variable.globalScope.c"] = overrides.global_variable,
["@type.builtin.c"] = overrides.default_type,
-- C
--
-- Go
-- ["@module.go"] = overrides.namespace, -- The go LSP is not reliable enough for this sadly, sometimes it adds module tokens and sometimes it doesnt.
["@variable.member.go"] = overrides.member_variable,
["@type.builtin.go"] = overrides.default_type,
-- Go
--
-- Zig
["@module.zig"] = overrides.namespace,
["@type.builtin.zig"] = overrides.default_type,
["@function.builtin.zig"] = overrides.default_type,
-- ["@variable.member.zig"] = overrides.member_variable,-- Cant have bold member variable in zig, they don't differentiate function calls/accessors from variables, they are all just "members" .... BS LSP
-- ["@variable.parameter"] = {},-- Zig LSP is lacking, a parameter is marked as a regular variable outside of it's definition, can't separate between them.
-- Zig
},
})
ayu.colorscheme()
-- Fix nuances of the colorscheme in different languages.
-- These changes needs to run after the colorscheme is set.
force_color_from_reference_on_others({
"@property",
"@variable.member.go",
"@variable.member",
"@variable.member.zig",
}, "@variable")
reset_hl_groups_for_ft({
{ "go", { "@property", } },
})
end
}

18
nvim/lua/plugs/blink.lua Normal file
View file

@ -0,0 +1,18 @@
return {
"saghen/blink.cmp",
lazy = false,
version = "v0.*",
---@module "blink.cmp"
---@type blink.cmp.Config
opts = {
keymap = { preset = "super-tab" },
-- highlight = {
-- use_nvim_cmp_as_default = true,
-- },
-- nerd_font_variant = "mono",
},
-- allows extending the enabled_providers array elsewhere in your config
-- without having to redefining it
opts_extend = { "sources.completion.enabled_providers" }
}

View file

@ -0,0 +1,56 @@
return {
"olimorris/codecompanion.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
-- "hrsh7th/nvim-cmp",
{ 'echasnovski/mini.diff', version = false },
{ "stevearc/dressing.nvim", opts = {} },
},
config = function()
require("codecompanion").setup({
strategies = {
chat = {
adapter = "copilot",
},
inline = {
adapter = "copilot",
},
agent = {
adapter = "copilot",
},
},
adapters = {
copilot = function() return require("codecompanion.adapters").extend("copilot", {}) end,
},
display = {
diff = {
provider = "mini_diff",
},
},
opts = {
log_level = "DEBUG",
},
})
local keymaps = {
n = {
["<Leader>ci"] = { cmd = "<cmd>CodeCompanion<cr>" },
["<Leader>cc"] = { cmd = "<cmd>CodeCompanionChat toggle<cr>" },
["<Leader>cm"] = { cmd = "<cmd>CodeCompanion /commit<cr>" },
},
v = {
["<Leader>ci"] = { cmd = "<cmd>CodeCompanion<cr>" },
["ga"] = { cmd = "<cmd>CodeCompanionAdd<cr>" },
["<Leader>ce"] = { cmd = "<cmd>CodeCompanion /explain<cr>" },
["<Leader>cf"] = { cmd = "<cmd>CodeCompanion /fix<cr>" },
["<Leader>ct"] = { cmd = "<cmd>CodeCompanion /tests<cr>" },
}
}
local utils = require("utils")
utils.add_opts_to_all_mappings(keymaps, { silent = true })
utils.add_keymaps(keymaps)
vim.cmd([[cab cc CodeCompanion]])
end
}

View file

@ -0,0 +1,26 @@
return {
"mistricky/codesnap.nvim",
build = "make",
event = "VeryLazy",
lazy = true,
config = function()
require("codesnap").setup({
mac_window_bar = true,
title = "codesnap.nvim",
code_font_family = "JetBrainsMono Nerd Font",
breadcrumbs_separator = "/",
has_breadcrumbs = true,
bg_theme = "grape",
watermark = "",
})
require("utils").add_keymaps({
v = {
["<leader>cs"] = {
cmd = ":CodeSnap<CR>",
opts = { silent = true },
},
}
})
end,
}

View file

@ -0,0 +1,17 @@
return {
"norcalli/nvim-colorizer.lua",
event = "VeryLazy",
lazy = true,
opts = {
DEFAULT_OPTIONS = {
RGB = true,
RRGGBB = true,
names = false,
RRGGBBAA = true,
css = true,
css_fn = true,
mode = "background",
},
"*",
}
}

View file

@ -0,0 +1,18 @@
return {
"github/copilot.vim",
config = function()
vim.g.copilot_no_tab_map = true
require("utils").add_keymaps({
i = {
["<Right>"] = {
cmd = 'copilot#Accept("\\<Right>")',
opts = {
expr = true,
replace_keycodes = false,
silent = true,
}
}
}
})
end
}

View file

@ -0,0 +1,5 @@
return {
"nvim-tree/nvim-web-devicons",
event = "VeryLazy",
lazy = true,
}

71
nvim/lua/plugs/fzf.lua Normal file
View file

@ -0,0 +1,71 @@
return {
"ibhagwan/fzf-lua",
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {
"telescope",
winopts = {
preview = {
default = "bat"
}
},
lsp = {
workspace_symbols = {
symbol_kinds = { "Variable", "Function", "Method", "Class", "Struct", "Interface" },
},
},
previewers = {
builtin = {
-- turn off syntax highlighting for files with more than 100KB
-- this avoid hanging when previewing large files (due to treesitter parsing on minified files)
syntax_limit_b = 1024 * 100, -- 100KB
}
}
},
config = function()
local fzf = require("fzf-lua")
local pickers = {
{
mapping = "o",
action = function()
fzf.files({
git_icons = false,
})
end
},
{
mapping = "a",
action = function()
fzf.live_grep_native({
git_icons = false,
rg_opts = "--hidden --column --line-number --no-heading --color=always --smart-case",
fzf_opts = {
['--exact'] = false, -- Disable exact matching
},
})
end
},
{
mapping = "g",
action = function()
fzf.git_bcommits({})
end
},
{
mapping = "s",
action = function()
fzf.lsp_live_workspace_symbols({})
end
}
}
local keymaps = {}
keymaps.n = {}
for _, picker in ipairs(pickers) do
keymaps.n["<leader>t" .. picker.mapping] = {
cmd = picker.action
}
end
require("utils").add_keymaps(keymaps)
end
}

101
nvim/lua/plugs/incline.lua Normal file
View file

@ -0,0 +1,101 @@
return {
"b0o/incline.nvim",
dependencies = {
"lewis6991/gitsigns.nvim"
},
event = "VeryLazy",
lazy = true,
config = function()
local gitsigns = require("gitsigns")
gitsigns.setup({})
local devicons = require("nvim-web-devicons")
require("incline").setup({
window = {
padding = 0,
},
hide = {
cursorline = true,
},
render = function(props)
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
if filename == "" then
filename = "[No Name]"
end
local ft_icon, ft_color = devicons.get_icon_color(filename)
local function get_git_diff()
local icons = { removed = "", changed = "", added = "" }
local signs = vim.b[props.buf].gitsigns_status_dict
local labels = {}
if signs == nil then
return labels
end
for name, icon in pairs(icons) do
if tonumber(signs[name]) and signs[name] > 0 then
table.insert(labels, { icon .. " " .. signs[name] .. " ", group = "Diff" .. name })
end
end
if #labels > 0 then
table.insert(labels, { "" })
end
return labels
end
local function get_diagnostic_label()
local icons = { error = "", warn = "", info = "", hint = "" }
local label = {}
for severity, icon in pairs(icons) do
local n = #vim.diagnostic.get(props.buf,
{ severity = vim.diagnostic.severity[string.upper(severity)] })
if n > 0 then
table.insert(label, { icon .. " " .. n .. " ", group = "DiagnosticSign" .. severity })
end
end
if #label > 0 then
table.insert(label, { "" })
end
return label
end
local function get_arrow_label()
local statusline = require("arrow.statusline")
if statusline.is_on_arrow_file(props.buf) == nil then
return ""
end
return " " .. statusline.text_for_statusline_with_icons(props.buf)
end
return {
guibg = "#1e2030",
guifg = "#cad3f5",
{ " " },
{ get_diagnostic_label() },
{ get_git_diff() },
{ (ft_icon or "") .. " ", guifg = ft_color, guibg = "none" },
{ filename .. "", gui = vim.bo[props.buf].modified and "bold,italic" or "bold" },
{ get_arrow_label() .. "" .. vim.api.nvim_win_get_number(props.win), group = "DevIconWindows" },
{ " " }
}
end,
require("utils").add_keymaps({
n = {
["<leader>gh"] = {
cmd = gitsigns.preview_hunk
},
["<leader>gb"] = {
cmd = gitsigns.toggle_current_line_blame
},
["[g"] = {
cmd = function() gitsigns.nav_hunk("prev") end
},
["]g"] = {
cmd = function() gitsigns.nav_hunk("next") end
}
}
})
})
end,
}

View file

@ -0,0 +1,11 @@
return {
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
event = "BufRead",
opts = {
debounce = 100,
scope = {
enabled = false
},
}
}

94
nvim/lua/plugs/leap.lua Normal file
View file

@ -0,0 +1,94 @@
local saved_hlsearch = false
local saved_highlights = {}
local colors = require("ayu.colors")
colors.generate(true)
local function save_and_set_invisible_inlay_hints_hl()
saved_highlights = vim.api.nvim_get_hl(0, { name = "LspInlayHint" })
vim.api.nvim_set_hl(0, "LspInlayHint", { fg = colors.bg, bg = "none" })
end
local function restore_inlay_hints_hl()
vim.api.nvim_set_hl(0, "LspInlayHint", saved_highlights)
end
return {
"ggandor/leap.nvim",
dependencies = {
{ "tpope/vim-repeat", lazy = true },
},
event = "VeryLazy",
lazy = true,
config = function()
local leap = require("leap")
-- Disable auto jumping to the first match
-- Autojumping is not intuitive when running bi-directional leaps
leap.opts.safe_labels = {}
-- Adding more labels since we're not using autojumping. These are sorted by priority
-- focusing on the home row and the strongest fingers for Colemak-DH
leap.opts.labels = "tsragneiomdch,pfluxzv./kwqby;j1234567890{}()[]<>J!@#$%^&*TSRAGNEIOMDCHPFLUXZV?KWQBY:"
local autocmds = {
{
event_name = "LeapEnter",
cb = function()
saved_hlsearch = vim.o.hlsearch
vim.o.hlsearch = false
save_and_set_invisible_inlay_hints_hl()
end
},
{
event_name = "LeapLeave",
cb = function()
vim.o.hlsearch = saved_hlsearch
restore_inlay_hints_hl()
end
},
}
local utils = require("utils")
local leap_augroup_name = "LeapEvents"
vim.api.nvim_create_augroup(leap_augroup_name, { clear = true })
for _, cmd in ipairs(autocmds) do
utils.create_user_event_cb(cmd.event_name, cmd.cb, leap_augroup_name)
end
local leap_user = require("leap.user")
local function leap_across_windows()
leap.leap({
target_windows = leap_user.get_focusable_windows()
})
end
local function leap_in_current_buffer()
leap.leap({
target_windows = { vim.api.nvim_get_current_win() }
})
end
utils.add_keymaps({
n = {
["m"] = {
cmd = function()
leap_across_windows()
end,
},
},
v = {
["m"] = {
cmd = function()
leap_in_current_buffer()
end,
}
},
o = {
["m"] = {
cmd = function()
leap_in_current_buffer()
end,
}
}
})
end,
}

View file

@ -0,0 +1,65 @@
return {
-- "nvimdev/lspsaga.nvim",
"LarssonMartin1998/lspsaga.nvim", -- Use my own fork until PR's are merged
event = "LspAttach",
lazy = true,
-- dir = "~/dev/git/lspsaga.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
after = "nvim-lspconfig",
config = function()
require("lspsaga").setup({
request_timeout = 750,
symbol_in_winbar = {
enable = false,
},
implement = {
enable = false,
},
outline = {
enable = false,
win_width = 52,
},
ui = {
border = "rounded",
title = false,
},
code_action = {
extend_gitsigns = true
},
hover = {
jump_on_first_press = true
},
})
local keymaps = {
n = {
["K"] = {
cmd = ":Lspsaga hover_doc<CR>"
},
["<leader>rn"] = {
cmd = ":Lspsaga rename<CR>"
},
["gr"] = {
cmd = ":Lspsaga finder<CR>"
},
["<leader>lt"] = {
cmd = ":Lspsaga peek_type_definition<CR>"
},
["<leader>ld"] = {
cmd = ":Lspsaga peek_definition<CR>"
},
["<leader>ca"] = {
cmd = ":Lspsaga code_action<CR>"
},
["<leader>lc"] = {
cmd = ":Lspsaga incoming_calls<CR>"
},
}
}
local utils = require("utils")
utils.add_opts_to_all_mappings(keymaps, { silent = true })
utils.add_keymaps(keymaps)
end,
}

View file

@ -0,0 +1,51 @@
local wm = require("window_management")
local function resize_mode()
if wm.is_in_resizing_mode() then
return "▲ Resizing ▼"
else
return ""
end
end
return {
"nvim-lualine/lualine.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons"
},
event = "VeryLazy",
lazy = true,
config = function()
require("lualine").setup {
options = {
theme = "ayu",
section_separators = {
left = "",
right = "",
},
component_separators = {
left = "",
right = ""
},
icons_enabled = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", resize_mode },
lualine_c = { "buffers" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = {}
},
tabline = {},
}
end
}

36
nvim/lua/plugs/mason.lua Normal file
View file

@ -0,0 +1,36 @@
return {
"williamboman/mason.nvim",
dependencies = { "WhoIsSethDaniel/mason-tool-installer.nvim" },
config = function()
require("mason").setup({})
require("mason-tool-installer").setup({
ensure_installed = {
-- LLVM debugger
"codelldb",
-- C and C++
"clangd",
"clang-format",
-- Rust
"rust-analyzer",
-- Go
"gopls",
"golangci-lint",
"delve",
-- Lua
"lua-language-server",
-- CMake
"cmake-language-server",
"cmakelang",
-- Python
"debugpy",
"pyright",
},
})
end
}

11
nvim/lua/plugs/neogit.lua Normal file
View file

@ -0,0 +1,11 @@
return {
"NeogitOrg/neogit",
dependencies = {
"sindrets/diffview.nvim",
},
event = "VeryLazy",
lazy = true,
config = function()
require("neogit").setup()
end
}

18
nvim/lua/plugs/neorg.lua Normal file
View file

@ -0,0 +1,18 @@
return {
"nvim-neorg/neorg",
opts = {
load = {
["core.defaults"] = {},
["core.dirman"] = {
config = {
workspaces = {
my_workspace = "~/.neorg",
},
},
},
["core.concealer"] = {},
},
},
event = "VeryLazy",
lazy = true,
}

37
nvim/lua/plugs/noice.lua Normal file
View file

@ -0,0 +1,37 @@
return {
"folke/noice.nvim",
event = "VeryLazy",
lazy = true,
dependencies = {
{ "MunifTanjim/nui.nvim", lazy = true },
{
"rcarriga/nvim-notify",
opts = {
background_colour = "#24273a",
fps = 1,
render = "compact",
stages = "static"
}
}
},
opts = {
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
-- ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
},
},
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = false, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
notify = {
level = "warn"
}
}
}

152
nvim/lua/plugs/nvim-dap.lua Normal file
View file

@ -0,0 +1,152 @@
local utils = require("utils")
local inlay_hints_handler = require("inlay_hints_handler")
local are_stepping_keymaps_active = false
return {
"mfussenegger/nvim-dap",
dependencies = {
"rcarriga/nvim-dap-ui",
-- Special adapters
"leoluz/nvim-dap-go",
"mfussenegger/nvim-dap-python",
{ "nvim-neotest/nvim-nio", lazy = true },
"LiadOz/nvim-dap-repl-highlights",
"theHamsta/nvim-dap-virtual-text",
"Weissle/persistent-breakpoints.nvim",
},
config = function()
local dap = require("dap")
local dapui = require("dapui")
-- Special adapters
require("dap-go").setup()
require("dap-python").setup("python3")
-- Special adapters
require("dap.ext.vscode").load_launchjs()
require("persistent-breakpoints").setup {
load_breakpoints_event = { "BufReadPost" }
}
require("nvim-dap-repl-highlights").setup()
require("nvim-dap-virtual-text").setup()
local virtual_text = require("nvim-dap-virtual-text/virtual_text")
local breakpoint_api = require("persistent-breakpoints.api")
dapui.setup({
controls = {
enabled = false,
},
layouts = {
{
elements = {
{
id = "watches",
size = 0.5
},
{
id = "stacks",
size = 0.5
}
},
position = "bottom",
size = 15
}
},
})
local stepping_keymaps = {
n = {
["m"] = {
cmd = function()
dap.step_out()
end
},
["n"] = {
cmd = function()
dap.step_over()
end
},
["i"] = {
cmd = function()
dap.step_into()
end
},
}
}
local function enter_debug_mode()
dapui.open()
if not are_stepping_keymaps_active then
utils.add_temporary_keymaps(stepping_keymaps)
are_stepping_keymaps_active = true
end
inlay_hints_handler.disable()
end
local function exit_debug_mode()
dapui.close()
if are_stepping_keymaps_active then
utils.remove_keymaps(stepping_keymaps)
are_stepping_keymaps_active = false
end
inlay_hints_handler.restore()
virtual_text.clear_virtual_text()
end
local dap_signs = {
{ "DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" } },
{ "DapBreakpointRejected", { text = "🔵", texthl = "", linehl = "", numhl = "" } },
{ "DapBreakpointCondition", { text = "🟥", texthl = "", linehl = "", numhl = "" } },
}
for _, sign in ipairs(dap_signs) do
vim.fn.sign_define(unpack(sign))
end
dap.listeners.after.event_initialized["dapui_config"] = function()
enter_debug_mode()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
exit_debug_mode()
end
dap.listeners.before.event_exited["dapui_config"] = function()
exit_debug_mode()
end
utils.add_keymaps({
n = {
["<leader>dr"] = {
cmd = function()
dap.continue()
end
},
["<leader>bt"] = {
cmd = function()
breakpoint_api.toggle_breakpoint()
end
},
["<leader>bc"] = {
cmd = function()
breakpoint_api.set_conditional_breakpoint()
end
},
["<leader>br"] = { -- breakpoint remove
cmd = function()
breakpoint_api.clear_all_breakpoints()
end
},
["<leader>ds"] = {
cmd = function()
dap.disconnect({ terminateDebuggee = true })
dap.close()
exit_debug_mode()
end
},
}
})
end,
}

View file

@ -0,0 +1,4 @@
return {
"nvim-lua/plenary.nvim",
lazy = true,
}

View file

@ -0,0 +1,61 @@
local utils = require("utils")
local inlay_hints_handler = require("inlay_hints_handler")
local format_handler = require("format_handler")
return {
"mrcjkb/rustaceanvim",
version = "^5",
ft = { "rust" },
config = function()
vim.g.rustaceanvim = {
inlay_hints = {
highlight = "NonText",
},
tools = {
hover_actions = {
auto_focus = true,
},
},
server = {
on_attach = function(client, bufnr)
inlay_hints_handler.add_buffer(bufnr)
if client.server_capabilities.documentFormattingProvider then
vim.api.nvim_buf_create_user_command(bufnr, "Format", vim.lsp.buf.format, { nargs = 0 })
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr,
callback = function()
format_handler.format()
end,
})
end
utils.add_keymaps({
n = {
["gd"] = {
cmd = function()
vim.lsp.buf.definition()
end,
opts = {
noremap = true,
silent = true,
buffer = bufnr,
}
},
["gD"] = {
cmd = function()
vim.lsp.buf.declaration()
end,
opts = {
noremap = true,
silent = true,
buffer = bufnr,
}
},
}
})
end,
}
}
end,
}

View file

@ -0,0 +1,15 @@
return {
"kylechui/nvim-surround",
version = "*",
event = "VeryLazy",
lazy = true,
opts = {
-- Make sure that we never get whitespaces when adding surroundings
surrounds = {
["("] = { add = { "(", ")" }, },
["{"] = { add = { "{", "}" }, },
["<"] = { add = { "<", ">" }, },
["["] = { add = { "[", "]" }, },
}
}
}

View file

@ -0,0 +1,19 @@
return {
"rachartier/tiny-inline-diagnostic.nvim",
event = "VeryLazy",
priority = 1000,
config = function()
require("tiny-inline-diagnostic").setup()
vim.diagnostic.config({
virtual_text = false,
})
vim.cmd [[
highlight DiagnosticUnderlineError gui=undercurl guisp=#ff0000 " Red for error
highlight DiagnosticUnderlineWarn gui=undercurl guisp=#ffaa00 " Yellow/Orange for warning
highlight DiagnosticUnderlineHint gui=undercurl guisp=#00ffff " Cyan for hint
highlight DiagnosticUnderlineInfo gui=undercurl guisp=#0000ff " Blue for info
]]
end
}

View file

@ -0,0 +1,85 @@
return {
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPre", "BufNewFile" },
build = ":TSUpdate",
dependencies = {
{
"nvim-treesitter/nvim-treesitter-context",
opts = {
max_lines = 2, -- How many lines the window should span. Values <= 0 mean no limit.
multiline_threshold = 3, -- Maximum number of lines to show for a single context
trim_scope = "inner", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
}
},
"nvim-treesitter/nvim-treesitter-textobjects",
},
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"vim",
"vimdoc",
"bash",
"lua",
"c",
"cpp",
"c_sharp",
"rust",
"cmake",
"make",
"yaml",
"ninja",
"gitignore",
"markdown",
"markdown_inline",
"hyprlang",
"json",
"html",
"hlsl",
"glsl",
"gdshader",
"gdscript",
"dockerfile",
"dart",
"go",
"zig",
"css",
"regex",
"dap_repl",
"muttrc",
"python",
},
sync_install = false,
-- This can be updated to a list of languages instead of defaulting to true
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-cr>",
node_incremental = "<C-cr>",
scope_incremental = false,
node_decremental = "<C-bs>",
},
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["ic"] = { query = "@class.inner" },
["ac"] = { query = "@class.outer" },
["ii"] = { query = "@conditional.inner" },
["ai"] = { query = "@conditional.outer" },
["if"] = { query = "@function.inner" },
["af"] = { query = "@function.outer" },
["il"] = { query = "@loop.inner" },
["al"] = { query = "@loop.outer" },
},
},
},
})
end
}