diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 94394dd..af54282 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -108,7 +108,7 @@ M.general = {--{{{ [""] = { "gt", "Previous tab"}, -- close buffer + hide terminal buffer - ["xx"] = { + ["x"] = { function() require("core.utils").close_buffer() end, @@ -198,7 +198,7 @@ M.tabufline = {--{{{ n = { -- cycle through buffers - [""] = { + [""] = { function() require("core.utils").tabuflineNext() end, @@ -311,28 +311,28 @@ M.lspconfig = {--{{{ function() vim.diagnostic.open_float() end, - "floating diagnostic", + "lsp floating diagnostic", }, ["[d"] = { function() vim.diagnostic.goto_prev() end, - "goto prev", + "lsp goto prev", }, ["d]"] = { function() vim.diagnostic.goto_next() end, - "goto_next", + "lsp goto_next", }, ["q"] = { function() vim.diagnostic.setloclist() end, - "diagnostic setloclist", + "lsp diagnostic setloclist", }, ["fm"] = { @@ -346,21 +346,21 @@ M.lspconfig = {--{{{ function() vim.lsp.buf.add_workspace_folder() end, - "add workspace folder", + "lsp add workspace folder", }, ["wr"] = { function() vim.lsp.buf.remove_workspace_folder() end, - "remove workspace folder", + "lsp remove workspace folder", }, ["wl"] = { function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, - "list workspace folders", + "lsp list workspace folders", }, }, }--}}} diff --git a/lua/core/options.lua b/lua/core/options.lua index 1c77bc7..c23d359 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -50,7 +50,6 @@ opt.ruler = false -- disable nvim intro opt.shortmess:append "sI" opt.viewoptions="folds,cursor,curdir" -opt.viewoptions:remove("options") -- . # and - are end of word designators opt.iskeyword:remove(".") diff --git a/lua/custom/chadrc.lua b/lua/custom/chadrc.lua index 79c8ba9..1e3cd94 100644 --- a/lua/custom/chadrc.lua +++ b/lua/custom/chadrc.lua @@ -16,7 +16,11 @@ M.ui = { } M.plugins = { - user = require "custom.plugins" + user = require "custom.plugins", + override = { + ["nvim-treesitter/nvim-treesitter"] = { + } + } } return M diff --git a/lua/custom/plugins/fzflua.lua b/lua/custom/plugins/fzflua.lua index 73f39f6..2b36183 100644 --- a/lua/custom/plugins/fzflua.lua +++ b/lua/custom/plugins/fzflua.lua @@ -19,7 +19,7 @@ M.keymaps = function(opts) local add_keymap = function(keymap) -- hijack fields local keymap_desc = keymap.desc == nil and keymap.rhs or keymap.desc - keymap.str = string.format("%s │ %-40s │ %s", + keymap.str = string.format("%s │ %-40ls │ %s", utils.ansi_codes[modes[keymap.mode] or "blue"](keymap.mode), keymap.lhs:gsub("%s", ""), keymap_desc) diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 6349a96..5e5459a 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -1,4 +1,10 @@ return { + ["nvim-treesitter/nvim-treesitter-textobjects"] = { + after = "nvim-treesitter", + -- config = function() + -- require("custom.plugins.configs.treesitter-to") + -- end + }, ["mfussenegger/nvim-dap"] = { module = "dap" }, @@ -26,6 +32,7 @@ return { }, -- Run async commands (make & errors) ["skywind3000/asyncrun.vim"] = { + cmd = "AsyncRun", config = function() require("core.utils").load_mappings "asyncrun" vim.g.asyncrun_open = 8 @@ -34,6 +41,19 @@ return { -- restore view ["vim-scripts/restore_view.vim"] = {}, + -- repeat operator for plugin commands + ["tpope/vim-repeat"] = { + keys = {"."}, + }, + ["justinmk/vim-sneak"] = { + keys = {"s", "S"}, + setup = function() + vim.cmd[[ + let g:sneak#label=1 + ]] + end + }, + -- Read info files ["https://gitlab.com/HiPhish/info.vim.git"] = { cmd = "Info", diff --git a/lua/plugins/configs/treesitter.lua b/lua/plugins/configs/treesitter.lua index e23501a..cd75fc5 100644 --- a/lua/plugins/configs/treesitter.lua +++ b/lua/plugins/configs/treesitter.lua @@ -9,11 +9,86 @@ require("base46").load_highlight "treesitter" local options = { ensure_installed = { "lua", + "go", + "rust", + "fish", + "bash", + "python", + "c", + "haskell", + "javascript", + "html", + "markdown", + "markdown_inline", + "make", + "sql", + "yaml", + "toml", + "vue", }, + highlight = { enable = true, use_languagetree = 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 = { + ["]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 = { + ["a"] = "@parameter.inner" + }, + swap_previous = { + ["A"] = "@parameter.inner" + } + } + } } -- check for any override diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 6db5463..f10a8c6 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -2,16 +2,17 @@ vim.cmd "packadd packer.nvim" local plugins = { - ["nvim-lua/plenary.nvim"] = { module = "plenary", lock = true }, + ["nvim-lua/plenary.nvim"] = { module = "plenary" }, ["wbthomason/packer.nvim"] = { cmd = require("core.lazy_load").packer_cmds, config = function() require "plugins" end, }, - ["NvChad/extensions"] = { module = { "telescope", "nvchad" } }, + ["NvChad/extensions"] = { module = { "telescope", "nvchad" }, lock = true }, ["NvChad/base46"] = { + lock = true, config = function() local ok, base46 = pcall(require, "base46") @@ -22,6 +23,7 @@ local plugins = { }, ["NvChad/ui"] = { + lock = true, after = "base46", config = function() require("plugins.configs.others").nvchad_ui() @@ -47,6 +49,7 @@ local plugins = { }, ["lukas-reineke/indent-blankline.nvim"] = { + lock = true, opt = true, setup = function() require("core.lazy_load").on_file_open "indent-blankline.nvim" @@ -58,6 +61,7 @@ local plugins = { }, ["NvChad/nvim-colorizer.lua"] = { + lock = true, opt = true, setup = function() require("core.lazy_load").on_file_open "nvim-colorizer.lua"