update plugins

This commit is contained in:
Onns 2024-03-27 13:32:29 +08:00
parent 85d5e41dfc
commit 6a9ea2413c
5 changed files with 178 additions and 174 deletions

View file

@ -3,7 +3,7 @@
"lazyvim.plugins.extras.formatting.prettier" "lazyvim.plugins.extras.formatting.prettier"
], ],
"news": { "news": {
"NEWS.md": "2123" "NEWS.md": "2850"
}, },
"version": 3 "version": 3
} }

View file

@ -1,5 +0,0 @@
return {
-- disable trouble
-- { "hrsh7th:/nvim-cmp", enabled = false },
-- { "hrsh7th/nvim-cmp", enabled = false },
}

35
lua/plugins/editor.lua Normal file
View file

@ -0,0 +1,35 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"c",
"diff",
"html",
"javascript",
"jsdoc",
"json",
"jsonc",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"xml",
"yaml",
"go",
"http",
"sql",
},
},
},
}

View file

@ -1,9 +1,4 @@
return { return {
-- {
-- 'neoclide/coc.nvim',
-- branch = 'master',
-- build = "yarn install --frozen-lockfile",
-- },
{ {
'onns/bookmarks.nvim', 'onns/bookmarks.nvim',
keys = {}, keys = {},
@ -14,24 +9,6 @@ return {
require("telescope").load_extension("bookmarks") require("telescope").load_extension("bookmarks")
end end
}, },
-- {
-- "scrooloose/nerdtree",
-- keys = {
-- {
-- "<leader>e",
-- "<cmd>NERDTreeToggle<cr>",
-- desc = "NERDTreeToggle"
-- },
-- {
-- "<leader>v",
-- "<cmd>NERDTreeFind<cr>",
-- desc = "NERDTreeFind"
-- }
-- },
-- config = function()
-- require("neo-tree").setup()
-- end
-- },
{ {
"git@github.com:navarasu/onedark.nvim.git", "git@github.com:navarasu/onedark.nvim.git",
lazy = false, lazy = false,

View file

@ -1,149 +1,146 @@
return { return {
-- Treesitter is a new parser generator tool that we can -- -- Treesitter is a new parser generator tool that we can
-- use in Neovim to power faster and more accurate -- -- use in Neovim to power faster and more accurate
-- syntax highlighting. -- -- syntax highlighting.
{ -- {
"nvim-treesitter/nvim-treesitter", -- "nvim-treesitter/nvim-treesitter",
version = false, -- last release is way too old and doesn't work on Windows -- version = false, -- last release is way too old and doesn't work on Windows
build = ":TSUpdate", -- build = ":TSUpdate",
event = { "LazyFile", "VeryLazy" }, -- event = { "LazyFile", "VeryLazy" },
init = function(plugin) -- init = function(plugin)
-- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early -- -- 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 -- -- 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. -- -- 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 -- -- Luckily, the only things that those plugins need are the custom queries, which we make available
-- during startup. -- -- during startup.
require("lazy.core.loader").add_to_rtp(plugin) -- require("lazy.core.loader").add_to_rtp(plugin)
require("nvim-treesitter.query_predicates") -- require("nvim-treesitter.query_predicates")
end, -- end,
dependencies = { -- dependencies = {
{ -- {
"nvim-treesitter/nvim-treesitter-textobjects", -- "nvim-treesitter/nvim-treesitter-textobjects",
config = function() -- config = function()
-- When in diff mode, we want to use the default -- -- When in diff mode, we want to use the default
-- vim text objects c & C instead of the treesitter ones. -- -- vim text objects c & C instead of the treesitter ones.
local move = require("nvim-treesitter.textobjects.move") ---@type table<string,fun(...)> -- local move = require("nvim-treesitter.textobjects.move") ---@type table<string,fun(...)>
local configs = require("nvim-treesitter.configs") -- local configs = require("nvim-treesitter.configs")
for name, fn in pairs(move) do -- for name, fn in pairs(move) do
if name:find("goto") == 1 then -- if name:find("goto") == 1 then
move[name] = function(q, ...) -- move[name] = function(q, ...)
if vim.wo.diff then -- if vim.wo.diff then
local config = configs.get_module("textobjects.move")[name] ---@type table<string,string> -- local config = configs.get_module("textobjects.move")[name] ---@type table<string,string>
for key, query in pairs(config or {}) do -- for key, query in pairs(config or {}) do
if q == query and key:find("[%]%[][cC]") then -- if q == query and key:find("[%]%[][cC]") then
vim.cmd("normal! " .. key) -- vim.cmd("normal! " .. key)
return -- return
end -- end
end -- end
end -- end
return fn(q, ...) -- return fn(q, ...)
end -- end
end -- end
end -- end
end, -- end,
}, -- },
}, -- },
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, -- cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
keys = { -- keys = {
{ "<c-space>", desc = "Increment selection" }, -- { "<c-space>", desc = "Increment selection" },
{ "<bs>", desc = "Decrement selection", mode = "x" }, -- { "<bs>", desc = "Decrement selection", mode = "x" },
}, -- },
---@type TSConfig -- ---@type TSConfig
---@diagnostic disable-next-line: missing-fields -- ---@diagnostic disable-next-line: missing-fields
opts = { -- opts = {
highlight = { enable = true }, -- highlight = { enable = true },
indent = { enable = true }, -- indent = { enable = true },
ensure_installed = { -- ensure_installed = {
"bash", -- "bash",
"c", -- "c",
"diff", -- "diff",
"html", -- "html",
"javascript", -- "javascript",
"jsdoc", -- "jsdoc",
"json", -- "json",
"jsonc", -- "jsonc",
"lua", -- "lua",
"luadoc", -- "luadoc",
"luap", -- "luap",
"markdown", -- "markdown",
"markdown_inline", -- "markdown_inline",
"python", -- "python",
"query", -- "query",
"regex", -- "regex",
"toml", -- "toml",
"tsx", -- "tsx",
"typescript", -- "typescript",
"vim", -- "vim",
"vimdoc", -- "vimdoc",
"xml", -- "xml",
"yaml", -- "yaml",
"go", -- },
"http", -- incremental_selection = {
"sql", -- enable = true,
}, -- keymaps = {
incremental_selection = { -- init_selection = "<C-space>",
enable = true, -- node_incremental = "<C-space>",
keymaps = { -- scope_incremental = false,
init_selection = "<C-space>", -- node_decremental = "<bs>",
node_incremental = "<C-space>", -- },
scope_incremental = false, -- },
node_decremental = "<bs>", -- textobjects = {
}, -- move = {
}, -- enable = true,
textobjects = { -- goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer" },
move = { -- goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer" },
enable = true, -- goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer" },
goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer" }, -- goto_previous_end = { ["[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
---@param opts TSConfig -- ---@type table<string, boolean>
config = function(_, opts) -- local added = {}
if type(opts.ensure_installed) == "table" then -- opts.ensure_installed = vim.tbl_filter(function(lang)
---@type table<string, boolean> -- if added[lang] then
local added = {} -- return false
opts.ensure_installed = vim.tbl_filter(function(lang) -- end
if added[lang] then -- added[lang] = true
return false -- return true
end -- end, opts.ensure_installed)
added[lang] = true -- end
return true -- require("nvim-treesitter.configs").setup(opts)
end, opts.ensure_installed) -- end,
end -- },
require("nvim-treesitter.configs").setup(opts)
end,
},
-- Show context of the current function -- -- Show context of the current function
{ -- {
"nvim-treesitter/nvim-treesitter-context", -- "nvim-treesitter/nvim-treesitter-context",
event = "LazyFile", -- event = "LazyFile",
enabled = true, -- enabled = true,
opts = { mode = "cursor", max_lines = 3 }, -- opts = { mode = "cursor", max_lines = 3 },
keys = { -- keys = {
{ -- {
"<leader>ut", -- "<leader>ut",
function() -- function()
local tsc = require("treesitter-context") -- local tsc = require("treesitter-context")
tsc.toggle() -- tsc.toggle()
if LazyVim.inject.get_upvalue(tsc.toggle, "enabled") then -- if LazyVim.inject.get_upvalue(tsc.toggle, "enabled") then
LazyVim.info("Enabled Treesitter Context", { title = "Option" }) -- LazyVim.info("Enabled Treesitter Context", { title = "Option" })
else -- else
LazyVim.warn("Disabled Treesitter Context", { title = "Option" }) -- LazyVim.warn("Disabled Treesitter Context", { title = "Option" })
end -- end
end, -- end,
desc = "Toggle Treesitter Context", -- desc = "Toggle Treesitter Context",
}, -- },
}, -- },
}, -- },
-- Automatically add closing tags for HTML and JSX -- -- Automatically add closing tags for HTML and JSX
{ -- {
"windwp/nvim-ts-autotag", -- "windwp/nvim-ts-autotag",
event = "LazyFile", -- event = "LazyFile",
opts = {}, -- opts = {},
}, -- },
} }