diff --git a/lua/custom/chadrc.lua b/lua/custom/chadrc.lua index 0446c07..5d20eeb 100644 --- a/lua/custom/chadrc.lua +++ b/lua/custom/chadrc.lua @@ -5,8 +5,8 @@ local M = {} local highlights = require "custom.highlights" M.ui = { - theme = "gatekeeper", - theme_toggle = { "gatekeeper", "monekai" }, + theme = "onedark", + theme_toggle = { "onedark", "monekai" }, hl_override = highlights.override, hl_add = highlights.add, diff --git a/lua/custom/configs/lspconfig.lua b/lua/custom/configs/lspconfig.lua index d6f7f2b..e2338f6 100644 --- a/lua/custom/configs/lspconfig.lua +++ b/lua/custom/configs/lspconfig.lua @@ -4,7 +4,7 @@ local capabilities = require("plugins.configs.lspconfig").capabilities local lspconfig = require "lspconfig" -- if you just want default config for the servers then put them in a table -local servers = { "html", "cssls", "tsserver", "clangd" } +local servers = { "html", "cssls", "tsserver", "clangd", "salt_ls" } for _, lsp in ipairs(servers) do lspconfig[lsp].setup { diff --git a/lua/custom/configs/overrides.lua b/lua/custom/configs/overrides.lua index c4cd2c7..ba3404e 100644 --- a/lua/custom/configs/overrides.lua +++ b/lua/custom/configs/overrides.lua @@ -19,6 +19,15 @@ M.treesitter = { -- "python" -- }, }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, } M.mason = { diff --git a/lua/plugins/configs/hydra.lua b/lua/plugins/configs/hydra.lua new file mode 100644 index 0000000..0de6133 --- /dev/null +++ b/lua/plugins/configs/hydra.lua @@ -0,0 +1,35 @@ +local Hydra = require("hydra") + +Hydra({ + name = "Change / Resize Window", + mode = { "n" }, + body = "t", + config = { + -- color = "pink", + }, + heads = { + -- move between windows + { "", "h", { desc="Noot nooty" } }, + { "", "j" }, + { "", "k" }, + { "", "l" }, + + -- resizing window + { "H", "3<" }, + { "L", "3>" }, + { "K", "2+" }, + { "J", "2-" }, + + -- equalize window sizes + { "e", "=" }, + + -- close active window + { "Q", ":q" }, + { "", ":q" }, + + -- exit this Hydra + { "q", nil, { exit = true, nowait = true } }, + { ";", nil, { exit = true, nowait = true } }, + { "", nil, { exit = true, nowait = true } }, + }, +}) diff --git a/lua/plugins/configs/treesitter_textobjects.lua b/lua/plugins/configs/treesitter_textobjects.lua new file mode 100644 index 0000000..e047136 --- /dev/null +++ b/lua/plugins/configs/treesitter_textobjects.lua @@ -0,0 +1,133 @@ +local M = {} + +M.textobjects = { + select = { + enable = true, + + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["a="] = { query = "@assignment.outer", desc = "Select outer part of an assignment" }, + ["i="] = { query = "@assignment.inner", desc = "Select inner part of an assignment" }, + ["l="] = { query = "@assignment.lhs", desc = "Select left hand side of an assignment" }, + ["r="] = { query = "@assignment.rhs", desc = "Select right hand side of an assignment" }, + + ["aa"] = { query = "@parameter.outer", desc = "Select outer part of a parameter/argument" }, + ["ia"] = { query = "@parameter.inner", desc = "Select inner part of a parameter/argument" }, + + ["ai"] = { query = "@conditional.outer", desc = "Select outer part of a conditional" }, + ["ii"] = { query = "@conditional.inner", desc = "Select inner part of a conditional" }, + + ["al"] = { query = "@loop.outer", desc = "Select outer part of a loop" }, + ["il"] = { query = "@loop.inner", desc = "Select inner part of a loop" }, + + ["af"] = { query = "@call.outer", desc = "Select outer part of a function call" }, + ["if"] = { query = "@call.inner", desc = "Select inner part of a function call" }, + + ["am"] = { query = "@function.outer", desc = "Select outer part of a function def" }, + ["im"] = { query = "@function.inner", desc = "Select inner part of a function def" }, + + ["ak"] = { query = "@class.outer", desc = "Select outer part of a class" }, + ["ik"] = { query = "@class.inner", desc = "Select inner part of a class" }, + + ["ac"] = { query = "@comment.outer", desc = "Select outer part of a comment" }, + ["ic"] = { query = "@comment.inner", desc = "Select inner part of a comment" }, + }, + }, + move = { + enable = true, + -- Whether to set jumps in the jumplist + set_jumps = true, + goto_next_start = { + ["]a"] = { query = "@parameter.outer", desc = "Goto next start outer parameter" }, + ["]i"] = { query = "@conditional.outer", desc = "Goto next start outer conditional" }, + ["]l"] = { query = "@loop.outer", desc = "Goto next start outer loop" }, + ["]f"] = { query = "@call.outer", desc = "Goto next start outer call" }, + ["]m"] = { query = "@function.outer", desc = "Goto next start outer function" }, + ["]k"] = { query = "@class.outer", desc = "Goto next start outer class" }, + ["]c"] = { query = "@comment.outer", desc = "Goto next start outer comment" }, + }, + goto_next_end = { + ["]A"] = { query = "@parameter.outer", desc = "Goto next end outer parameter" }, + ["]I"] = { query = "@conditional.outer", desc = "Goto next end outer conditional" }, + ["]L"] = { query = "@loop.outer", desc = "Goto next end outer loop" }, + ["]F"] = { query = "@call.outer", desc = "Goto next end outer call" }, + ["]M"] = { query = "@function.outer", desc = "Goto next end outer function" }, + ["]K"] = { query = "@class.outer", desc = "Goto next end outer class" }, + ["]C"] = { query = "@comment.outer", desc = "Goto next end outer comment" }, + }, + goto_previous_start = { + ["[a"] = { query = "@parameter.outer", desc = "Goto previous start outer parameter" }, + ["[i"] = { query = "@conditional.outer", desc = "Goto previous start outer conditional" }, + ["[l"] = { query = "@loop.outer", desc = "Goto previous start outer loop" }, + ["[f"] = { query = "@call.outer", desc = "Goto previous start outer call" }, + ["[m"] = { query = "@function.outer", desc = "Goto previous start outer function" }, + ["[k"] = { query = "@class.outer", desc = "Goto previous start outer class" }, + ["[c"] = { query = "@comment.outer", desc = "Goto previous start outer comment" }, + }, + goto_previous_end = { + ["[A"] = { query = "@parameter.outer", desc = "Goto previous end outer parameter" }, + ["[I"] = { query = "@conditional.outer", desc = "Goto previous end outer conditional" }, + ["[L"] = { query = "@loop.outer", desc = "Goto previous end outer loop" }, + ["[F"] = { query = "@call.outer", desc = "Goto previous end outer call" }, + ["[M"] = { query = "@function.outer", desc = "Goto previous end outer function" }, + ["[K"] = { query = "@class.outer", desc = "Goto previous end outer class" }, + ["[C"] = { query = "@comment.outer", desc = "Goto previous end outer comment" }, + }, + }, + + swap = { + enable = true, + + swap_next = { + ["na"] = { query = "@parameter.inner", desc = "Swap with next inner parameter" }, + ["ni"] = { query = "@conditional.outer", desc = "Swap with next outer conditional" }, + ["nl"] = { query = "@loop.outer", desc = "Swap with next outer loop" }, + ["nf"] = { query = "@call.outer", desc = "Swap with next outer call" }, + ["nm"] = { query = "@function.outer", desc = "Swap with next outer function" }, + ["nk"] = { query = "@class.outer", desc = "Swap with next outer class" }, + ["nc"] = { query = "@comment.outer", desc = "Swap with next outer comment" }, + + ["nA"] = { query = "@parameter.outer", desc = "Swap with next outer parameter" }, + ["nI"] = { query = "@conditional.inner", desc = "Swap with next inner conditional" }, + ["nL"] = { query = "@loop.inner", desc = "Swap with next inner loop" }, + ["nF"] = { query = "@call.inner", desc = "Swap with next inner call" }, + ["nM"] = { query = "@function.inner", desc = "Swap with next inner function" }, + ["nK"] = { query = "@class.inner", desc = "Swap with next inner class" }, + ["nC"] = { query = "@comment.inner", desc = "Swap with next inner comment" }, + }, + swap_previous = { + ["pa"] = { query = "@parameter.inner", desc = "Swap with previous inner parameter" }, + ["pi"] = { query = "@conditional.outer", desc = "Swap with previous outer conditional" }, + ["pl"] = { query = "@loop.outer", desc = "Swap with previous outer loop" }, + ["pf"] = { query = "@call.outer", desc = "Swap with previous outer call" }, + ["pm"] = { query = "@function.outer", desc = "Swap with previous outer function" }, + ["pk"] = { query = "@class.outer", desc = "Swap with previous outer class" }, + ["pc"] = { query = "@comment.outer", desc = "Swap with previous outer comment" }, + + ["pA"] = { query = "@parameter.outer", desc = "Swap with previous outer parameter" }, + ["pI"] = { query = "@conditional.inner", desc = "Swap with previous inner conditional" }, + ["pL"] = { query = "@loop.inner", desc = "Swap with previous inner loop" }, + ["pF"] = { query = "@call.inner", desc = "Swap with previous inner call" }, + ["pM"] = { query = "@function.inner", desc = "Swap with previous inner function" }, + ["pK"] = { query = "@class.inner", desc = "Swap with previous inner class" }, + ["pC"] = { query = "@comment.inner", desc = "Swap with previous inner comment" }, + }, + } +} + +-- local ts_repeat_move = require "nvim-treesitter.textobjects.repeatable_move" + +-- Repeat movement with ; and , +-- vim.keymap.set({"n", "x", "o"}, ",", ts_repeat_move.repeat_last_move_next) +-- vim.keymap.set({"n", "x", "o"}, ",", ts_repeat_move.repeat_last_move_previous) + +-- Optionnally, make builtin f, F, t, T also repeatable with ; and , +-- vim.keymap.set({"n", "x", "o"}, "f", ts_repeat_move.builtin_f) +-- vim.keymap.set({"n", "x", "o"}, "F", ts_repeat_move.builtin_F) +-- vim.keymap.set({"n", "x", "o"}, "t", ts_repeat_move.builtin_t) +-- vim.keymap.set({"n", "x", "o"}, "T", ts_repeat_move.builtin_T) + +return M diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 2a982a0..5d0de78 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -119,6 +119,16 @@ local default_plugins = { end, }, + { + "nvim-treesitter/nvim-treesitter-textobjects", + lazy = false, + config = function() + require("nvim-treesitter.configs").setup( + require("plugins.configs.treesitter_textobjects") + ) + end, + }, + -- git stuff { "lewis6991/gitsigns.nvim", @@ -260,6 +270,16 @@ local default_plugins = { debug=false, }, + { + "anuvyklack/hydra.nvim", + lazy=false, + }, + + { + "gioele/vim-autoswap", + lazy=false, + }, + { "natecraddock/workspaces.nvim", lazy=false, @@ -378,6 +398,11 @@ local default_plugins = { require("which-key").setup(opts) end, }, + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" } + }, } local config = require("core.utils").load_config()