From 2d7ff3e5c7364312167dd7098e93efe2dda7aded Mon Sep 17 00:00:00 2001 From: Tovi Jaeschke-Rogers Date: Tue, 9 Jan 2024 15:25:41 +1030 Subject: [PATCH] Remove nvim-treesitter-textobjects file --- .config/nvim/lua/tovi/core/remaps.lua | 24 ++--- .config/nvim/lua/tovi/plugins/copilot.lua | 17 ++- .../plugins/nvim-treesitter-textobjects.lua | 100 ------------------ .config/nvim/lua/tovi/plugins/telescope.lua | 1 - 4 files changed, 27 insertions(+), 115 deletions(-) delete mode 100644 .config/nvim/lua/tovi/plugins/nvim-treesitter-textobjects.lua diff --git a/.config/nvim/lua/tovi/core/remaps.lua b/.config/nvim/lua/tovi/core/remaps.lua index c097546..923f697 100644 --- a/.config/nvim/lua/tovi/core/remaps.lua +++ b/.config/nvim/lua/tovi/core/remaps.lua @@ -26,18 +26,18 @@ vim.keymap.set("n", "", function() end, { desc = "Restore session automatically created on VimLeave" }) -- Navigating with guides -vim.keymap.set( - "n", - "", - '/<++>"_c4l', - { desc = "Find next <++> in file and enter insert mode" } -) -vim.keymap.set( - "v", - "", - '/<++>"_c4l', - { desc = "Find next <++> in file and enter insert mode" } -) +-- vim.keymap.set( +-- "n", +-- "", +-- '/<++>"_c4l', +-- { desc = "Find next <++> in file and enter insert mode" } +-- ) +-- vim.keymap.set( +-- "v", +-- "", +-- '/<++>"_c4l', +-- { desc = "Find next <++> in file and enter insert mode" } +-- ) -- Spell-check vim.keymap.set("n", "o", "setlocal spell! spelllang=en_au", { desc = "Toggle spell check" }) diff --git a/.config/nvim/lua/tovi/plugins/copilot.lua b/.config/nvim/lua/tovi/plugins/copilot.lua index cb2f6c9..ee9ce65 100644 --- a/.config/nvim/lua/tovi/plugins/copilot.lua +++ b/.config/nvim/lua/tovi/plugins/copilot.lua @@ -1,7 +1,20 @@ return { "github/copilot.vim", config = function() - vim.api.nvim_set_keymap("i", ",,", 'copilot#Accept("")', { expr = true, silent = true }) - vim.api.nvim_set_keymap("n", "cs", "Copilot panel", { noremap = true }) + vim.api.nvim_set_keymap( + "i", + "", + 'copilot#Accept("")', + { expr = true, silent = true } + ) + + vim.api.nvim_set_keymap( + "n", + "cs", + "Copilot panel", + { noremap = true } + ) + + vim.g.copilot_no_tab_map = true end, } diff --git a/.config/nvim/lua/tovi/plugins/nvim-treesitter-textobjects.lua b/.config/nvim/lua/tovi/plugins/nvim-treesitter-textobjects.lua deleted file mode 100644 index 33be932..0000000 --- a/.config/nvim/lua/tovi/plugins/nvim-treesitter-textobjects.lua +++ /dev/null @@ -1,100 +0,0 @@ -return { - lazy = false, - enabled = true, - dependencies = { "nvim-treesitter/nvim-treesitter" }, - config = function() - require("nvim-treesitter.configs").setup({ - incremental_selection = { - enable = true, - keymaps = { - -- mappings for incremental selection (visual mappings) - init_selection = "gnn", -- maps in normal mode to init the node/scope selection - node_incremental = "grn", -- increment to the upper named parent - scope_incremental = "grc", -- increment to the upper scope (as defined in locals.scm) - node_decremental = "grm", -- decrement to the previous node - }, - }, - - textobjects = { - -- syntax-aware textobjects - enable = true, - lsp_interop = { - enable = true, - peek_definition_code = { - ["af"] = "@function.outer", - ["if"] = "@class.outer", - }, - }, - keymaps = { - ["iL"] = { - -- you can define your own textobjects directly here - go = "(function_definition) @function", - }, - -- or you use the queries from supported languages with textobjects.scm - ["af"] = "@function.outer", - ["if"] = "@function.inner", - ["aC"] = "@class.outer", - ["iC"] = "@class.inner", - ["ac"] = "@conditional.outer", - ["ic"] = "@conditional.inner", - ["ae"] = "@block.outer", - ["ie"] = "@block.inner", - ["al"] = "@loop.outer", - ["il"] = "@loop.inner", - ["is"] = "@statement.inner", - ["as"] = "@statement.outer", - ["ad"] = "@comment.outer", - ["am"] = "@call.outer", - ["im"] = "@call.inner", - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - ["]m"] = "@function.outer", - ["]]"] = "@class.outer", - }, - goto_next_end = { - ["]M"] = "@function.outer", - ["]["] = "@class.outer", - }, - goto_previous_start = { - ["[m"] = "@function.outer", - ["[["] = "@class.outer", - }, - goto_previous_end = { - ["[M"] = "@function.outer", - ["[]"] = "@class.outer", - }, - }, - select = { - enable = true, - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ["af"] = "@function.outer", - ["if"] = "@function.inner", - ["ac"] = "@class.outer", - ["ic"] = "@class.inner", - -- Or you can define your own textobjects like this - ["iF"] = { - python = "(function_definition) @function", - cpp = "(function_definition) @function", - c = "(function_definition) @function", - java = "(method_declaration) @function", - go = "(method_declaration) @function", - }, - }, - }, - swap = { - enable = true, - swap_next = { - ["a"] = "@parameter.inner", - }, - swap_previous = { - ["A"] = "@parameter.inner", - }, - }, - }, - }) - end, -} diff --git a/.config/nvim/lua/tovi/plugins/telescope.lua b/.config/nvim/lua/tovi/plugins/telescope.lua index ac6a489..05419f1 100644 --- a/.config/nvim/lua/tovi/plugins/telescope.lua +++ b/.config/nvim/lua/tovi/plugins/telescope.lua @@ -122,7 +122,6 @@ return { keymap.set("n", "ch", builtin.command_history, { desc = "Fuzzy find recent commands" }) keymap.set("n", "gb", git_branches, { desc = "Fuzzy find git branches" }) - -- keymap.set("n", "gs", builtin.git_status, { desc = "Fuzzy find current git status" }) keymap.set("n", "df", function() builtin.find_files({