aboutsummaryrefslogtreecommitdiffstats
path: root/home/nvim/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'home/nvim/plugins')
-rw-r--r--home/nvim/plugins/dap.lua246
-rw-r--r--home/nvim/plugins/mini.lua2
-rw-r--r--home/nvim/plugins/treesitter.lua152
3 files changed, 200 insertions, 200 deletions
diff --git a/home/nvim/plugins/dap.lua b/home/nvim/plugins/dap.lua
index c20ae36..8a37318 100644
--- a/home/nvim/plugins/dap.lua
+++ b/home/nvim/plugins/dap.lua
@@ -1,128 +1,128 @@
-- 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")
+ local dap = require("dap")
+ local dapview = require("dap-view")
+ local dapvt = require("nvim-dap-virtual-text")
- dapview.setup({})
+ 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,
- }
+ 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 },
- },
- }
+ -- === 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 = {},
- },
- }
+ -- === 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 },
- }
+ -- === 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
+ -- === 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, {})
+ 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
@@ -130,18 +130,18 @@ 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,
+ 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,
+ 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
index f41f1b4..75a3912 100644
--- a/home/nvim/plugins/mini.lua
+++ b/home/nvim/plugins/mini.lua
@@ -9,6 +9,6 @@ require("mini.sessions").setup()
require("mini.starter").setup()
require("mini.statusline").setup()
require("mini.tabline").setup({
- show_icons = true
+ show_icons = true
})
require("mini.completion").setup()
diff --git a/home/nvim/plugins/treesitter.lua b/home/nvim/plugins/treesitter.lua
index 314e4a3..0b688ec 100644
--- a/home/nvim/plugins/treesitter.lua
+++ b/home/nvim/plugins/treesitter.lua
@@ -1,81 +1,81 @@
local function disable(lang, buf)
- local max_filesize = 100 * 1024 -- 100 KB
- local ok, stats = pcall(vim.uv.fs_stat, vim.api.nvim_buf_get_name(buf))
- if ok and stats and stats.size > max_filesize then
- return true
- end
+ local max_filesize = 100 * 1024 -- 100 KB
+ local ok, stats = pcall(vim.uv.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").setup({
- auto_install = false,
- ensure_installed = {},
- ignore_install = {},
- modules = {},
- sync_install = false,
- highlight = {
- additional_vim_regex_highlighting = false,
- disable = disable,
- enable = true,
- },
- indent = { enable = true, disable = { "rust", "lua", "python", "golang", "nix", "json", "html", "javascript" } },
- incremental_selection = {
- enable = true,
- keymaps = {
- init_selection = "<leader>vv",
- node_decremental = "_",
- node_incremental = "+",
- scope_incremental = false,
- },
- },
- 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",
- },
- },
- },
+ auto_install = false,
+ ensure_installed = {},
+ ignore_install = {},
+ modules = {},
+ sync_install = false,
+ highlight = {
+ additional_vim_regex_highlighting = false,
+ disable = disable,
+ enable = true,
+ },
+ indent = { enable = true, disable = { "rust", "lua", "python", "golang", "nix", "json", "html", "javascript" } },
+ incremental_selection = {
+ enable = true,
+ keymaps = {
+ init_selection = "<leader>vv",
+ node_decremental = "_",
+ node_incremental = "+",
+ scope_incremental = false,
+ },
+ },
+ 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",
+ },
+ },
+ },
})