aboutsummaryrefslogtreecommitdiffstats
path: root/home/nvim/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'home/nvim/plugins')
-rw-r--r--home/nvim/plugins/dap.lua147
-rw-r--r--home/nvim/plugins/mini.lua14
-rw-r--r--home/nvim/plugins/other.lua5
-rw-r--r--home/nvim/plugins/treesitter.lua81
-rw-r--r--home/nvim/plugins/undotree.lua1
-rw-r--r--home/nvim/plugins/which.lua6
6 files changed, 254 insertions, 0 deletions
diff --git a/home/nvim/plugins/dap.lua b/home/nvim/plugins/dap.lua
new file mode 100644
index 0000000..c20ae36
--- /dev/null
+++ b/home/nvim/plugins/dap.lua
@@ -0,0 +1,147 @@
+-- Store DAP configuration in a function to load on demand
+local function setup_dap()
+ local dap = require("dap")
+ local dapview = require("dap-view")
+ local dapvt = require("nvim-dap-virtual-text")
+
+ dapview.setup({})
+
+ dapvt.setup {
+ enabled = true,
+ enabled_commands = true,
+ highlight_changed_variables = true,
+ highlight_new_as_changed = false,
+ show_stop_reason = true,
+ commented = false,
+ only_first_definition = true,
+ all_references = false,
+ clear_on_continue = false,
+ display_callback = function(variable, buf, stackframe, node, options)
+ if options.virt_text_pos == "inline" then
+ return " = " .. variable.value:gsub("%s+", " ")
+ else
+ return variable.name .. " = " .. variable.value:gsub("%s+", " ")
+ end
+ end,
+ all_frames = true,
+ virt_lines = true,
+ virt_text_win_col = nil,
+ }
+
+ -- === PYTHON ===
+ dap.adapters.python = {
+ type = "executable",
+ command = "python",
+ args = { "-m", "debugpy.adapter" },
+ }
+ dap.configurations.python = {
+ {
+ type = "python",
+ request = "launch",
+ name = "Launch file",
+ program = "${file}",
+ console = "integratedTerminal",
+ justMyCode = true,
+ },
+ {
+ type = "python",
+ request = "attach",
+ name = "Attach to process",
+ connect = { host = "127.0.0.1", port = 5678 },
+ },
+ }
+
+ -- === RUST ===
+ dap.adapters.lldb = {
+ type = "executable",
+ command = "lldb-dap",
+ name = "lldb",
+ }
+ dap.configurations.rust = {
+ {
+ name = "Launch (LLDB)",
+ type = "lldb",
+ request = "launch",
+ program = function()
+ return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/target/debug/", "file")
+ end,
+ cwd = "${workspaceFolder}",
+ stopOnEntry = false,
+ args = {},
+ runInTerminal = false,
+ },
+ {
+ name = "Attach to process (LLDB)",
+ type = "lldb",
+ request = "attach",
+ pid = require("dap.utils").pick_process,
+ args = {},
+ },
+ }
+
+ -- === GO ===
+ dap.adapters.go = {
+ type = "executable",
+ command = "dlv",
+ args = { "dap" },
+ }
+ dap.configurations.go = {
+ { type = "go", name = "Debug main.go", request = "launch", program = "${file}" },
+ { type = "go", name = "Debug package", request = "launch", program = "${workspaceFolder}" },
+ { type = "go", name = "Attach to process", request = "attach", processId = require("dap.utils").pick_process },
+ }
+
+ -- === EVENT LISTENERS ===
+ dap.listeners.after.event_initialized["dapview_config"] = function() dapview.open() end
+ dap.listeners.before.event_terminated["dapview_config"] = function() dapview.close() end
+ dap.listeners.before.event_exited["dapview_config"] = function() dapview.close() end
+end
+
+-- Define custom commands to trigger DAP setup
+local function define_dap_commands()
+ vim.api.nvim_create_user_command("DapContinue", function()
+ setup_dap()
+ require("dap").continue()
+ end, {})
+ vim.api.nvim_create_user_command("DapToggleBreakpoint", function()
+ setup_dap()
+ require("dap").toggle_breakpoint()
+ end, {})
+ vim.api.nvim_create_user_command("DapStepOver", function()
+ setup_dap()
+ require("dap").step_over()
+ end, {})
+ vim.api.nvim_create_user_command("DapStepInto", function()
+ setup_dap()
+ require("dap").step_into()
+ end, {})
+ vim.api.nvim_create_user_command("DapStepOut", function()
+ setup_dap()
+ require("dap").step_out()
+ end, {})
+ vim.api.nvim_create_user_command("DapTerminate", function()
+ setup_dap()
+ require("dap").terminate()
+ end, {})
+end
+
+-- Create autocommand group for DAP
+local augroup = vim.api.nvim_create_augroup("DapLazyLoad", { clear = true })
+
+-- Load DAP on filetypes
+vim.api.nvim_create_autocmd("FileType", {
+ group = augroup,
+ pattern = { "python", "rust", "go" },
+ callback = function()
+ define_dap_commands()
+ end,
+})
+
+-- Load DAP on specific commands
+vim.api.nvim_create_autocmd("CmdUndefined", {
+ group = augroup,
+ pattern = { "DapContinue", "DapToggleBreakpoint", "DapStepOver", "DapStepInto", "DapStepOut", "DapTerminate" },
+ callback = function()
+ define_dap_commands()
+ end,
+})
diff --git a/home/nvim/plugins/mini.lua b/home/nvim/plugins/mini.lua
new file mode 100644
index 0000000..f41f1b4
--- /dev/null
+++ b/home/nvim/plugins/mini.lua
@@ -0,0 +1,14 @@
+require("mini.animate").setup()
+require("mini.diff").setup()
+require("mini.files").setup()
+require("mini.git").setup()
+require("mini.icons").setup()
+require("mini.notify").setup()
+require("mini.pick").setup()
+require("mini.sessions").setup()
+require("mini.starter").setup()
+require("mini.statusline").setup()
+require("mini.tabline").setup({
+ show_icons = true
+})
+require("mini.completion").setup()
diff --git a/home/nvim/plugins/other.lua b/home/nvim/plugins/other.lua
new file mode 100644
index 0000000..10efd0e
--- /dev/null
+++ b/home/nvim/plugins/other.lua
@@ -0,0 +1,5 @@
+-- hardtime
+require("hardtime").setup()
+
+vim.g.nord_italic = true
+require("nord").set()
diff --git a/home/nvim/plugins/treesitter.lua b/home/nvim/plugins/treesitter.lua
new file mode 100644
index 0000000..968af11
--- /dev/null
+++ b/home/nvim/plugins/treesitter.lua
@@ -0,0 +1,81 @@
+local function disable(lang, buf)
+ local max_filesize = 100 * 1024 -- 100 KB
+ local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
+ if ok and stats and stats.size > max_filesize then
+ return true
+ end
+end
+
+require("nvim-treesitter.configs").setup({
+ ensure_installed = {},
+ sync_install = false,
+ ignore_install = {},
+ modules = {},
+ auto_install = false,
+ highlight = {
+ enable = true,
+ disable = disable,
+ additional_vim_regex_highlighting = false,
+ },
+ indent = { enable = true, disable = { "rust", "lua", "python", "golang", "nix", "json", "html", "javascript" } },
+ incremental_selection = {
+ enable = true,
+ keymaps = {
+ init_selection = "<leader>vv",
+ node_incremental = "+",
+ scope_incremental = false,
+ node_decremental = "_",
+ },
+ },
+ textobjects = {
+ select = {
+ enable = true,
+ lookahead = true,
+ keymaps = {
+ -- You can use the capture groups defined in textobjects.scm
+ ["af"] = { query = "@function.outer", desc = "around a function" },
+ ["if"] = { query = "@function.inner", desc = "inner part of a function" },
+ ["ac"] = { query = "@class.outer", desc = "around a class" },
+ ["ic"] = { query = "@class.inner", desc = "inner part of a class" },
+ ["ai"] = { query = "@conditional.outer", desc = "around an if statement" },
+ ["ii"] = { query = "@conditional.inner", desc = "inner part of an if statement" },
+ ["al"] = { query = "@loop.outer", desc = "around a loop" },
+ ["il"] = { query = "@loop.inner", desc = "inner part of a loop" },
+ ["ap"] = { query = "@parameter.outer", desc = "around parameter" },
+ ["ip"] = { query = "@parameter.inner", desc = "inside a parameter" },
+ },
+ selection_modes = {
+ ["@parameter.outer"] = "v", -- charwise
+ ["@parameter.inner"] = "v", -- charwise
+ ["@function.outer"] = "v", -- charwise
+ ["@conditional.outer"] = "V", -- linewise
+ ["@loop.outer"] = "V", -- linewise
+ ["@class.outer"] = "<c-v>", -- blockwise
+ },
+ include_surrounding_whitespace = false,
+ },
+ move = {
+ enable = true,
+ set_jumps = true, -- whether to set jumps in the jumplist
+ goto_previous_start = {
+ ["[f"] = { query = "@function.outer", desc = "Previous function" },
+ ["[c"] = { query = "@class.outer", desc = "Previous class" },
+ ["[p"] = { query = "@parameter.inner", desc = "Previous parameter" },
+ },
+ goto_next_start = {
+ ["]f"] = { query = "@function.outer", desc = "Next function" },
+ ["]c"] = { query = "@class.outer", desc = "Next class" },
+ ["]p"] = { query = "@parameter.inner", desc = "Next parameter" },
+ },
+ },
+ swap = {
+ enable = true,
+ swap_next = {
+ ["<leader>a"] = "@parameter.inner",
+ },
+ swap_previous = {
+ ["<leader>A"] = "@parameter.inner",
+ },
+ },
+ },
+})
diff --git a/home/nvim/plugins/undotree.lua b/home/nvim/plugins/undotree.lua
new file mode 100644
index 0000000..b6b9276
--- /dev/null
+++ b/home/nvim/plugins/undotree.lua
@@ -0,0 +1 @@
+vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
diff --git a/home/nvim/plugins/which.lua b/home/nvim/plugins/which.lua
new file mode 100644
index 0000000..09aa796
--- /dev/null
+++ b/home/nvim/plugins/which.lua
@@ -0,0 +1,6 @@
+local wk = require("which-key")
+wk.add({
+ "<leader>?",
+ function() require("which-key").show({ global = false }) end,
+ desc = "Buffer Local Keymaps (which-key)",
+})