diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 92fc033..fb0a5a6 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -173,7 +173,9 @@ M.general = { --{{{ -- yank from cusor to eol to system and primary clipboard - ["y"] = { '"*y$"+y$', "yank from cursor to eol to primary and clipboard" }, + -- Y handles until end of line + -- yy handles linewise + -- ["y"] = { '"*y$"+y$', "yank from cursor to eol to primary and clipboard" }, -- folding levels ["f0"] = { ":set foldlevel=0", "set fold level" }, @@ -187,8 +189,7 @@ M.general = { --{{{ ["f8"] = { ":set foldlevel=8", "set fold level" }, ["f9"] = { ":set foldlevel=9", "set fold level" }, - ["tf"] = { " set foldmethod=expr | set \ - foldexpr=nvim_treesitter#foldexpr()", + ["tf"] = { " set foldmethod=expr| set foldexpr=nvim_treesitter#foldexpr()", "enable Treesitter folding"}, ["en"] = { " cn ", "next error" }, @@ -224,7 +225,8 @@ M.general = { --{{{ -- TODO: move to lspconfig section -- ["lsp"] = { " lua require('custom.plugins.configs.navigator').enable()", "lsp enable"}, ["lsp"] = { " LspStart", "lsp enable"}, - [""] = { " LspStart", "lsp enable"}, + [""] = { " LspStart", "lsp enable"}, + [""] = { " LspStop", "lsp disable"}, ["lst"] = { " LspStop", "lsp disable"}, diff --git a/lua/custom/chadrc.lua b/lua/custom/chadrc.lua index 915e371..b930c71 100644 --- a/lua/custom/chadrc.lua +++ b/lua/custom/chadrc.lua @@ -101,27 +101,7 @@ M.plugins = { "clap_input" } }, - ["nvim-treesitter/nvim-treesitter"] = { - ensure_installed = { - "lua", - "go", - "rust", - "fish", - "bash", - "python", - "c", - "haskell", - "javascript", - "html", - "markdown", - "markdown_inline", - "make", - "sql", - "yaml", - "toml", - "vue", - } - }, + ["nvim-treesitter/nvim-treesitter"] = require "custom.plugins.configs.treesitter", } } diff --git a/lua/custom/plugins/configs/treesitter-to.lua b/lua/custom/plugins/configs/treesitter-to.lua deleted file mode 100644 index 9283df6..0000000 --- a/lua/custom/plugins/configs/treesitter-to.lua +++ /dev/null @@ -1,79 +0,0 @@ -local present, treesitter = pcall(require, "nvim-treesitter.configs") - -if not present then - return -end - -local options = { - - -- treesitter config (not textobjects) - incremental_selection = { - enable = true, - keymaps = { - init_selection = "gnn", - node_incremental = "grn", - scope_incremental = "grc", - node_decremental = "grm", - } - }, - - textobjects = { - enable = true, - - select = { - enable = true, - lookahead = true, - keymaps = { - -- You can use the capture groups defined in 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" - } - }, - - swap = { - enable = true, - swap_next = { - ["sw"] = "@parameter.inner" - }, - swap_previous = { - ["sW"] = "@parameter.inner" - } - } - } -} - -treesitter.setup(options) diff --git a/lua/custom/plugins/configs/treesitter.lua b/lua/custom/plugins/configs/treesitter.lua new file mode 100644 index 0000000..94187d1 --- /dev/null +++ b/lua/custom/plugins/configs/treesitter.lua @@ -0,0 +1,101 @@ +return { + ensure_installed = { + "lua", + "go", + "rust", + "fish", + "bash", + "python", + "c", + "haskell", + "javascript", + "html", + "markdown", + "markdown_inline", + "make", + "sql", + "yaml", + "toml", + "vue", + }, + + incremental_selection = { + enable = false, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = "", + node_decremental = "", + } + }, + + textsubjects = { + enable = true, + prev_selection = "", + keymaps = { + [""] = "textsubjects-smart", -- works in visual mode + } + }, + + rainbow = { + enable = true, + extended_mode = true, + }, + + textobjects = { + enable = true, + + select = { + enable = true, + lookahead = true, + keymaps = { + -- You can use the capture groups defined in 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 = { + ["]]"] = "@function.outer", + ["]m"] = "@class.outer" + }, + + goto_next_end = { + ["]["] = "@function.outer", + ["]M"] = "@class.outer" + }, + goto_previous_start = { + ["[["] = "@function.outer", + ["[m"] = "@class.outer" + }, + goto_previous_end = { + ["[]"] = "@function.outer", + ["[M"] = "@class.outer" + } + }, + + swap = { + enable = true, + swap_next = { + ["~"] = "@parameter.inner" + }, + } + } +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 2911279..72b9691 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -1,4 +1,4 @@ --- vim: foldlevel=0 +-- vim: foldlevel=1 -- -- TODO: interesting plugins to install -- - neovim minisurround to replace vim-surround @@ -31,13 +31,23 @@ -- - XXX ~~Reload all lua modules with `"pleanery.reload".reload_module(mod)`~~ XXX return { - ["nvim-treesitter/nvim-treesitter-textobjects"] = { - commit = "775c5dbcb6937954d5861465e7c3ec23b855af93", - after = "nvim-treesitter", - config = function() - require("custom.plugins.configs.treesitter-to") + ["nvim-treesitter/nvim-treesitter"] = { + setup = function() + require("core.lazy_load").on_file_open "nvim-treesitter" + require("core.lazy_load").on_file_open "nvim-treesitter-textobjects" + require("core.lazy_load").on_file_open "nvim-treesitter-textsubjects" + -- require("core.lazy_load").on_file_open "nvim-ts-rainbow" end }, + ["nvim-treesitter/nvim-treesitter-textobjects"] = { + opt = true, + }, + ["RRethy/nvim-treesitter-textsubjects"] = { + opt = true, + }, + -- ["p00f/nvim-ts-rainbow"] = { + -- opt = true, + -- }, ["hrsh7th/cmp-buffer"] = { config = function () local disabled_ft = { @@ -56,10 +66,12 @@ return { } end }, + ["mfussenegger/nvim-dap"] = { lock = true, module = "dap" }, + ["rcarriga/nvim-dap-ui"] = { lock = true, after = "nvim-dap", @@ -67,6 +79,7 @@ return { require('dapui').setup() end }, + ["theHamsta/nvim-dap-virtual-text"] = { lock = true, after = "nvim-dap" @@ -79,11 +92,13 @@ return { -- end -- }, -- + ["folke/which-key.nvim"] = { lock = true, disable = false, keys = {"", "", ""} }, + ["nvim-telescope/telescope.nvim"] = { lock = true, disable = true @@ -100,6 +115,7 @@ return { end }, -- Run async commands (make & errors) + ["skywind3000/asyncrun.vim"] = { lock = true, cmd = "AsyncRun", @@ -108,13 +124,14 @@ return { vim.g.asyncrun_open = 8 end }, + ["tpope/vim-fugitive"] = { lock = true, cmd = {"G", "Git", "G*"} }, -- session and view - ["vim-scripts/restore_view.vim"] = {}, + ["vim-scripts/restore_view.vim"] = {}, -- TODO: check if still needed -- ["rmagatti/auto-session"] = { -- config = function () @@ -148,6 +165,16 @@ return { cmd = "Info", }, + + -- ["chentoast/marks.nvim"] = { + -- opt = true, + -- keys = {"m", "d"}, + -- cmd = {"Marks*", "Bookmarks*"}, + -- config = function () + -- require("custom.plugins.configs.marks").setup() + -- end + -- }, + -- snippets ["L3MON4D3/LuaSnip"] = { lock = true,