Update configuration for neovim 0.11

This commit is contained in:
Lol3rrr
2026-01-16 20:18:31 +01:00
parent 62dfa1466c
commit 35186f4fc4
5 changed files with 57 additions and 132 deletions

View File

@@ -17,13 +17,13 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
require("lazy").setup("plugins") require("lazy").setup({
--require("lazy").setup({ spec = {
-- spec = { { import = "plugins" }
-- { import = "plugins" } },
-- } -- automatically check for plugin updates
--}) checker = { enabled = true },
--require("lazy") })
local config_path = vim.fn.stdpath("config") local config_path = vim.fn.stdpath("config")
@@ -39,16 +39,53 @@ vim.o.shiftwidth = 2
vim.keymap.set('t', '<Esc>', [[<C-\><C-n>]]) vim.keymap.set('t', '<Esc>', [[<C-\><C-n>]])
-- Setup language servers. -- Setup language servers.
local lspconfig = require('lspconfig') vim.lsp.enable('pyright')
lspconfig.pyright.setup {} vim.lsp.enable('tsserver')
lspconfig.tsserver.setup {} vim.lsp.enable('rust_analyzer')
lspconfig.rust_analyzer.setup { vim.lsp.config('rust_analyzer', {
-- Server-specific settings. See `:help lspconfig-setup` -- Server-specific settings. See `:help lspconfig-setup`
settings = { settings = {
['rust-analyzer'] = {}, ['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. -- Global mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions -- See `:help vim.diagnostic.*` for documentation on any of the below functions

View File

@@ -13,9 +13,8 @@
"nvim-cmp": { "branch": "main", "commit": "85bbfad83f804f11688d1ab9486b459e699292d6" }, "nvim-cmp": { "branch": "main", "commit": "85bbfad83f804f11688d1ab9486b459e699292d6" },
"nvim-lspconfig": { "branch": "master", "commit": "92ee7d42320edfbb81f3cad851314ab197fa324a" }, "nvim-lspconfig": { "branch": "master", "commit": "92ee7d42320edfbb81f3cad851314ab197fa324a" },
"nvim-treesitter": { "branch": "main", "commit": "8aada0e3940c573e38b417a226b43bc8675f8958" }, "nvim-treesitter": { "branch": "main", "commit": "8aada0e3940c573e38b417a226b43bc8675f8958" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
"nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" }, "nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"rustaceanvim": { "branch": "master", "commit": "047f9c9d8cd2861745eb9de6c1570ee0875aa795" }, "rustaceanvim": { "branch": "master", "commit": "88575b98bb9937fb9983ddec5e532b67e75ce677" },
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" } "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }
} }

View File

@@ -6,5 +6,6 @@ return {{
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
"3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
} },
lazy = false
}} }}

View File

@@ -1,7 +1,8 @@
return {{ return {{
"mrcjkb/rustaceanvim", "mrcjkb/rustaceanvim",
version = "^4", -- Recommended version = "^6", -- Recommended
ft = { "rs" }, ft = { "rs" },
lazy = false,
opts = { opts = {
server = { server = {
on_attach = function(_, bufnr) on_attach = function(_, bufnr)

View File

@@ -1,118 +1,5 @@
return {{ return {{
"nvim-treesitter/nvim-treesitter", 'nvim-treesitter/nvim-treesitter',
version = false, -- last release is way too old and doesn't work on Windows lazy = false,
build = ":TSUpdate", 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<string,fun(...)>
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<string,string>
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 = {
{ "<c-space>", desc = "Increment Selection" },
{ "<bs>", 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 = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
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<string, boolean>
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,
}} }}