diff --git a/.config/nvim/lua/tsousa/packer.lua b/.config/nvim/lua/tsousa/packer.lua index b8208a2..9dce2fa 100644 --- a/.config/nvim/lua/tsousa/packer.lua +++ b/.config/nvim/lua/tsousa/packer.lua @@ -9,18 +9,11 @@ return require('packer').startup(function(use) use("tpope/vim-fugitive") use("theprimeagen/harpoon") use("mbbill/undotree") - use("nvim-tree/nvim-web-devicons") + use("stevearc/dressing.nvim") -- fidget change when rewrite version comes out - use { - 'j-hui/fidget.nvim', - tag = 'legacy', - config = function() - require("fidget").setup { - -- options - } - end, - } + use("j-hui/fidget.nvim") + use("norcalli/nvim-colorizer.lua") use("lervag/vimtex") @@ -51,7 +44,10 @@ return require('packer').startup(function(use) use("nvim-orgmode/orgmode") - use('nvim-lualine/lualine.nvim') + use({ + "nvim-lualine/lualine.nvim", + requires = { "nvim-tree/nvim-web-devicons" } + }) use("nvim-treesitter/playground") use("romgrk/nvim-treesitter-context") diff --git a/.config/nvim/tsousa/lazy.lua b/.config/nvim/tsousa/lazy.lua index c359014..d3d110d 100644 --- a/.config/nvim/tsousa/lazy.lua +++ b/.config/nvim/tsousa/lazy.lua @@ -12,3 +12,4 @@ end vim.opt.rtp:prepend(lazypath) require("lazy").setup("tsousa.plugins") + diff --git a/.config/nvim/tsousa/packer.lua b/.config/nvim/tsousa/packer.lua index da1576f..62d2fc4 100644 --- a/.config/nvim/tsousa/packer.lua +++ b/.config/nvim/tsousa/packer.lua @@ -4,6 +4,7 @@ return require('packer').startup(function(use) use("nvim-lua/popup.nvim") use("nvim-telescope/telescope.nvim") use("tpope/vim-surround") + use("stevearc/dressing.nvim") use("mbbill/undotree") -- fidget change when rewrite version comes out diff --git a/.config/nvim/tsousa/plugins/treesitter.lua b/.config/nvim/tsousa/plugins/treesitter.lua index f6ee588..9fc225b 100644 --- a/.config/nvim/tsousa/plugins/treesitter.lua +++ b/.config/nvim/tsousa/plugins/treesitter.lua @@ -1,15 +1,112 @@ return { - "nvim-treesitter/nvim-treesitter", - run = "TSUpdate", - config = function() - endrequire 'nvim-treesitter.configs'.setup { - ensure_installed = { "lua", "vim", "python", "rust", "haskell", "c", "java", "bash", "go" }, - sync_install = false, - - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - } + "nvim-treesitter/nvim-treesitter", + version = false, -- last release is way too old and doesn't work on Windows + build = ":TSUpdate", + event = { "LazyFile", "VeryLazy" }, + init = function(plugin) + -- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early + -- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which + -- no longer trigger the **nvim-treeitter** module to be loaded in time. + -- Luckily, the only thins that those plugins need are the custom queries, which we make available + -- during startup. + require("lazy.core.loader").add_to_rtp(plugin) + require("nvim-treesitter.query_predicates") + end, + dependencies = { + { + "nvim-treesitter/nvim-treesitter-textobjects", + config = function() + -- When in diff mode, we want to use the default + -- vim text objects c & C instead of the treesitter ones. + local move = require("nvim-treesitter.textobjects.move") ---@type table + local configs = require("nvim-treesitter.configs") + for name, fn in pairs(move) do + if name:find("goto") == 1 then + move[name] = function(q, ...) + if vim.wo.diff then + local config = configs.get_module("textobjects.move")[name] ---@type table + for key, query in pairs(config or {}) do + if q == query and key:find("[%]%[][cC]") then + vim.cmd("normal! " .. key) + return + end + end + end + return fn(q, ...) + end + end + end + end, + }, + }, + cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, + keys = { + { "", desc = "Increment selection" }, + { "", desc = "Decrement selection", mode = "x" }, + }, + ---@type TSConfig + ---@diagnostic disable-next-line: missing-fields + opts = { + highlight = { enable = true }, + indent = { enable = true }, + ensure_installed = { + "bash", + "c", + "diff", + "html", + "javascript", + "jsdoc", + "json", + "jsonc", + "lua", + "luadoc", + "luap", + "markdown", + "markdown_inline", + "python", + "regex", + "toml", + "vim", + "vimdoc", + "yaml", + "org", + "dockerfile", + "go", + "haskell", + "rust", + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + textobjects = { + move = { + enable = true, + goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer" }, + goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer" }, + goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer" }, + goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer" }, + }, + }, + }, + ---@param opts TSConfig + config = function(_, opts) + if type(opts.ensure_installed) == "table" then + ---@type table + local added = {} + opts.ensure_installed = vim.tbl_filter(function(lang) + if added[lang] then + return false + end + added[lang] = true + return true + end, opts.ensure_installed) end + require("nvim-treesitter.configs").setup(opts) + end, } diff --git a/.config/starship.toml b/.config/starship.toml index 36161ba..e56b0df 100644 --- a/.config/starship.toml +++ b/.config/starship.toml @@ -49,6 +49,7 @@ symbol = " " [git_branch] symbol = " " +format = ' [$symbol$branch(:$remote_branch)]($style) ' [golang] symbol = " "