Compare commits
129 Commits
Author | SHA1 | Date | |
---|---|---|---|
871e7fb0db | |||
fc50c055c3 | |||
df0818880e | |||
6323b419fd | |||
abaa6d90e4 | |||
f70f873355 | |||
258f339bcf | |||
4d0427e131 | |||
f2459bd70e | |||
e797e13bce | |||
489221f741 | |||
a28acf0ce7 | |||
fb1f29c32c | |||
b4b27e867c | |||
f46316af00 | |||
63e898599a | |||
3a07bd8d2e | |||
69bb89184f | |||
0801e52118 | |||
1b0b6eb0e1 | |||
8c0e39c826 | |||
bb2608ecd1 | |||
ae759b947b | |||
9387ab388e | |||
8f9f76a96f | |||
9e8ce289d1 | |||
5204aacf8d | |||
a0c2014b10 | |||
c882544224 | |||
e212c166b4 | |||
9fd89701da | |||
b1721bc20a | |||
3f68f44d72 | |||
a38bf3001d | |||
67d1cbfb01 | |||
abea2807ce | |||
44cdb5eac5 | |||
0db31c2840 | |||
22c9477b96 | |||
baa9614022 | |||
b660b51718 | |||
99f30f9a37 | |||
ae054ec13c | |||
bcff5a1937 | |||
299aae3545 | |||
0b020dc37b | |||
755419f39c | |||
ddb819cb9a | |||
9c120b5ef7 | |||
d33be73b8d | |||
27eb4610bd | |||
e5200e6358 | |||
64ca399c56 | |||
dee8dc318e | |||
6d58f1dacf | |||
a981682603 | |||
bbaf47028f | |||
8ccc109e92 | |||
a9c73bc7c3 | |||
4009620651 | |||
39627cab42 | |||
1e1fc3c6a0 | |||
eaa0118dd2 | |||
272f6af842 | |||
29ba21274d | |||
a46d47653e | |||
61e3ce8cdc | |||
36774c6058 | |||
d0bc8b7dce | |||
fca09b12e8 | |||
ea21cad7ed | |||
4ba5086b3d | |||
089606b48d | |||
6d8be7ae46 | |||
79b1c92dd2 | |||
c992ebec46 | |||
37d7ccdea1 | |||
5a441f8972 | |||
3d0de235ec | |||
146bc4f172 | |||
65c70f6ad7 | |||
75d029c35b | |||
8b1e7976a0 | |||
0e33010937 | |||
2f2c7a32a4 | |||
c03b9a3ff1 | |||
e83d2c814f | |||
5818e01f27 | |||
a1820c1b42 | |||
27d3e45df6 | |||
296d79cfbc | |||
240fa7631b | |||
d1eb9c89d3 | |||
c5759a451f | |||
c998be8fa4 | |||
5f89e4a142 | |||
5e6a07200c | |||
a40f257c79 | |||
f6f8436fe8 | |||
e9358d977a | |||
e018d07cce | |||
d5a9c54faf | |||
85542df6f5 | |||
abfdab37ce | |||
12b57235a9 | |||
1acad8be93 | |||
6e9b18aa93 | |||
c3477ed81e | |||
a080bc7667 | |||
eb7b4fc369 | |||
9bfe77c1de | |||
2ef0c437b2 | |||
ed89d01113 | |||
09c1bf54ea | |||
5299522780 | |||
9ea1f31e9d | |||
e624511fa2 | |||
69bf9e7e01 | |||
ca1880da0a | |||
09fafb946a | |||
8281bd2f63 | |||
aa28119aa6 | |||
5d0e10a30a | |||
0b99c9f788 | |||
47111bd2db | |||
318a4c8304 | |||
e865b9abe1 | |||
31505842be | |||
01c7eeebd0 |
307
CHANGELOG.md
307
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@ -57,6 +57,7 @@ LazyVim 提供了两全其美的方式 - 根据需要调整配置的灵活性,
|
||||
- Neovim >= **0.8.0** (需要用 **LuaJIT** 构建)
|
||||
- Git >= **2.19.0** (用于部分克隆支持)
|
||||
- 一个 [Nerd Font](https://www.nerdfonts.com/) 字体 **_(可选)_**
|
||||
- 一个用于 `nvim-treesitter` 的 **C** 编译器。看 [这里](https://github.com/nvim-treesitter/nvim-treesitter#requirements)
|
||||
|
||||
## 🚀 入门
|
||||
|
||||
|
@ -59,6 +59,7 @@ to tweak your config as needed, along with the convenience of a pre-configured s
|
||||
- Neovim >= **0.8.0** (needs to be built with **LuaJIT**)
|
||||
- Git >= **2.19.0** (for partial clones support)
|
||||
- a [Nerd Font](https://www.nerdfonts.com/) **_(optional)_**
|
||||
- a **C** compiler for `nvim-treesitter`. See [here](https://github.com/nvim-treesitter/nvim-treesitter#requirements)
|
||||
|
||||
## 🚀 Getting Started
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 June 19
|
||||
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 July 20
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *LazyVim-table-of-contents*
|
||||
@ -55,6 +55,7 @@ REQUIREMENTS *LazyVim-requirements*
|
||||
- Neovim >= **0.8.0** (needs to be built with **LuaJIT**)
|
||||
- Git >= **2.19.0** (for partial clones support)
|
||||
- a Nerd Font <https://www.nerdfonts.com/> **(optional)**
|
||||
- a **C** compiler for `nvim-treesitter`. See here <https://github.com/nvim-treesitter/nvim-treesitter#requirements>
|
||||
|
||||
|
||||
GETTING STARTED *LazyVim-getting-started*
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- This file is automatically loaded by lazyvim.config.init
|
||||
-- This file is automatically loaded by lazyvim.config.init.
|
||||
|
||||
local function augroup(name)
|
||||
return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
|
||||
@ -30,8 +30,13 @@ vim.api.nvim_create_autocmd({ "VimResized" }, {
|
||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||
group = augroup("last_loc"),
|
||||
callback = function()
|
||||
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
||||
local lcount = vim.api.nvim_buf_line_count(0)
|
||||
local exclude = { "gitcommit" }
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
if vim.tbl_contains(exclude, vim.bo[buf].filetype) then
|
||||
return
|
||||
end
|
||||
local mark = vim.api.nvim_buf_get_mark(buf, '"')
|
||||
local lcount = vim.api.nvim_buf_line_count(buf)
|
||||
if mark[1] > 0 and mark[1] <= lcount then
|
||||
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
||||
end
|
||||
|
@ -84,12 +84,15 @@ map("i", ";", ";<c-g>u")
|
||||
-- save file
|
||||
map({ "i", "v", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" })
|
||||
|
||||
--keywordprg
|
||||
map("n", "<leader>K", "<cmd>norm! K<cr>", { desc = "Keywordprg" })
|
||||
|
||||
-- better indenting
|
||||
map("v", "<", "<gv")
|
||||
map("v", ">", ">gv")
|
||||
|
||||
-- lazy
|
||||
map("n", "<leader>l", "<cmd>:Lazy<cr>", { desc = "Lazy" })
|
||||
map("n", "<leader>l", "<cmd>Lazy<cr>", { desc = "Lazy" })
|
||||
|
||||
-- new file
|
||||
map("n", "<leader>fn", "<cmd>enew<cr>", { desc = "New File" })
|
||||
@ -108,10 +111,13 @@ end
|
||||
map("n", "<leader>uf", require("lazyvim.plugins.lsp.format").toggle, { desc = "Toggle format on Save" })
|
||||
map("n", "<leader>us", function() Util.toggle("spell") end, { desc = "Toggle Spelling" })
|
||||
map("n", "<leader>uw", function() Util.toggle("wrap") end, { desc = "Toggle Word Wrap" })
|
||||
map("n", "<leader>ul", function() Util.toggle("relativenumber", true) Util.toggle("number") end, { desc = "Toggle Line Numbers" })
|
||||
map("n", "<leader>ul", function() Util.toggle_number() end, { desc = "Toggle Line Numbers" })
|
||||
map("n", "<leader>ud", Util.toggle_diagnostics, { desc = "Toggle Diagnostics" })
|
||||
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
|
||||
map("n", "<leader>uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" })
|
||||
if vim.lsp.inlay_hint then
|
||||
map("n", "<leader>uh", function() vim.lsp.inlay_hint(0, nil) end, { desc = "Toggle Inlay Hints" })
|
||||
end
|
||||
|
||||
-- lazygit
|
||||
map("n", "<leader>gg", function() Util.float_term({ "lazygit" }, { cwd = Util.get_root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" })
|
||||
@ -125,6 +131,9 @@ if vim.fn.has("nvim-0.9.0") == 1 then
|
||||
map("n", "<leader>ui", vim.show_pos, { desc = "Inspect Pos" })
|
||||
end
|
||||
|
||||
-- LazyVim Changelog
|
||||
map("n", "<leader>L", Util.changelog, {desc = "LazyVim Changelog"})
|
||||
|
||||
-- floating terminal
|
||||
local lazyterm = function() Util.float_term(nil, { cwd = Util.get_root() }) end
|
||||
map("n", "<leader>ft", lazyterm, { desc = "Terminal (root dir)" })
|
||||
|
@ -1,6 +1,6 @@
|
||||
-- This file is automatically loaded by plugins.config
|
||||
-- This file is automatically loaded by plugins.core
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
|
@ -44,6 +44,7 @@ return {
|
||||
opts = function()
|
||||
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
|
||||
local cmp = require("cmp")
|
||||
local defaults = require("cmp.config.default")()
|
||||
return {
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
@ -86,6 +87,7 @@ return {
|
||||
hl_group = "CmpGhostText",
|
||||
},
|
||||
},
|
||||
sorting = defaults.sorting,
|
||||
}
|
||||
end,
|
||||
},
|
||||
@ -97,7 +99,10 @@ return {
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- surround
|
||||
-- Fast and feature-rich surround actions. For text that includes
|
||||
-- surrounding characters like brackets or quotes, this allows you
|
||||
-- to select the text inside, change or modify the surrounding characters,
|
||||
-- and more.
|
||||
{
|
||||
"echasnovski/mini.surround",
|
||||
keys = function(_, keys)
|
||||
@ -145,7 +150,7 @@ return {
|
||||
},
|
||||
},
|
||||
|
||||
-- better text-objects
|
||||
-- Better text-objects
|
||||
{
|
||||
"echasnovski/mini.ai",
|
||||
-- keys = {
|
||||
@ -171,7 +176,7 @@ return {
|
||||
config = function(_, opts)
|
||||
require("mini.ai").setup(opts)
|
||||
-- register all text objects with which-key
|
||||
if require("lazyvim.util").has("which-key.nvim") then
|
||||
require("lazyvim.util").on_load("which-key.nvim", function()
|
||||
---@type table<string, string|table>
|
||||
local i = {
|
||||
[" "] = "Whitespace",
|
||||
@ -212,7 +217,7 @@ return {
|
||||
i = i,
|
||||
a = a,
|
||||
})
|
||||
end
|
||||
end)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ return {
|
||||
illuminate = true,
|
||||
indent_blankline = { enabled = true },
|
||||
lsp_trouble = true,
|
||||
mason = true,
|
||||
mini = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
@ -30,11 +31,11 @@ return {
|
||||
information = { "undercurl" },
|
||||
},
|
||||
},
|
||||
navic = { enabled = true },
|
||||
navic = { enabled = true, custom_bg = "lualine" },
|
||||
neotest = true,
|
||||
noice = true,
|
||||
notify = true,
|
||||
nvimtree = true,
|
||||
neotree = true,
|
||||
semantic_tokens = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
|
@ -5,6 +5,7 @@ return {
|
||||
-- file explorer
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
cmd = "Neotree",
|
||||
keys = {
|
||||
{
|
||||
@ -28,7 +29,6 @@ return {
|
||||
vim.cmd([[Neotree close]])
|
||||
end,
|
||||
init = function()
|
||||
vim.g.neo_tree_remove_legacy_commands = 1
|
||||
if vim.fn.argc() == 1 then
|
||||
local stat = vim.loop.fs_stat(vim.fn.argv(0))
|
||||
if stat and stat.type == "directory" then
|
||||
@ -41,7 +41,7 @@ return {
|
||||
open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "Outline" },
|
||||
filesystem = {
|
||||
bind_to_cwd = false,
|
||||
follow_current_file = true,
|
||||
follow_current_file = { enabled = true },
|
||||
use_libuv_file_watcher = true,
|
||||
},
|
||||
window = {
|
||||
@ -103,6 +103,7 @@ return {
|
||||
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "commits" },
|
||||
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "status" },
|
||||
-- search
|
||||
{ '<leader>s"', "<cmd>Telescope registers<cr>", desc = "Registers" },
|
||||
{ "<leader>sa", "<cmd>Telescope autocommands<cr>", desc = "Auto Commands" },
|
||||
{ "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Buffer" },
|
||||
{ "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Command History" },
|
||||
@ -203,38 +204,83 @@ return {
|
||||
},
|
||||
},
|
||||
|
||||
-- easily jump to any location and enhanced f/t motions for Leap
|
||||
{
|
||||
"ggandor/flit.nvim",
|
||||
keys = function()
|
||||
---@type LazyKeys[]
|
||||
local ret = {}
|
||||
for _, key in ipairs({ "f", "F", "t", "T" }) do
|
||||
ret[#ret + 1] = { key, mode = { "n", "x", "o" }, desc = key }
|
||||
end
|
||||
return ret
|
||||
end,
|
||||
opts = { labeled_modes = "nx" },
|
||||
},
|
||||
-- disable old installations of leap and flit. Optional so it doesn't appear under disabled plugins
|
||||
{
|
||||
"ggandor/leap.nvim",
|
||||
enabled = function()
|
||||
vim.schedule(function()
|
||||
local Config = require("lazy.core.config")
|
||||
if Config.spec.disabled["leap.nvim"] or Config.spec.disabled["flit.nvim"] then
|
||||
require("lazy.core.util").warn(
|
||||
[[`flash.nvim` is now the default **LazyVim** jump plugin.
|
||||
**leap.nvim** and **flit.nvim** have been disabled.
|
||||
Please remove the plugins from your config.
|
||||
If you rather use leap/flit instead, you can add the leap extra:
|
||||
`lazyvim.plugins.extras.editor.leap`
|
||||
]],
|
||||
{ title = "LazyVim" }
|
||||
)
|
||||
end
|
||||
end)
|
||||
return false
|
||||
end,
|
||||
optional = true,
|
||||
},
|
||||
{ "ggandor/flit.nvim", enabled = false, optional = true },
|
||||
|
||||
-- Flash enhances the built-in search functionality by showing labels
|
||||
-- at the end of each match, letting you quickly jump to a specific
|
||||
-- location.
|
||||
{
|
||||
"folke/flash.nvim",
|
||||
event = "VeryLazy",
|
||||
vscode = true,
|
||||
---@type Flash.Config
|
||||
opts = {},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "s", mode = { "n", "x", "o" }, desc = "Leap forward to" },
|
||||
{ "S", mode = { "n", "x", "o" }, desc = "Leap backward to" },
|
||||
{ "gs", mode = { "n", "x", "o" }, desc = "Leap from windows" },
|
||||
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
||||
{ "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
|
||||
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
|
||||
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
|
||||
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
||||
},
|
||||
config = function(_, opts)
|
||||
local leap = require("leap")
|
||||
for k, v in pairs(opts) do
|
||||
leap.opts[k] = v
|
||||
},
|
||||
|
||||
-- Flash Telescope config
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if not require("lazyvim.util").has("flash.nvim") then
|
||||
return
|
||||
end
|
||||
leap.add_default_mappings(true)
|
||||
vim.keymap.del({ "x", "o" }, "x")
|
||||
vim.keymap.del({ "x", "o" }, "X")
|
||||
local function flash(prompt_bufnr)
|
||||
require("flash").jump({
|
||||
pattern = "^",
|
||||
label = { after = { 0, 0 } },
|
||||
search = {
|
||||
mode = "search",
|
||||
exclude = {
|
||||
function(win)
|
||||
return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "TelescopeResults"
|
||||
end,
|
||||
},
|
||||
},
|
||||
action = function(match)
|
||||
local picker = require("telescope.actions.state").get_current_picker(prompt_bufnr)
|
||||
picker:set_selection(match.pos[1] - 1)
|
||||
end,
|
||||
})
|
||||
end
|
||||
opts.defaults = vim.tbl_deep_extend("force", opts.defaults or {}, {
|
||||
mappings = { n = { s = flash }, i = { ["<c-s>"] = flash } },
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- which-key
|
||||
-- which-key helps you remember key bindings by showing a popup
|
||||
-- with the active keybindings of the command you started typing.
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
@ -266,7 +312,9 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
-- git signs
|
||||
-- git signs highlights text that has changed since the list
|
||||
-- git commit, and also lets you interactively stage & unstage
|
||||
-- hunks in a commit.
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
@ -303,7 +351,9 @@ return {
|
||||
},
|
||||
},
|
||||
|
||||
-- references
|
||||
-- Automatically highlights other instances of the word under your cursor.
|
||||
-- This works with LSP, Treesitter, and regexp matching to find the other
|
||||
-- instances.
|
||||
{
|
||||
"RRethy/vim-illuminate",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
@ -392,7 +442,8 @@ return {
|
||||
},
|
||||
},
|
||||
|
||||
-- todo comments
|
||||
-- Finds and lists all of the TODO, HACK, BUG, etc comment
|
||||
-- in your project and loads them into a browsable list.
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
cmd = { "TodoTrouble", "TodoTelescope" },
|
||||
|
@ -70,28 +70,9 @@ return {
|
||||
},
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
|
||||
table.insert(opts.sources, 1, { name = "copilot", group_index = 2 })
|
||||
|
||||
opts.sorting = {
|
||||
priority_weight = 2,
|
||||
comparators = {
|
||||
require("copilot_cmp.comparators").prioritize,
|
||||
|
||||
-- Below is the default comparitor list and order for nvim-cmp
|
||||
cmp.config.compare.offset,
|
||||
-- cmp.config.compare.scopes, --this is commented in nvim-cmp too
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
cmp.config.compare.recently_used,
|
||||
cmp.config.compare.locality,
|
||||
cmp.config.compare.kind,
|
||||
cmp.config.compare.sort_text,
|
||||
cmp.config.compare.length,
|
||||
cmp.config.compare.order,
|
||||
},
|
||||
}
|
||||
opts.sorting = opts.sorting or require("cmp.config.default")().sorting
|
||||
table.insert(opts.sorting.comparators, 1, require("copilot_cmp.comparators").prioritize)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
43
lua/lazyvim/plugins/extras/coding/yanky.lua
Normal file
43
lua/lazyvim/plugins/extras/coding/yanky.lua
Normal file
@ -0,0 +1,43 @@
|
||||
return {
|
||||
-- better yank/paste
|
||||
{
|
||||
"gbprod/yanky.nvim",
|
||||
dependencies = { { "kkharji/sqlite.lua", enabled = not jit.os:find("Windows") } },
|
||||
opts = function()
|
||||
local mapping = require("yanky.telescope.mapping")
|
||||
local mappings = mapping.get_defaults()
|
||||
mappings.i["<c-p>"] = nil
|
||||
return {
|
||||
highlight = { timer = 200 },
|
||||
ring = { storage = jit.os:find("Windows") and "shada" or "sqlite" },
|
||||
picker = {
|
||||
telescope = {
|
||||
use_default_mappings = false,
|
||||
mappings = mappings,
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
keys = {
|
||||
-- stylua: ignore
|
||||
{ "<leader>p", function() require("telescope").extensions.yank_history.yank_history({ }) end, desc = "Open Yank History" },
|
||||
{ "y", "<Plug>(YankyYank)", mode = { "n", "x" }, desc = "Yank text" },
|
||||
{ "p", "<Plug>(YankyPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after cursor" },
|
||||
{ "P", "<Plug>(YankyPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before cursor" },
|
||||
{ "gp", "<Plug>(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after selection" },
|
||||
{ "gP", "<Plug>(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before selection" },
|
||||
{ "[y", "<Plug>(YankyCycleForward)", desc = "Cycle forward through yank history" },
|
||||
{ "]y", "<Plug>(YankyCycleBackward)", desc = "Cycle backward through yank history" },
|
||||
{ "]p", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
|
||||
{ "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
||||
{ "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
|
||||
{ "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
||||
{ ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" },
|
||||
{ "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" },
|
||||
{ ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" },
|
||||
{ "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" },
|
||||
{ "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put after applying a filter" },
|
||||
{ "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put before applying a filter" },
|
||||
},
|
||||
},
|
||||
}
|
6
lua/lazyvim/plugins/extras/editor/flash.lua
Normal file
6
lua/lazyvim/plugins/extras/editor/flash.lua
Normal file
@ -0,0 +1,6 @@
|
||||
require("lazy.core.util").warn(
|
||||
"`flash.nvim` is now the default jump plugin for **LazyVim**.\nPlease remove the `lazyvim.plugins.extras.editor.flash` import from your **lazy** config.",
|
||||
{ title = "LazyVim" }
|
||||
)
|
||||
|
||||
return {}
|
40
lua/lazyvim/plugins/extras/editor/leap.lua
Normal file
40
lua/lazyvim/plugins/extras/editor/leap.lua
Normal file
@ -0,0 +1,40 @@
|
||||
return {
|
||||
-- disable flash
|
||||
{ "folke/flash.nvim", enabled = false, optional = true },
|
||||
|
||||
-- easily jump to any location and enhanced f/t motions for Leap
|
||||
{
|
||||
"ggandor/flit.nvim",
|
||||
enabled = true,
|
||||
keys = function()
|
||||
---@type LazyKeys[]
|
||||
local ret = {}
|
||||
for _, key in ipairs({ "f", "F", "t", "T" }) do
|
||||
ret[#ret + 1] = { key, mode = { "n", "x", "o" }, desc = key }
|
||||
end
|
||||
return ret
|
||||
end,
|
||||
opts = { labeled_modes = "nx" },
|
||||
},
|
||||
{
|
||||
"ggandor/leap.nvim",
|
||||
enabled = true,
|
||||
keys = {
|
||||
{ "s", mode = { "n", "x", "o" }, desc = "Leap forward to" },
|
||||
{ "S", mode = { "n", "x", "o" }, desc = "Leap backward to" },
|
||||
{ "gs", mode = { "n", "x", "o" }, desc = "Leap from windows" },
|
||||
},
|
||||
config = function(_, opts)
|
||||
local leap = require("leap")
|
||||
for k, v in pairs(opts) do
|
||||
leap.opts[k] = v
|
||||
end
|
||||
leap.add_default_mappings(true)
|
||||
vim.keymap.del({ "x", "o" }, "x")
|
||||
vim.keymap.del({ "x", "o" }, "X")
|
||||
end,
|
||||
},
|
||||
|
||||
-- makes some plugins dot-repeatable like leap
|
||||
{ "tpope/vim-repeat", event = "VeryLazy" },
|
||||
}
|
57
lua/lazyvim/plugins/extras/editor/mini-files.lua
Normal file
57
lua/lazyvim/plugins/extras/editor/mini-files.lua
Normal file
@ -0,0 +1,57 @@
|
||||
return {
|
||||
"echasnovski/mini.files",
|
||||
opts = {
|
||||
windows = {
|
||||
preview = true,
|
||||
width_focus = 30,
|
||||
width_preview = 30,
|
||||
},
|
||||
options = {
|
||||
-- Whether to use for editing directories
|
||||
-- Disabled by default in LazyVim because neo-tree is used for that
|
||||
use_as_default_explorer = false,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>fm",
|
||||
function()
|
||||
require("mini.files").open(vim.api.nvim_buf_get_name(0), true)
|
||||
end,
|
||||
desc = "Open mini.files (directory of current file)",
|
||||
},
|
||||
{
|
||||
"<leader>fM",
|
||||
function()
|
||||
require("mini.files").open(vim.loop.cwd(), true)
|
||||
end,
|
||||
desc = "Open mini.files (cwd)",
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("mini.files").setup(opts)
|
||||
|
||||
local show_dotfiles = true
|
||||
local filter_show = function(fs_entry)
|
||||
return true
|
||||
end
|
||||
local filter_hide = function(fs_entry)
|
||||
return not vim.startswith(fs_entry.name, ".")
|
||||
end
|
||||
|
||||
local toggle_dotfiles = function()
|
||||
show_dotfiles = not show_dotfiles
|
||||
local new_filter = show_dotfiles and filter_show or filter_hide
|
||||
require("mini.files").refresh({ content = { filter = new_filter } })
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "MiniFilesBufferCreate",
|
||||
callback = function(args)
|
||||
local buf_id = args.data.buf_id
|
||||
-- Tweak left-hand side of mapping to your liking
|
||||
vim.keymap.set("n", "g.", toggle_dotfiles, { buffer = buf_id })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
152
lua/lazyvim/plugins/extras/lang/clangd.lua
Normal file
152
lua/lazyvim/plugins/extras/lang/clangd.lua
Normal file
@ -0,0 +1,152 @@
|
||||
return {
|
||||
|
||||
-- Add C/C++ to treesitter
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
vim.list_extend(opts.ensure_installed, { "c", "cpp" })
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"p00f/clangd_extensions.nvim",
|
||||
lazy = true,
|
||||
config = function() end,
|
||||
opts = {
|
||||
extensions = {
|
||||
inlay_hints = {
|
||||
inline = false,
|
||||
},
|
||||
ast = {
|
||||
--These require codicons (https://github.com/microsoft/vscode-codicons)
|
||||
role_icons = {
|
||||
type = "",
|
||||
declaration = "",
|
||||
expression = "",
|
||||
specifier = "",
|
||||
statement = "",
|
||||
["template argument"] = "",
|
||||
},
|
||||
kind_icons = {
|
||||
Compound = "",
|
||||
Recovery = "",
|
||||
TranslationUnit = "",
|
||||
PackExpansion = "",
|
||||
TemplateTypeParm = "",
|
||||
TemplateTemplateParm = "",
|
||||
TemplateParamObject = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Correctly setup lspconfig for clangd 🚀
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
-- Ensure mason installs the server
|
||||
clangd = {
|
||||
keys = {
|
||||
{ "<leader>cR", "<cmd>ClangdSwitchSourceHeader<cr>", desc = "Switch Source/Header (C/C++)" },
|
||||
},
|
||||
root_dir = function(...)
|
||||
-- using a root .clang-format or .clang-tidy file messes up projects, so remove them
|
||||
return require("lspconfig.util").root_pattern(
|
||||
"compile_commands.json",
|
||||
"compile_flags.txt",
|
||||
"configure.ac",
|
||||
".git"
|
||||
)(...)
|
||||
end,
|
||||
capabilities = {
|
||||
offsetEncoding = { "utf-16" },
|
||||
},
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--background-index",
|
||||
"--clang-tidy",
|
||||
"--header-insertion=iwyu",
|
||||
"--completion-style=detailed",
|
||||
"--function-arg-placeholders",
|
||||
"--fallback-style=llvm",
|
||||
},
|
||||
init_options = {
|
||||
usePlaceholders = true,
|
||||
completeUnimported = true,
|
||||
clangdFileStatus = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
clangd = function(_, opts)
|
||||
local clangd_ext_opts = require("lazyvim.util").opts("clangd_extensions.nvim")
|
||||
require("clangd_extensions").setup(vim.tbl_deep_extend("force", clangd_ext_opts or {}, { server = opts }))
|
||||
return true
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-cmp",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sorting.comparators, 1, require("clangd_extensions.cmp_scores"))
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
-- Ensure C/C++ debugger is installed
|
||||
"williamboman/mason.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
vim.list_extend(opts.ensure_installed, { "codelldb" })
|
||||
end
|
||||
end,
|
||||
},
|
||||
opts = function()
|
||||
local dap = require("dap")
|
||||
if not dap.adapters["codelldb"] then
|
||||
require("dap").adapters["codelldb"] = {
|
||||
type = "server",
|
||||
host = "localhost",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = "codelldb",
|
||||
args = {
|
||||
"--port",
|
||||
"${port}",
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
for _, lang in ipairs({ "c", "cpp" }) do
|
||||
dap.configurations[lang] = {
|
||||
{
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
{
|
||||
type = "codelldb",
|
||||
request = "attach",
|
||||
name = "Attach to process",
|
||||
processId = require("dap.utils").pick_process,
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
}
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
36
lua/lazyvim/plugins/extras/lang/docker.lua
Normal file
36
lua/lazyvim/plugins/extras/lang/docker.lua
Normal file
@ -0,0 +1,36 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
vim.list_extend(opts.ensure_installed, { "dockerfile" })
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
opts = function(_, opts)
|
||||
local nls = require("null-ls")
|
||||
opts.sources = opts.sources or {}
|
||||
vim.list_extend(opts.sources, {
|
||||
nls.builtins.diagnostics.hadolint,
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
"mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, { "hadolint" })
|
||||
end,
|
||||
},
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
dockerls = {},
|
||||
docker_compose_language_service = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
32
lua/lazyvim/plugins/extras/lang/elixir.lua
Normal file
32
lua/lazyvim/plugins/extras/lang/elixir.lua
Normal file
@ -0,0 +1,32 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"elixir",
|
||||
"heex",
|
||||
"eex",
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = function(_, opts)
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"elixir-ls",
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
"jfpedroza/neotest-elixir",
|
||||
},
|
||||
opts = {
|
||||
adapters = {
|
||||
["neotest-elixir"] = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
@ -17,14 +17,45 @@ return {
|
||||
gopls = {
|
||||
settings = {
|
||||
gopls = {
|
||||
gofumpt = true,
|
||||
codelenses = {
|
||||
gc_details = false,
|
||||
generate = true,
|
||||
regenerate_cgo = true,
|
||||
run_govulncheck = true,
|
||||
test = true,
|
||||
tidy = true,
|
||||
upgrade_dependency = true,
|
||||
vendor = true,
|
||||
},
|
||||
hints = {
|
||||
assignVariableTypes = true,
|
||||
compositeLiteralFields = true,
|
||||
compositeLiteralTypes = true,
|
||||
constantValues = true,
|
||||
functionTypeParameters = true,
|
||||
parameterNames = true,
|
||||
rangeVariableTypes = true,
|
||||
},
|
||||
analyses = {
|
||||
fieldalignment = true,
|
||||
nilness = true,
|
||||
unusedparams = true,
|
||||
unusedwrite = true,
|
||||
useany = true,
|
||||
},
|
||||
usePlaceholders = true,
|
||||
completeUnimported = true,
|
||||
staticcheck = true,
|
||||
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
|
||||
semanticTokens = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
gopls = function()
|
||||
-- workaround for gopls not supporting semantictokensprovider
|
||||
gopls = function(_, opts)
|
||||
-- workaround for gopls not supporting semanticTokensProvider
|
||||
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
|
||||
require("lazyvim.util").on_attach(function(client, _)
|
||||
if client.name == "gopls" then
|
||||
@ -46,6 +77,21 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Ensure Go tools are installed
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
opts = function(_, opts)
|
||||
if type(opts.sources) == "table" then
|
||||
local nls = require("null-ls")
|
||||
vim.list_extend(opts.sources, {
|
||||
nls.builtins.code_actions.gomodifytags,
|
||||
nls.builtins.code_actions.impl,
|
||||
nls.builtins.formatting.gofumpt,
|
||||
nls.builtins.formatting.goimports_reviser,
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
@ -54,7 +100,7 @@ return {
|
||||
"mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
table.insert(opts.ensure_installed, "delve")
|
||||
vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "gofumpt", "goimports-reviser", "delve" })
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
67
lua/lazyvim/plugins/extras/lang/python.lua
Normal file
67
lua/lazyvim/plugins/extras/lang/python.lua
Normal file
@ -0,0 +1,67 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
vim.list_extend(opts.ensure_installed, { "ninja", "python", "rst", "toml" })
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
pyright = {},
|
||||
ruff_lsp = {},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
ruff_lsp = function()
|
||||
require("lazyvim.util").on_attach(function(client, _)
|
||||
if client.name == "ruff_lsp" then
|
||||
-- Disable hover in favor of Pyright
|
||||
client.server_capabilities.hoverProvider = false
|
||||
end
|
||||
end)
|
||||
end,
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
"nvim-neotest/neotest-python",
|
||||
},
|
||||
opts = {
|
||||
adapters = {
|
||||
["neotest-python"] = {
|
||||
-- Here you can specify the settings for the adapter, i.e.
|
||||
-- runner = "pytest",
|
||||
-- python = ".venv/bin/python",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap-python",
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>dPt", function() require('dap-python').test_method() end, desc = "Debug Method" },
|
||||
{ "<leader>dPc", function() require('dap-python').test_class() end, desc = "Debug Class" },
|
||||
},
|
||||
config = function()
|
||||
local path = require("mason-registry").get_package("debugpy"):get_install_path()
|
||||
require("dap-python").setup(path .. "/venv/bin/python")
|
||||
end,
|
||||
},
|
||||
},
|
||||
{
|
||||
"linux-cultist/venv-selector.nvim",
|
||||
cmd = "VenvSelect",
|
||||
opts = {},
|
||||
keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv" } },
|
||||
},
|
||||
}
|
152
lua/lazyvim/plugins/extras/lang/rust.lua
Normal file
152
lua/lazyvim/plugins/extras/lang/rust.lua
Normal file
@ -0,0 +1,152 @@
|
||||
return {
|
||||
|
||||
-- Extend auto completion
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
{
|
||||
"Saecki/crates.nvim",
|
||||
event = { "BufRead Cargo.toml" },
|
||||
config = true,
|
||||
},
|
||||
},
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, {
|
||||
{ name = "crates" },
|
||||
}))
|
||||
end,
|
||||
},
|
||||
|
||||
-- Add Rust & related to treesitter
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
vim.list_extend(opts.ensure_installed, { "ron", "rust", "toml" })
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- Ensure Rust debugger is installed
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
vim.list_extend(opts.ensure_installed, { "codelldb" })
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"simrat39/rust-tools.nvim",
|
||||
lazy = true,
|
||||
opts = function()
|
||||
local ok, mason_registry = pcall(require, "mason-registry")
|
||||
local adapter ---@type any
|
||||
if ok then
|
||||
-- rust tools configuration for debugging support
|
||||
local codelldb = mason_registry.get_package("codelldb")
|
||||
local extension_path = codelldb:get_install_path() .. "/extension/"
|
||||
local codelldb_path = extension_path .. "adapter/codelldb"
|
||||
local liblldb_path = vim.fn.has("mac") == 1 and extension_path .. "lldb/lib/liblldb.dylib"
|
||||
or extension_path .. "lldb/lib/liblldb.so"
|
||||
adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path)
|
||||
end
|
||||
return {
|
||||
dap = {
|
||||
adapter = adapter,
|
||||
},
|
||||
tools = {
|
||||
on_initialized = function()
|
||||
vim.cmd([[
|
||||
augroup RustLSP
|
||||
autocmd CursorHold *.rs silent! lua vim.lsp.buf.document_highlight()
|
||||
autocmd CursorMoved,InsertEnter *.rs silent! lua vim.lsp.buf.clear_references()
|
||||
autocmd BufEnter,CursorHold,InsertLeave *.rs silent! lua vim.lsp.codelens.refresh()
|
||||
augroup END
|
||||
]])
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
config = function() end,
|
||||
},
|
||||
|
||||
-- Correctly setup lspconfig for Rust 🚀
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
-- Ensure mason installs the server
|
||||
rust_analyzer = {
|
||||
keys = {
|
||||
{ "K", "<cmd>RustHoverActions<cr>", desc = "Hover Actions (Rust)" },
|
||||
{ "<leader>cR", "<cmd>RustCodeAction<cr>", desc = "Code Action (Rust)" },
|
||||
{ "<leader>dr", "<cmd>RustDebuggables<cr>", desc = "Run Debuggables (Rust)" },
|
||||
},
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
loadOutDirsFromCheck = true,
|
||||
runBuildScripts = true,
|
||||
},
|
||||
-- Add clippy lints for Rust.
|
||||
checkOnSave = {
|
||||
allFeatures = true,
|
||||
command = "clippy",
|
||||
extraArgs = { "--no-deps" },
|
||||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
ignored = {
|
||||
["async-trait"] = { "async_trait" },
|
||||
["napi-derive"] = { "napi" },
|
||||
["async-recursion"] = { "async_recursion" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
taplo = {
|
||||
keys = {
|
||||
{
|
||||
"K",
|
||||
function()
|
||||
if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then
|
||||
require("crates").show_popup()
|
||||
else
|
||||
vim.lsp.buf.hover()
|
||||
end
|
||||
end,
|
||||
desc = "Show Crate Documentation",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
rust_analyzer = function(_, opts)
|
||||
local rust_tools_opts = require("lazyvim.util").opts("rust-tools.nvim")
|
||||
require("rust-tools").setup(vim.tbl_deep_extend("force", rust_tools_opts or {}, { server = opts }))
|
||||
return true
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
"rouge8/neotest-rust",
|
||||
},
|
||||
opts = {
|
||||
adapters = {
|
||||
["neotest-rust"] = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
33
lua/lazyvim/plugins/extras/lang/terraform.lua
Normal file
33
lua/lazyvim/plugins/extras/lang/terraform.lua
Normal file
@ -0,0 +1,33 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"terraform",
|
||||
"hcl",
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
terraformls = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
opts = function(_, opts)
|
||||
if type(opts.sources) == "table" then
|
||||
local null_ls = require("null-ls")
|
||||
vim.list_extend(opts.sources, {
|
||||
null_ls.builtins.formatting.terraform_fmt,
|
||||
null_ls.builtins.diagnostics.terraform_validate,
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
58
lua/lazyvim/plugins/extras/lang/tex.lua
Normal file
58
lua/lazyvim/plugins/extras/lang/tex.lua
Normal file
@ -0,0 +1,58 @@
|
||||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
defaults = {
|
||||
["<localLeader>l"] = { name = "+vimtex" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Add BibTeX/LaTeX to treesitter
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
vim.list_extend(opts.ensure_installed, { "bibtex", "latex" })
|
||||
end
|
||||
if type(opts.highlight.disable) == "table" then
|
||||
vim.list_extend(opts.highlight.disable, { "latex" })
|
||||
else
|
||||
opts.highlight.disable = { "latex" }
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"lervag/vimtex",
|
||||
lazy = false, -- lazy-loading will disable inverse search
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
group = vim.api.nvim_create_augroup("lazyvim_vimtex_conceal", { clear = true }),
|
||||
pattern = { "bib", "tex" },
|
||||
callback = function()
|
||||
vim.wo.conceallevel = 2
|
||||
end,
|
||||
})
|
||||
|
||||
vim.g.vimtex_mappings_disable = { ["n"] = { "K" } } -- disable `K` as it conflicts with LSP hover
|
||||
vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog"
|
||||
end,
|
||||
},
|
||||
|
||||
-- Correctly setup lspconfig for LaTeX 🚀
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
optional = true,
|
||||
opts = {
|
||||
servers = {
|
||||
texlab = {
|
||||
keys = {
|
||||
{ "<Leader>K", "<plug>(vimtex-doc-package)", desc = "Vimtex Docs", silent = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
@ -19,6 +19,10 @@ return {
|
||||
servers = {
|
||||
---@type lspconfig.options.tsserver
|
||||
tsserver = {
|
||||
keys = {
|
||||
{ "<leader>co", "<cmd>TypescriptOrganizeImports<CR>", desc = "Organize Imports" },
|
||||
{ "<leader>cR", "<cmd>TypescriptRenameFile<CR>", desc = "Rename File" },
|
||||
},
|
||||
settings = {
|
||||
typescript = {
|
||||
format = {
|
||||
@ -42,14 +46,6 @@ return {
|
||||
},
|
||||
setup = {
|
||||
tsserver = function(_, opts)
|
||||
require("lazyvim.util").on_attach(function(client, buffer)
|
||||
if client.name == "tsserver" then
|
||||
-- stylua: ignore
|
||||
vim.keymap.set("n", "<leader>co", "<cmd>TypescriptOrganizeImports<CR>", { buffer = buffer, desc = "Organize Imports" })
|
||||
-- stylua: ignore
|
||||
vim.keymap.set("n", "<leader>cR", "<cmd>TypescriptRenameFile<CR>", { desc = "Rename File", buffer = buffer })
|
||||
end
|
||||
end)
|
||||
require("typescript").setup({ server = opts })
|
||||
return true
|
||||
end,
|
||||
|
@ -14,101 +14,108 @@ return {
|
||||
-- stylua: ignore
|
||||
{ "<leader>uE", function() require("edgy").select() end, desc = "Edgy Select Window" },
|
||||
},
|
||||
opts = {
|
||||
bottom = {
|
||||
{
|
||||
ft = "toggleterm",
|
||||
size = { height = 0.4 },
|
||||
filter = function(buf, win)
|
||||
return vim.api.nvim_win_get_config(win).relative == ""
|
||||
opts = function()
|
||||
local opts = {
|
||||
bottom = {
|
||||
{
|
||||
ft = "toggleterm",
|
||||
size = { height = 0.4 },
|
||||
filter = function(buf, win)
|
||||
return vim.api.nvim_win_get_config(win).relative == ""
|
||||
end,
|
||||
},
|
||||
{
|
||||
ft = "noice",
|
||||
size = { height = 0.4 },
|
||||
filter = function(buf, win)
|
||||
return vim.api.nvim_win_get_config(win).relative == ""
|
||||
end,
|
||||
},
|
||||
{
|
||||
ft = "lazyterm",
|
||||
title = "LazyTerm",
|
||||
size = { height = 0.4 },
|
||||
filter = function(buf)
|
||||
return not vim.b[buf].lazyterm_cmd
|
||||
end,
|
||||
},
|
||||
"Trouble",
|
||||
{ ft = "qf", title = "QuickFix" },
|
||||
{
|
||||
ft = "help",
|
||||
size = { height = 20 },
|
||||
-- don't open help files in edgy that we're editing
|
||||
filter = function(buf)
|
||||
return vim.bo[buf].buftype == "help"
|
||||
end,
|
||||
},
|
||||
{ ft = "spectre_panel", size = { height = 0.4 } },
|
||||
{ title = "Neotest Output", ft = "neotest-output-panel", size = { height = 15 } },
|
||||
},
|
||||
left = {
|
||||
{
|
||||
title = "Neo-Tree",
|
||||
ft = "neo-tree",
|
||||
filter = function(buf)
|
||||
return vim.b[buf].neo_tree_source == "filesystem"
|
||||
end,
|
||||
pinned = true,
|
||||
open = function()
|
||||
vim.api.nvim_input("<esc><space>e")
|
||||
end,
|
||||
size = { height = 0.5 },
|
||||
},
|
||||
{ title = "Neotest Summary", ft = "neotest-summary" },
|
||||
{
|
||||
title = "Neo-Tree Git",
|
||||
ft = "neo-tree",
|
||||
filter = function(buf)
|
||||
return vim.b[buf].neo_tree_source == "git_status"
|
||||
end,
|
||||
pinned = true,
|
||||
open = "Neotree position=right git_status",
|
||||
},
|
||||
{
|
||||
title = "Neo-Tree Buffers",
|
||||
ft = "neo-tree",
|
||||
filter = function(buf)
|
||||
return vim.b[buf].neo_tree_source == "buffers"
|
||||
end,
|
||||
pinned = true,
|
||||
open = "Neotree position=top buffers",
|
||||
},
|
||||
"neo-tree",
|
||||
},
|
||||
keys = {
|
||||
-- increase width
|
||||
["<c-Right>"] = function(win)
|
||||
win:resize("width", 2)
|
||||
end,
|
||||
-- decrease width
|
||||
["<c-Left>"] = function(win)
|
||||
win:resize("width", -2)
|
||||
end,
|
||||
-- increase height
|
||||
["<c-Up>"] = function(win)
|
||||
win:resize("height", 2)
|
||||
end,
|
||||
-- decrease height
|
||||
["<c-Down>"] = function(win)
|
||||
win:resize("height", -2)
|
||||
end,
|
||||
},
|
||||
{
|
||||
ft = "noice",
|
||||
size = { height = 0.4 },
|
||||
filter = function(buf, win)
|
||||
return vim.api.nvim_win_get_config(win).relative == ""
|
||||
end,
|
||||
},
|
||||
{
|
||||
ft = "lazyterm",
|
||||
title = "LazyTerm",
|
||||
size = { height = 0.4 },
|
||||
filter = function(buf)
|
||||
return not vim.b[buf].lazyterm_cmd
|
||||
end,
|
||||
},
|
||||
"Trouble",
|
||||
{ ft = "qf", title = "QuickFix" },
|
||||
{
|
||||
ft = "help",
|
||||
size = { height = 20 },
|
||||
-- don't open help files in edgy that we're editing
|
||||
filter = function(buf)
|
||||
return vim.bo[buf].buftype == "help"
|
||||
end,
|
||||
},
|
||||
{ ft = "spectre_panel", size = { height = 0.4 } },
|
||||
{ title = "Neotest Output", ft = "neotest-output-panel", size = { height = 15 } },
|
||||
},
|
||||
left = {
|
||||
{
|
||||
title = "Neo-Tree",
|
||||
ft = "neo-tree",
|
||||
filter = function(buf)
|
||||
return vim.b[buf].neo_tree_source == "filesystem"
|
||||
end,
|
||||
pinned = true,
|
||||
open = function()
|
||||
vim.api.nvim_input("<esc><space>e")
|
||||
end,
|
||||
size = { height = 0.5 },
|
||||
},
|
||||
{ title = "Neotest Summary", ft = "neotest-summary" },
|
||||
{
|
||||
title = "Neo-Tree Git",
|
||||
ft = "neo-tree",
|
||||
filter = function(buf)
|
||||
return vim.b[buf].neo_tree_source == "git_status"
|
||||
end,
|
||||
pinned = true,
|
||||
open = "Neotree position=right git_status",
|
||||
},
|
||||
{
|
||||
title = "Neo-Tree Buffers",
|
||||
ft = "neo-tree",
|
||||
filter = function(buf)
|
||||
return vim.b[buf].neo_tree_source == "buffers"
|
||||
end,
|
||||
pinned = true,
|
||||
open = "Neotree position=top buffers",
|
||||
},
|
||||
{
|
||||
}
|
||||
local Util = require("lazyvim.util")
|
||||
if Util.has("symbols-outline.nvim") then
|
||||
table.insert(opts.left, {
|
||||
title = "Outline",
|
||||
ft = "Outline",
|
||||
pinned = true,
|
||||
open = "SymbolsOutline",
|
||||
},
|
||||
"neo-tree",
|
||||
},
|
||||
keys = {
|
||||
-- increase width
|
||||
["<c-Right>"] = function(win)
|
||||
win:resize("width", 2)
|
||||
end,
|
||||
-- decrease width
|
||||
["<c-Left>"] = function(win)
|
||||
win:resize("width", -2)
|
||||
end,
|
||||
-- increase height
|
||||
["<c-Up>"] = function(win)
|
||||
win:resize("height", 2)
|
||||
end,
|
||||
-- decrease height
|
||||
["<c-Down>"] = function(win)
|
||||
win:resize("height", -2)
|
||||
end,
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
|
||||
-- prevent neo-tree from opening files in edgy windows
|
||||
|
@ -54,7 +54,7 @@ M.plugin = {
|
||||
local match = m.full_match
|
||||
---@type string, number
|
||||
local color, shade = match:match("[%w-]+%-([a-z%-]+)%-(%d+)")
|
||||
shade = assert(tonumber(shade))
|
||||
shade = tonumber(shade)
|
||||
local bg = vim.tbl_get(M.colors, color, shade)
|
||||
if bg then
|
||||
local hl = "MiniHipatternsTailwind" .. color .. shade
|
||||
|
@ -21,23 +21,8 @@ local Config = require("lazy.core.config")
|
||||
local Plugin = require("lazy.core.plugin")
|
||||
Config.options.checker.enabled = false
|
||||
Config.options.change_detection.enabled = false
|
||||
|
||||
-- HACK: disable all plugins except the ones we want
|
||||
local fix_disabled = Plugin.Spec.fix_disabled
|
||||
function Plugin.Spec.fix_disabled(self)
|
||||
for _, plugin in pairs(self.plugins) do
|
||||
if not (vim.tbl_contains(enabled, plugin.name) or plugin.vscode) then
|
||||
plugin.enabled = false
|
||||
end
|
||||
end
|
||||
fix_disabled(self)
|
||||
end
|
||||
|
||||
-- HACK: don't clean plugins in vscode
|
||||
local update_state = Plugin.update_state
|
||||
function Plugin.update_state()
|
||||
update_state()
|
||||
Config.to_clean = {}
|
||||
Config.options.defaults.cond = function(plugin)
|
||||
return vim.tbl_contains(enabled, plugin.name) or plugin.vscode
|
||||
end
|
||||
|
||||
-- Add some vscode specific keymaps
|
||||
|
@ -4,7 +4,7 @@ return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
{ "folke/neoconf.nvim", cmd = "Neoconf", config = true },
|
||||
{ "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } },
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
"mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
@ -31,6 +31,12 @@ return {
|
||||
},
|
||||
severity_sort = true,
|
||||
},
|
||||
-- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0
|
||||
-- Be aware that you also will need to properly configure your LSP server to
|
||||
-- provide the inlay hints.
|
||||
inlay_hints = {
|
||||
enabled = false,
|
||||
},
|
||||
-- add any global capabilities here
|
||||
capabilities = {},
|
||||
-- Automatically format on save
|
||||
@ -51,6 +57,10 @@ return {
|
||||
jsonls = {},
|
||||
lua_ls = {
|
||||
-- mason = false, -- set to false if you don't want this server to be installed with mason
|
||||
-- Use this to add any additional keymaps
|
||||
-- for specific lsp servers
|
||||
---@type LazyKeys[]
|
||||
-- keys = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
@ -79,6 +89,11 @@ return {
|
||||
---@param opts PluginLspOpts
|
||||
config = function(_, opts)
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
if Util.has("neoconf.nvim") then
|
||||
local plugin = require("lazy.core.config").spec.plugins["neoconf.nvim"]
|
||||
require("neoconf").setup(require("lazy.core.plugin").values(plugin, "opts", false))
|
||||
end
|
||||
-- setup autoformat
|
||||
require("lazyvim.plugins.lsp.format").setup(opts)
|
||||
-- setup formatting and keymaps
|
||||
@ -86,12 +101,34 @@ return {
|
||||
require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer)
|
||||
end)
|
||||
|
||||
local register_capability = vim.lsp.handlers["client/registerCapability"]
|
||||
|
||||
vim.lsp.handlers["client/registerCapability"] = function(err, res, ctx)
|
||||
local ret = register_capability(err, res, ctx)
|
||||
local client_id = ctx.client_id
|
||||
---@type lsp.Client
|
||||
local client = vim.lsp.get_client_by_id(client_id)
|
||||
local buffer = vim.api.nvim_get_current_buf()
|
||||
require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer)
|
||||
return ret
|
||||
end
|
||||
|
||||
-- diagnostics
|
||||
for name, icon in pairs(require("lazyvim.config").icons.diagnostics) do
|
||||
name = "DiagnosticSign" .. name
|
||||
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
|
||||
end
|
||||
|
||||
local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint
|
||||
|
||||
if opts.inlay_hints.enabled and inlay_hint then
|
||||
Util.on_attach(function(client, buffer)
|
||||
if client.server_capabilities.inlayHintProvider then
|
||||
inlay_hint(buffer, true)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then
|
||||
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●"
|
||||
or function(diagnostic)
|
||||
@ -107,11 +144,12 @@ return {
|
||||
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
|
||||
|
||||
local servers = opts.servers
|
||||
local has_cmp, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
require("cmp_nvim_lsp").default_capabilities(),
|
||||
has_cmp and cmp_nvim_lsp.default_capabilities() or {},
|
||||
opts.capabilities or {}
|
||||
)
|
||||
|
||||
@ -192,6 +230,7 @@ return {
|
||||
"williamboman/mason.nvim",
|
||||
cmd = "Mason",
|
||||
keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
|
||||
build = ":MasonUpdate",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
|
@ -14,11 +14,11 @@ function M.get()
|
||||
M._keys = {
|
||||
{ "<leader>cd", vim.diagnostic.open_float, desc = "Line Diagnostics" },
|
||||
{ "<leader>cl", "<cmd>LspInfo<cr>", desc = "Lsp Info" },
|
||||
{ "gd", "<cmd>Telescope lsp_definitions<cr>", desc = "Goto Definition", has = "definition" },
|
||||
{ "gd", function() require("telescope.builtin").lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" },
|
||||
{ "gr", "<cmd>Telescope lsp_references<cr>", desc = "References" },
|
||||
{ "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" },
|
||||
{ "gI", "<cmd>Telescope lsp_implementations<cr>", desc = "Goto Implementation" },
|
||||
{ "gy", "<cmd>Telescope lsp_type_definitions<cr>", desc = "Goto T[y]pe Definition" },
|
||||
{ "gI", function() require("telescope.builtin").lsp_implementations({ reuse_win = true }) end, desc = "Goto Implementation" },
|
||||
{ "gy", function() require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) end, desc = "Goto T[y]pe Definition" },
|
||||
{ "K", vim.lsp.buf.hover, desc = "Hover" },
|
||||
{ "gK", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" },
|
||||
{ "<c-k>", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" },
|
||||
@ -28,8 +28,8 @@ function M.get()
|
||||
{ "[e", M.diagnostic_goto(false, "ERROR"), desc = "Prev Error" },
|
||||
{ "]w", M.diagnostic_goto(true, "WARN"), desc = "Next Warning" },
|
||||
{ "[w", M.diagnostic_goto(false, "WARN"), desc = "Prev Warning" },
|
||||
{ "<leader>cf", format, desc = "Format Document", has = "documentFormatting" },
|
||||
{ "<leader>cf", format, desc = "Format Range", mode = "v", has = "documentRangeFormatting" },
|
||||
{ "<leader>cf", format, desc = "Format Document", has = "formatting" },
|
||||
{ "<leader>cf", format, desc = "Format Range", mode = "v", has = "rangeFormatting" },
|
||||
{ "<leader>ca", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" },
|
||||
{
|
||||
"<leader>cA",
|
||||
@ -65,21 +65,51 @@ function M.get()
|
||||
return M._keys
|
||||
end
|
||||
|
||||
function M.on_attach(client, buffer)
|
||||
---@param method string
|
||||
function M.has(buffer, method)
|
||||
method = method:find("/") and method or "textDocument/" .. method
|
||||
local clients = vim.lsp.get_active_clients({ bufnr = buffer })
|
||||
for _, client in ipairs(clients) do
|
||||
if client.supports_method(method) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function M.resolve(buffer)
|
||||
local Keys = require("lazy.core.handler.keys")
|
||||
local keymaps = {} ---@type table<string,LazyKeys|{has?:string}>
|
||||
|
||||
for _, value in ipairs(M.get()) do
|
||||
local keys = Keys.parse(value)
|
||||
if keys[2] == vim.NIL or keys[2] == false then
|
||||
local function add(keymap)
|
||||
local keys = Keys.parse(keymap)
|
||||
if keys[2] == false then
|
||||
keymaps[keys.id] = nil
|
||||
else
|
||||
keymaps[keys.id] = keys
|
||||
end
|
||||
end
|
||||
for _, keymap in ipairs(M.get()) do
|
||||
add(keymap)
|
||||
end
|
||||
|
||||
local opts = require("lazyvim.util").opts("nvim-lspconfig")
|
||||
local clients = vim.lsp.get_active_clients({ bufnr = buffer })
|
||||
for _, client in ipairs(clients) do
|
||||
local maps = opts.servers[client.name] and opts.servers[client.name].keys or {}
|
||||
for _, keymap in ipairs(maps) do
|
||||
add(keymap)
|
||||
end
|
||||
end
|
||||
return keymaps
|
||||
end
|
||||
|
||||
function M.on_attach(client, buffer)
|
||||
local Keys = require("lazy.core.handler.keys")
|
||||
local keymaps = M.resolve(buffer)
|
||||
|
||||
for _, keys in pairs(keymaps) do
|
||||
if not keys.has or client.server_capabilities[keys.has .. "Provider"] then
|
||||
if not keys.has or M.has(buffer, keys.has) then
|
||||
local opts = Keys.opts(keys)
|
||||
---@diagnostic disable-next-line: no-unknown
|
||||
opts.has = nil
|
||||
|
@ -1,32 +1,26 @@
|
||||
local load_textobjects = false
|
||||
return {
|
||||
-- Treesitter is a new parser generator tool that we can
|
||||
-- use in Neovim to power faster and more accurate
|
||||
-- syntax highlighting.
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
version = false, -- last release is way too old and doesn't work on Windows
|
||||
build = ":TSUpdate",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
cmd = { "TSUpdateSync" },
|
||||
dependencies = {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
init = function()
|
||||
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
|
||||
local plugin = require("lazy.core.config").spec.plugins["nvim-treesitter"]
|
||||
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
|
||||
local enabled = false
|
||||
if opts.textobjects then
|
||||
for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do
|
||||
if opts.textobjects[mod] and opts.textobjects[mod].enable then
|
||||
enabled = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not enabled then
|
||||
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
|
||||
end
|
||||
-- disable rtp plugin, as we only need its queries for mini.ai
|
||||
-- In case other textobject modules are enabled, we will load them
|
||||
-- once nvim-treesitter is loaded
|
||||
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
|
||||
load_textobjects = true
|
||||
end,
|
||||
},
|
||||
},
|
||||
cmd = { "TSUpdateSync" },
|
||||
keys = {
|
||||
{ "<c-space>", desc = "Increment selection" },
|
||||
{ "<bs>", desc = "Decrement selection", mode = "x" },
|
||||
@ -79,6 +73,21 @@ return {
|
||||
end, opts.ensure_installed)
|
||||
end
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
|
||||
if load_textobjects then
|
||||
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
|
||||
if opts.textobjects then
|
||||
for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do
|
||||
if opts.textobjects[mod] and opts.textobjects[mod].enable then
|
||||
local Loader = require("lazy.core.loader")
|
||||
Loader.disabled_rtp_plugins["nvim-treesitter-textobjects"] = nil
|
||||
local plugin = require("lazy.core.config").plugins["nvim-treesitter-textobjects"]
|
||||
require("lazy.core.loader").source_runtime(plugin.dir, "plugin")
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user