diff --git a/init.lua b/init.lua index 34e45d1..33780e5 100644 --- a/init.lua +++ b/init.lua @@ -17,13 +17,13 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) -require("lazy").setup("plugins") ---require("lazy").setup({ --- spec = { --- { import = "plugins" } --- } ---}) ---require("lazy") +require("lazy").setup({ + spec = { + { import = "plugins" } + }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) local config_path = vim.fn.stdpath("config") @@ -39,16 +39,53 @@ vim.o.shiftwidth = 2 vim.keymap.set('t', '', [[]]) -- Setup language servers. -local lspconfig = require('lspconfig') -lspconfig.pyright.setup {} -lspconfig.tsserver.setup {} -lspconfig.rust_analyzer.setup { +vim.lsp.enable('pyright') +vim.lsp.enable('tsserver') +vim.lsp.enable('rust_analyzer') +vim.lsp.config('rust_analyzer', { -- Server-specific settings. See `:help lspconfig-setup` settings = { ['rust-analyzer'] = {}, }, -} +}) +-- Setup Treesitter +require'nvim-treesitter'.setup { + -- Directory to install parsers and queries to (prepended to `runtimepath` to have priority) + install_dir = vim.fn.stdpath('data') .. '/site' +} +require'nvim-treesitter'.install { + "bash", + "c", + "diff", + "html", + "hcl", + "javascript", + "jsdoc", + "json", + --"jsonc", + "lua", + "luadoc", + "luap", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "toml", + "tsx", + "typescript", + "terraform", + "vim", + "vimdoc", + "xml", + "yaml", + "rust", + "toml", + "ron", + "hcl", + "terraform" + } -- Global mappings. -- See `:help vim.diagnostic.*` for documentation on any of the below functions diff --git a/lazy-lock.json b/lazy-lock.json index 5fd6ef8..5eb5c31 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -13,9 +13,8 @@ "nvim-cmp": { "branch": "main", "commit": "85bbfad83f804f11688d1ab9486b459e699292d6" }, "nvim-lspconfig": { "branch": "master", "commit": "92ee7d42320edfbb81f3cad851314ab197fa324a" }, "nvim-treesitter": { "branch": "main", "commit": "8aada0e3940c573e38b417a226b43bc8675f8958" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" }, "nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "rustaceanvim": { "branch": "master", "commit": "047f9c9d8cd2861745eb9de6c1570ee0875aa795" }, + "rustaceanvim": { "branch": "master", "commit": "88575b98bb9937fb9983ddec5e532b67e75ce677" }, "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" } } diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua index 990f4fb..9bce942 100644 --- a/lua/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -6,5 +6,6 @@ return {{ "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended "MunifTanjim/nui.nvim", "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information - } + }, + lazy = false }} diff --git a/lua/plugins/rustacean.lua b/lua/plugins/rustacean.lua index 2e78530..d2297e7 100644 --- a/lua/plugins/rustacean.lua +++ b/lua/plugins/rustacean.lua @@ -1,7 +1,8 @@ return {{ "mrcjkb/rustaceanvim", - version = "^4", -- Recommended + version = "^6", -- Recommended ft = { "rs" }, + lazy = false, opts = { server = { on_attach = function(_, bufnr) diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index e5d03c3..b8d09d4 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,118 +1,5 @@ return {{ - "nvim-treesitter/nvim-treesitter", - version = false, -- last release is way too old and doesn't work on Windows - build = ":TSUpdate", - event = { "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-treesitter** module to be loaded in time. - -- Luckily, the only things 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", - "hcl", - "javascript", - "jsdoc", - "json", - "jsonc", - "lua", - "luadoc", - "luap", - "markdown", - "markdown_inline", - "python", - "query", - "regex", - "toml", - "tsx", - "typescript", - "terraform", - "vim", - "vimdoc", - "xml", - "yaml", - "rust", - "toml", - "ron", - "hcl", - "terraform" - }, - 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, + 'nvim-treesitter/nvim-treesitter', + lazy = false, + build = ':TSUpdate' }}