Compare commits
124 Commits
Author | SHA1 | Date | |
---|---|---|---|
e990d23cfe | |||
b027bebeab | |||
19f4250888 | |||
33f61b58de | |||
5373af76f8 | |||
c526ea338b | |||
ba0cfbccf3 | |||
47ee48faba | |||
7bc979a7c1 | |||
9c7821e681 | |||
95e2a07f16 | |||
d35d982984 | |||
877e63ca8e | |||
bc24b68260 | |||
b75ed594a9 | |||
4f2bb725be | |||
2f0bfbbad8 | |||
01a6085b2b | |||
2b5ae7b63c | |||
dc40f02f35 | |||
4b367952f6 | |||
7c9abd7463 | |||
868ccedff2 | |||
29632c6b29 | |||
5b7ae96c5d | |||
e9fb81e94d | |||
b172f47f27 | |||
9cfe88c7ba | |||
163a4f9275 | |||
076b2e432e | |||
5bf45e3139 | |||
eba510ec69 | |||
39fa63646d | |||
e975f021ea | |||
bf66e71adc | |||
cd96e3d9e5 | |||
5559228300 | |||
3dcc074693 | |||
58c3842faa | |||
89db0157b1 | |||
7443effe26 | |||
78298cb134 | |||
55bf4d104c | |||
c12835ab86 | |||
183fd89d76 | |||
99785ce36b | |||
bb0d4d4e7d | |||
f8982332be | |||
0c517d1f5c | |||
df6a0d3b10 | |||
7a7c024bf6 | |||
29554455aa | |||
b227d9727a | |||
b4099a6477 | |||
5a27e1def0 | |||
06e4ba2fdb | |||
23410a4594 | |||
c737f2b6c2 | |||
78354a1e5e | |||
080ea29354 | |||
3d7238f753 | |||
a43d1b79f2 | |||
bd1ba54d13 | |||
9f2010a8b9 | |||
e09423b28c | |||
2525b91313 | |||
a213da4430 | |||
b57582bc91 | |||
d41ef05cc0 | |||
dfde622847 | |||
44df7434d4 | |||
049e323714 | |||
7d96b07c6f | |||
ad229bbf42 | |||
cbf1d335ed | |||
6ebf3ab084 | |||
25d37a2cdd | |||
7409fef291 | |||
3f5c2c283e | |||
f51719a12d | |||
ea4858874b | |||
c42ebc216a | |||
bdddb215cc | |||
eb143ebe11 | |||
86ac9989ea | |||
dc1d48f436 | |||
5202a0f006 | |||
7b9145c12d | |||
3e46dd61cd | |||
43763a6226 | |||
6c334fed6a | |||
d18331ca89 | |||
59f3b3e096 | |||
4fbb7a2803 | |||
b760ec63c4 | |||
d565684ade | |||
c7aeda9db1 | |||
3a718c5c85 | |||
6c86952a0e | |||
ad214af54d | |||
40983a3269 | |||
2f93f69171 | |||
4379ae8ab9 | |||
eb92903342 | |||
03282126e3 | |||
1274310e6d | |||
14e708a246 | |||
437156a3ae | |||
063f8d6dff | |||
d63c471008 | |||
4042614005 | |||
81ab5bed7a | |||
5264909b54 | |||
68c21ec452 | |||
7fe0d5c7c7 | |||
342fa02370 | |||
ac1051686b | |||
55cc8b67fc | |||
1d2c97cbda | |||
0b8c799a7a | |||
1caa27ba4a | |||
3518c1d73b | |||
ae8c371ff4 | |||
17fe32e428 |
307
CHANGELOG.md
307
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 April 18
|
||||
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 May 26
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *LazyVim-table-of-contents*
|
||||
@ -43,7 +43,6 @@ pre-configured setup.
|
||||
|
||||
FEATURES *LazyVim-features*
|
||||
|
||||
|
||||
- Transform your Neovim into a full-fledged IDE
|
||||
- Easily customize and extend your config with lazy.nvim <https://github.com/folke/lazy.nvim>
|
||||
- Blazingly fast
|
||||
@ -53,7 +52,6 @@ FEATURES *LazyVim-features*
|
||||
|
||||
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)**
|
||||
@ -77,7 +75,6 @@ Try it with Docker ~
|
||||
|
||||
Install the LazyVim Starter ~
|
||||
|
||||
|
||||
- Make a backup of your current Neovim files:
|
||||
>sh
|
||||
mv ~/.config/nvim ~/.config/nvim.bak
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- This file is automatically loaded by plugins.init
|
||||
-- This file is automatically loaded by lazyvim.config.init
|
||||
|
||||
local function augroup(name)
|
||||
return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
|
||||
@ -52,6 +52,7 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
"startuptime",
|
||||
"tsplayground",
|
||||
"checkhealth",
|
||||
"neotest-output",
|
||||
},
|
||||
callback = function(event)
|
||||
vim.bo[event.buf].buflisted = false
|
||||
|
@ -20,7 +20,7 @@ local defaults = {
|
||||
-- icons used by other plugins
|
||||
icons = {
|
||||
dap = {
|
||||
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||
Breakpoint = " ",
|
||||
BreakpointCondition = " ",
|
||||
BreakpointRejected = { " ", "DiagnosticError" },
|
||||
@ -77,6 +77,10 @@ local defaults = {
|
||||
},
|
||||
}
|
||||
|
||||
M.renames = {
|
||||
["windwp/nvim-spectre"] = "nvim-pack/nvim-spectre",
|
||||
}
|
||||
|
||||
---@type LazyVimConfig
|
||||
local options
|
||||
|
||||
@ -157,6 +161,8 @@ function M.load(name)
|
||||
-- HACK: LazyVim may have overwritten options of the Lazy ui, so reset this here
|
||||
vim.cmd([[do VimResized]])
|
||||
end
|
||||
local pattern = "LazyVim" .. name:sub(1, 1):upper() .. name:sub(2)
|
||||
vim.api.nvim_exec_autocmds("User", { pattern = pattern, modeline = false })
|
||||
end
|
||||
|
||||
M.did_init = false
|
||||
@ -170,6 +176,14 @@ function M.init()
|
||||
-- this is needed to make sure options will be correctly applied
|
||||
-- after installing missing plugins
|
||||
require("lazyvim.config").load("options")
|
||||
local Plugin = require("lazy.core.plugin")
|
||||
local add = Plugin.Spec.add
|
||||
Plugin.Spec.add = function(self, plugin, ...)
|
||||
if type(plugin) == "table" and M.renames[plugin[1]] then
|
||||
plugin[1] = M.renames[plugin[1]]
|
||||
end
|
||||
return add(self, plugin, ...)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
-- This file is automatically loaded by lazyvim.plugins.config
|
||||
|
||||
-- This file is automatically loaded by lazyvim.config.init
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
@ -9,6 +8,9 @@ local function map(mode, lhs, rhs, opts)
|
||||
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
|
||||
opts = opts or {}
|
||||
opts.silent = opts.silent ~= false
|
||||
if opts.remap and not vim.g.vscode then
|
||||
opts.remap = nil
|
||||
end
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
end
|
||||
end
|
||||
@ -18,10 +20,10 @@ map("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
map("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
|
||||
-- Move to window using the <ctrl> hjkl keys
|
||||
map("n", "<C-h>", "<C-w>h", { desc = "Go to left window" })
|
||||
map("n", "<C-j>", "<C-w>j", { desc = "Go to lower window" })
|
||||
map("n", "<C-k>", "<C-w>k", { desc = "Go to upper window" })
|
||||
map("n", "<C-l>", "<C-w>l", { desc = "Go to right window" })
|
||||
map("n", "<C-h>", "<C-w>h", { desc = "Go to left window", remap = true })
|
||||
map("n", "<C-j>", "<C-w>j", { desc = "Go to lower window", remap = true })
|
||||
map("n", "<C-k>", "<C-w>k", { desc = "Go to upper window", remap = true })
|
||||
map("n", "<C-l>", "<C-w>l", { desc = "Go to right window", remap = true })
|
||||
|
||||
-- Resize window using <ctrl> arrow keys
|
||||
map("n", "<C-Up>", "<cmd>resize +2<cr>", { desc = "Increase window height" })
|
||||
@ -129,12 +131,12 @@ map("n", "<leader>fT", function() Util.float_term() end, { desc = "Terminal (cwd
|
||||
map("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })
|
||||
|
||||
-- windows
|
||||
map("n", "<leader>ww", "<C-W>p", { desc = "Other window" })
|
||||
map("n", "<leader>wd", "<C-W>c", { desc = "Delete window" })
|
||||
map("n", "<leader>w-", "<C-W>s", { desc = "Split window below" })
|
||||
map("n", "<leader>w|", "<C-W>v", { desc = "Split window right" })
|
||||
map("n", "<leader>-", "<C-W>s", { desc = "Split window below" })
|
||||
map("n", "<leader>|", "<C-W>v", { desc = "Split window right" })
|
||||
map("n", "<leader>ww", "<C-W>p", { desc = "Other window", remap = true })
|
||||
map("n", "<leader>wd", "<C-W>c", { desc = "Delete window", remap = true })
|
||||
map("n", "<leader>w-", "<C-W>s", { desc = "Split window below", remap = true })
|
||||
map("n", "<leader>w|", "<C-W>v", { desc = "Split window right", remap = true })
|
||||
map("n", "<leader>-", "<C-W>s", { desc = "Split window below", remap = true })
|
||||
map("n", "<leader>|", "<C-W>v", { desc = "Split window right", remap = true })
|
||||
|
||||
-- tabs
|
||||
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })
|
||||
|
@ -1,12 +1,17 @@
|
||||
local M = {}
|
||||
|
||||
local start = vim.health.start or vim.health.report_start
|
||||
local ok = vim.health.ok or vim.health.report_ok
|
||||
local warn = vim.health.warn or vim.health.report_warn
|
||||
local error = vim.health.error or vim.health.report_error
|
||||
|
||||
function M.check()
|
||||
vim.health.report_start("LazyVim")
|
||||
start("LazyVim")
|
||||
|
||||
if vim.fn.has("nvim-0.8.0") == 1 then
|
||||
vim.health.report_ok("Using Neovim >= 0.8.0")
|
||||
ok("Using Neovim >= 0.8.0")
|
||||
else
|
||||
vim.health.report_error("Neovim >= 0.8.0 is required")
|
||||
error("Neovim >= 0.8.0 is required")
|
||||
end
|
||||
|
||||
for _, cmd in ipairs({ "git", "rg", { "fd", "fdfind" }, "lazygit" }) do
|
||||
@ -23,9 +28,9 @@ function M.check()
|
||||
end
|
||||
|
||||
if found then
|
||||
vim.health.report_ok(("`%s` is installed"):format(name))
|
||||
ok(("`%s` is installed"):format(name))
|
||||
else
|
||||
vim.health.report_warn(("`%s` is not installed"):format(name))
|
||||
warn(("`%s` is not installed"):format(name))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -93,9 +93,7 @@ return {
|
||||
{
|
||||
"echasnovski/mini.pairs",
|
||||
event = "VeryLazy",
|
||||
config = function(_, opts)
|
||||
require("mini.pairs").setup(opts)
|
||||
end,
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- surround
|
||||
@ -130,10 +128,6 @@ return {
|
||||
update_n_lines = "gzn", -- Update `n_lines`
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
-- use gz mappings instead of s to prevent conflict with leap
|
||||
require("mini.surround").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
-- comments
|
||||
@ -142,15 +136,12 @@ return {
|
||||
"echasnovski/mini.comment",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
hooks = {
|
||||
pre = function()
|
||||
require("ts_context_commentstring.internal").update_commentstring({})
|
||||
options = {
|
||||
custom_commentstring = function()
|
||||
return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("mini.comment").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
-- better text-objects
|
||||
|
@ -40,6 +40,7 @@ return {
|
||||
filesystem = {
|
||||
bind_to_cwd = false,
|
||||
follow_current_file = true,
|
||||
use_libuv_file_watcher = true,
|
||||
},
|
||||
window = {
|
||||
mappings = {
|
||||
@ -55,11 +56,22 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("neo-tree").setup(opts)
|
||||
vim.api.nvim_create_autocmd("TermClose", {
|
||||
pattern = "*lazygit",
|
||||
callback = function()
|
||||
if package.loaded["neo-tree.sources.git_status"] then
|
||||
require("neo-tree.sources.git_status").refresh()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- search/replace in multiple files
|
||||
{
|
||||
"windwp/nvim-spectre",
|
||||
"nvim-pack/nvim-spectre",
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>sr", function() require("spectre").open() end, desc = "Replace in files (Spectre)" },
|
||||
@ -69,6 +81,7 @@ return {
|
||||
-- fuzzy finder
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
commit = vim.fn.has("nvim-0.9.0") == 0 and "057ee0f8783" or nil,
|
||||
cmd = "Telescope",
|
||||
version = false, -- telescope did only one release, so use HEAD for now
|
||||
keys = {
|
||||
@ -81,6 +94,7 @@ return {
|
||||
{ "<leader>ff", Util.telescope("files"), desc = "Find Files (root dir)" },
|
||||
{ "<leader>fF", Util.telescope("files", { cwd = false }), desc = "Find Files (cwd)" },
|
||||
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent" },
|
||||
{ "<leader>fR", Util.telescope("oldfiles", { cwd = vim.loop.cwd() }), desc = "Recent (cwd)" },
|
||||
-- git
|
||||
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "commits" },
|
||||
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "status" },
|
||||
@ -153,10 +167,14 @@ return {
|
||||
return require("trouble.providers.telescope").open_selected_with_trouble(...)
|
||||
end,
|
||||
["<a-i>"] = function()
|
||||
Util.telescope("find_files", { no_ignore = true })()
|
||||
local action_state = require("telescope.actions.state")
|
||||
local line = action_state.get_current_line()
|
||||
Util.telescope("find_files", { no_ignore = true, default_text = line })()
|
||||
end,
|
||||
["<a-h>"] = function()
|
||||
Util.telescope("find_files", { hidden = true })()
|
||||
local action_state = require("telescope.actions.state")
|
||||
local line = action_state.get_current_line()
|
||||
Util.telescope("find_files", { hidden = true, default_text = line })()
|
||||
end,
|
||||
["<C-Down>"] = function(...)
|
||||
return require("telescope.actions").cycle_history_next(...)
|
||||
|
@ -10,6 +10,35 @@ return {
|
||||
panel = { enabled = false },
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
optional = true,
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
local Util = require("lazyvim.util")
|
||||
local colors = {
|
||||
[""] = Util.fg("Special"),
|
||||
["Normal"] = Util.fg("Special"),
|
||||
["Warning"] = Util.fg("DiagnosticError"),
|
||||
["InProgress"] = Util.fg("DiagnosticWarn"),
|
||||
}
|
||||
table.insert(opts.sections.lualine_x, 2, {
|
||||
function()
|
||||
local icon = require("lazyvim.config").icons.kinds.Copilot
|
||||
local status = require("copilot.api").status.data
|
||||
return icon .. (status.message or "")
|
||||
end,
|
||||
cond = function()
|
||||
local ok, clients = pcall(vim.lsp.get_active_clients, { name = "copilot", bufnr = 0 })
|
||||
return ok and #clients > 0
|
||||
end,
|
||||
color = function()
|
||||
local status = require("copilot.api").status.data
|
||||
return colors[status.status] or colors[""]
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- copilot cmp source
|
||||
{
|
||||
@ -26,7 +55,7 @@ return {
|
||||
-- fixes lazy-loading issues with the copilot cmp source
|
||||
require("lazyvim.util").on_attach(function(client)
|
||||
if client.name == "copilot" then
|
||||
copilot_cmp._on_insert_enter()
|
||||
copilot_cmp._on_insert_enter({})
|
||||
end
|
||||
end)
|
||||
end,
|
||||
@ -38,21 +67,6 @@ return {
|
||||
|
||||
table.insert(opts.sources, 1, { name = "copilot", group_index = 2 })
|
||||
|
||||
local confirm = opts.mapping["<CR>"]
|
||||
local confirm_copilot = cmp.mapping.confirm({
|
||||
select = true,
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
})
|
||||
|
||||
opts.mapping = vim.tbl_extend("force", opts.mapping, {
|
||||
["<CR>"] = function(...)
|
||||
local entry = cmp.get_selected_entry()
|
||||
if entry and entry.source.name == "copilot" then
|
||||
return confirm_copilot(...)
|
||||
end
|
||||
return confirm(...)
|
||||
end,
|
||||
})
|
||||
opts.sorting = {
|
||||
priority_weight = 2,
|
||||
comparators = {
|
||||
|
@ -37,6 +37,7 @@ return {
|
||||
-- which key integration
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
defaults = {
|
||||
["<leader>d"] = { name = "+debug" },
|
||||
@ -53,7 +54,7 @@ return {
|
||||
opts = {
|
||||
-- Makes a best effort to setup the various debuggers with
|
||||
-- reasonable debug configurations
|
||||
automatic_setup = true,
|
||||
automatic_installation = true,
|
||||
|
||||
-- You can provide additional configuration to the handlers,
|
||||
-- see mason-nvim-dap README for more information
|
||||
@ -82,7 +83,7 @@ return {
|
||||
{ "<leader>do", function() require("dap").step_out() end, desc = "Step Out" },
|
||||
{ "<leader>dO", function() require("dap").step_over() end, desc = "Step Over" },
|
||||
{ "<leader>dp", function() require("dap").pause() end, desc = "Pause" },
|
||||
{ "<leader>dr", function() require("dap").repl.open() end, desc = "Repl" },
|
||||
{ "<leader>dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" },
|
||||
{ "<leader>ds", function() require("dap").session() end, desc = "Session" },
|
||||
{ "<leader>dt", function() require("dap").terminate() end, desc = "Terminate" },
|
||||
{ "<leader>dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" },
|
||||
|
77
lua/lazyvim/plugins/extras/lang/go.lua
Normal file
77
lua/lazyvim/plugins/extras/lang/go.lua
Normal file
@ -0,0 +1,77 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"go",
|
||||
"gomod",
|
||||
"gowork",
|
||||
"gosum",
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
gopls = {
|
||||
settings = {
|
||||
gopls = {
|
||||
semanticTokens = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
gopls = function()
|
||||
-- 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
|
||||
if not client.server_capabilities.semanticTokensProvider then
|
||||
local semantic = client.config.capabilities.textDocument.semanticTokens
|
||||
client.server_capabilities.semanticTokensProvider = {
|
||||
full = true,
|
||||
legend = {
|
||||
tokenTypes = semantic.tokenTypes,
|
||||
tokenModifiers = semantic.tokenModifiers,
|
||||
},
|
||||
range = true,
|
||||
}
|
||||
end
|
||||
end
|
||||
end)
|
||||
-- end workaround
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
{
|
||||
"mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
table.insert(opts.ensure_installed, "delve")
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
"nvim-neotest/neotest-go",
|
||||
},
|
||||
opts = {
|
||||
adapters = {
|
||||
["neotest-go"] = {
|
||||
-- Here we can set options for neotest-go, e.g.
|
||||
-- args = { "-tags=integration" }
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
35
lua/lazyvim/plugins/extras/lang/tailwind.lua
Normal file
35
lua/lazyvim/plugins/extras/lang/tailwind.lua
Normal file
@ -0,0 +1,35 @@
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
tailwindcss = {
|
||||
filetypes_exclude = { "markdown" },
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
tailwindcss = function(_, opts)
|
||||
local tw = require("lspconfig.server_configurations.tailwindcss")
|
||||
--- @param ft string
|
||||
opts.filetypes = vim.tbl_filter(function(ft)
|
||||
return not vim.tbl_contains(opts.filetypes_exclude or {}, ft)
|
||||
end, tw.default_config.filetypes)
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
|
||||
},
|
||||
opts = function(_, opts)
|
||||
-- original LazyVim kind icon formatter
|
||||
local format_kinds = opts.formatting.format
|
||||
opts.formatting.format = function(entry, item)
|
||||
format_kinds(entry, item) -- add icons
|
||||
return require("tailwindcss-colorizer-cmp").formatter(entry, item)
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
@ -20,6 +20,20 @@ return {
|
||||
---@type lspconfig.options.tsserver
|
||||
tsserver = {
|
||||
settings = {
|
||||
typescript = {
|
||||
format = {
|
||||
indentSize = vim.o.shiftwidth,
|
||||
convertTabsToSpaces = vim.o.expandtab,
|
||||
tabSize = vim.o.tabstop,
|
||||
},
|
||||
},
|
||||
javascript = {
|
||||
format = {
|
||||
indentSize = vim.o.shiftwidth,
|
||||
convertTabsToSpaces = vim.o.expandtab,
|
||||
tabSize = vim.o.tabstop,
|
||||
},
|
||||
},
|
||||
completions = {
|
||||
completeFunctionCalls = true,
|
||||
},
|
||||
@ -48,4 +62,56 @@ return {
|
||||
table.insert(opts.sources, require("typescript.extensions.null-ls.code-actions"))
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
table.insert(opts.ensure_installed, "js-debug-adapter")
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = function()
|
||||
local dap = require("dap")
|
||||
if not dap.adapters["pwa-node"] then
|
||||
require("dap").adapters["pwa-node"] = {
|
||||
type = "server",
|
||||
host = "localhost",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = "node",
|
||||
-- 💀 Make sure to update this path to point to your installation
|
||||
args = {
|
||||
require("mason-registry").get_package("js-debug-adapter"):get_install_path()
|
||||
.. "/js-debug/src/dapDebugServer.js",
|
||||
"${port}",
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
for _, language in ipairs({ "typescript", "javascript" }) do
|
||||
if not dap.configurations[language] then
|
||||
dap.configurations[language] = {
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = "${file}",
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "attach",
|
||||
name = "Attach",
|
||||
processId = require("dap.utils").pick_process,
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ return {
|
||||
"neovim/nvim-lspconfig",
|
||||
-- other settings removed for brevity
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
eslint = {
|
||||
settings = {
|
||||
@ -15,8 +16,12 @@ return {
|
||||
eslint = function()
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
callback = function(event)
|
||||
if require("lspconfig.util").get_active_client_by_name(event.buf, "eslint") then
|
||||
vim.cmd("EslintFixAll")
|
||||
local client = vim.lsp.get_active_clients({ bufnr = event.buf, name = "eslint" })[1]
|
||||
if client then
|
||||
local diag = vim.diagnostic.get(event.buf, { namespace = vim.lsp.diagnostic.get_namespace(client.id) })
|
||||
if #diag > 0 then
|
||||
vim.cmd("EslintFixAll")
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
73
lua/lazyvim/plugins/extras/test/core.lua
Normal file
73
lua/lazyvim/plugins/extras/test/core.lua
Normal file
@ -0,0 +1,73 @@
|
||||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
defaults = {
|
||||
["<leader>t"] = { name = "+test" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
opts = {
|
||||
-- Can be a list of adapters like what neotest expects,
|
||||
-- or a table of adapter names, mapped to adapter configs.
|
||||
-- The adapter will then be automatically loaded with the config.
|
||||
adapters = {},
|
||||
-- Example for loading neotest-go with a custom config
|
||||
-- adapters = {
|
||||
-- ["neotest-go"] = {
|
||||
-- args = { "-tags=integration" },
|
||||
-- },
|
||||
-- },
|
||||
},
|
||||
config = function(_, opts)
|
||||
local neotest_ns = vim.api.nvim_create_namespace("neotest")
|
||||
vim.diagnostic.config({
|
||||
virtual_text = {
|
||||
format = function(diagnostic)
|
||||
-- Replace newline and tab characters with space for more compact diagnostics
|
||||
local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
|
||||
return message
|
||||
end,
|
||||
},
|
||||
}, neotest_ns)
|
||||
|
||||
if opts.adapters then
|
||||
local adapters = {}
|
||||
for name, config in pairs(opts.adapters or {}) do
|
||||
if type(name) == "number" then
|
||||
adapters[#adapters + 1] = config
|
||||
elseif config ~= false then
|
||||
local adapter = require(name)
|
||||
if type(config) == "table" and not vim.tbl_isempty(config) then
|
||||
adapter = adapter(config)
|
||||
end
|
||||
adapters[#adapters + 1] = adapter
|
||||
end
|
||||
end
|
||||
opts.adapters = adapters
|
||||
end
|
||||
|
||||
require("neotest").setup(opts)
|
||||
end,
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>tr", function() require("neotest").run.run() end, desc = "Run Nearest" },
|
||||
{ "<leader>tR", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" },
|
||||
{ "<leader>ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" },
|
||||
{ "<leader>to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" },
|
||||
{ "<leader>tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" },
|
||||
{ "<leader>tS", function() require("neotest").run.stop() end, desc = "Stop" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>td", function() require("neotest").run.run({strategy = "dap"}) end, desc = "Debug Nearest" },
|
||||
},
|
||||
},
|
||||
}
|
@ -33,8 +33,5 @@ return {
|
||||
},
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("mini.animate").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
360
lua/lazyvim/plugins/extras/util/mini-hipatterns.lua
Normal file
360
lua/lazyvim/plugins/extras/util/mini-hipatterns.lua
Normal file
File diff suppressed because it is too large
Load Diff
45
lua/lazyvim/plugins/extras/util/project.lua
Normal file
45
lua/lazyvim/plugins/extras/util/project.lua
Normal file
@ -0,0 +1,45 @@
|
||||
return {
|
||||
{
|
||||
"telescope.nvim",
|
||||
dependencies = {
|
||||
-- project management
|
||||
{
|
||||
"ahmedkhalf/project.nvim",
|
||||
opts = {},
|
||||
event = "VeryLazy",
|
||||
config = function(_, opts)
|
||||
require("project_nvim").setup(opts)
|
||||
require("telescope").load_extension("projects")
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>fp", "<Cmd>Telescope projects<CR>", desc = "Projects" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"goolord/alpha-nvim",
|
||||
optional = true,
|
||||
opts = function(_, dashboard)
|
||||
local button = dashboard.button("p", " " .. " Projects", ":Telescope projects <CR>")
|
||||
button.opts.hl = "AlphaButtons"
|
||||
button.opts.hl_shortcut = "AlphaShortcut"
|
||||
table.insert(dashboard.section.buttons.val, 4, button)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"echasnovski/mini.starter",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
local items = {
|
||||
{
|
||||
name = "Projects",
|
||||
action = "Telescope projects",
|
||||
section = string.rep(" ", 22) .. "Telescope",
|
||||
},
|
||||
}
|
||||
vim.list_extend(opts.items, items)
|
||||
end,
|
||||
},
|
||||
}
|
67
lua/lazyvim/plugins/extras/vscode.lua
Normal file
67
lua/lazyvim/plugins/extras/vscode.lua
Normal file
@ -0,0 +1,67 @@
|
||||
if not vim.g.vscode then
|
||||
return {}
|
||||
end
|
||||
|
||||
local enabled = {
|
||||
"flit.nvim",
|
||||
"lazy.nvim",
|
||||
"leap.nvim",
|
||||
"mini.ai",
|
||||
"mini.comment",
|
||||
"mini.pairs",
|
||||
"mini.surround",
|
||||
"nvim-treesitter",
|
||||
"nvim-treesitter-textobjects",
|
||||
"nvim-ts-context-commentstring",
|
||||
"vim-repeat",
|
||||
"LazyVim",
|
||||
}
|
||||
|
||||
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 = {}
|
||||
end
|
||||
|
||||
-- Add some vscode specific keymaps
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyVimKeymaps",
|
||||
callback = function()
|
||||
vim.keymap.set("n", "<leader><space>", "<cmd>Find<cr>")
|
||||
vim.keymap.set("n", "<leader>/", [[<cmd>call VSCodeNotify('workbench.action.findInFiles')<cr>]])
|
||||
vim.keymap.set("n", "<leader>ss", [[<cmd>call VSCodeNotify('workbench.action.gotoSymbol')<cr>]])
|
||||
end,
|
||||
})
|
||||
|
||||
return {
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
config = function(_, opts)
|
||||
opts = opts or {}
|
||||
-- disable the colorscheme
|
||||
opts.colorscheme = function() end
|
||||
require("lazyvim").setup(opts)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = { highlight = { enable = false } },
|
||||
},
|
||||
}
|
@ -25,7 +25,8 @@ function M.format(opts)
|
||||
return
|
||||
end
|
||||
local ft = vim.bo[buf].filetype
|
||||
local have_nls = #require("null-ls.sources").get_available(ft, "NULL_LS_FORMATTING") > 0
|
||||
local have_nls = package.loaded["null-ls"]
|
||||
and (#require("null-ls.sources").get_available(ft, "NULL_LS_FORMATTING") > 0)
|
||||
|
||||
vim.lsp.buf.format(vim.tbl_deep_extend("force", {
|
||||
bufnr = buf,
|
||||
|
@ -5,7 +5,7 @@ return {
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
{ "folke/neoconf.nvim", cmd = "Neoconf", config = true },
|
||||
{ "folke/neodev.nvim", opts = { experimental = { pathStrict = true } } },
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
"mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
{
|
||||
@ -31,6 +31,8 @@ return {
|
||||
},
|
||||
severity_sort = true,
|
||||
},
|
||||
-- add any global capabilities here
|
||||
capabilities = {},
|
||||
-- Automatically format on save
|
||||
autoformat = true,
|
||||
-- options for vim.lsp.buf.format
|
||||
@ -73,10 +75,11 @@ return {
|
||||
},
|
||||
---@param opts PluginLspOpts
|
||||
config = function(_, opts)
|
||||
local Util = require("lazyvim.util")
|
||||
-- setup autoformat
|
||||
require("lazyvim.plugins.lsp.format").autoformat = opts.autoformat
|
||||
-- setup formatting and keymaps
|
||||
require("lazyvim.util").on_attach(function(client, buffer)
|
||||
Util.on_attach(function(client, buffer)
|
||||
require("lazyvim.plugins.lsp.format").on_attach(client, buffer)
|
||||
require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer)
|
||||
end)
|
||||
@ -87,7 +90,7 @@ return {
|
||||
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
|
||||
end
|
||||
|
||||
if opts.diagnostics.virtual_text.prefix == "icons" then
|
||||
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)
|
||||
local icons = require("lazyvim.config").icons.diagnostics
|
||||
@ -99,10 +102,16 @@ return {
|
||||
end
|
||||
end
|
||||
|
||||
vim.diagnostic.config(opts.diagnostics)
|
||||
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
|
||||
|
||||
local servers = opts.servers
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
require("cmp_nvim_lsp").default_capabilities(),
|
||||
opts.capabilities or {}
|
||||
)
|
||||
|
||||
local function setup(server)
|
||||
local server_opts = vim.tbl_deep_extend("force", {
|
||||
@ -142,8 +151,15 @@ return {
|
||||
end
|
||||
|
||||
if have_mason then
|
||||
mlsp.setup({ ensure_installed = ensure_installed })
|
||||
mlsp.setup_handlers({ setup })
|
||||
mlsp.setup({ ensure_installed = ensure_installed, handlers = { setup } })
|
||||
end
|
||||
|
||||
if Util.lsp_get_config("denols") and Util.lsp_get_config("tsserver") then
|
||||
local is_deno = require("lspconfig.util").root_pattern("deno.json", "deno.jsonc")
|
||||
Util.lsp_disable("tsserver", is_deno)
|
||||
Util.lsp_disable("denols", function(root_dir)
|
||||
return not is_deno(root_dir)
|
||||
end)
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
@ -34,7 +34,6 @@ return {
|
||||
opts = {
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
context_commentstring = { enable = true, enable_autocmd = false },
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
@ -60,13 +59,24 @@ return {
|
||||
keymaps = {
|
||||
init_selection = "<C-space>",
|
||||
node_incremental = "<C-space>",
|
||||
scope_incremental = "<nop>",
|
||||
scope_incremental = false,
|
||||
node_decremental = "<bs>",
|
||||
},
|
||||
},
|
||||
},
|
||||
---@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,
|
||||
},
|
||||
|
@ -8,7 +8,7 @@ return {
|
||||
function()
|
||||
require("notify").dismiss({ silent = true, pending = true })
|
||||
end,
|
||||
desc = "Delete all Notifications",
|
||||
desc = "Dismiss all Notifications",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
@ -59,6 +59,10 @@ return {
|
||||
},
|
||||
opts = {
|
||||
options = {
|
||||
-- stylua: ignore
|
||||
close_command = function(n) require("mini.bufremove").delete(n, false) end,
|
||||
-- stylua: ignore
|
||||
right_mouse_command = function(n) require("mini.bufremove").delete(n, false) end,
|
||||
diagnostics = "nvim_lsp",
|
||||
always_show_bufferline = false,
|
||||
diagnostics_indicator = function(_, _, diag)
|
||||
@ -85,14 +89,7 @@ return {
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
local icons = require("lazyvim.config").icons
|
||||
|
||||
local function fg(name)
|
||||
return function()
|
||||
---@type {foreground?:number}?
|
||||
local hl = vim.api.nvim_get_hl_by_name(name, true)
|
||||
return hl and hl.foreground and { fg = string.format("#%06x", hl.foreground) }
|
||||
end
|
||||
end
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
return {
|
||||
options = {
|
||||
@ -122,25 +119,25 @@ return {
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return " " .. require("dap").status() end,
|
||||
cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end,
|
||||
color = fg("Debug"),
|
||||
},
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return require("noice").api.status.command.get() end,
|
||||
cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end,
|
||||
color = fg("Statement"),
|
||||
color = Util.fg("Statement"),
|
||||
},
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return require("noice").api.status.mode.get() end,
|
||||
cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end,
|
||||
color = fg("Constant"),
|
||||
color = Util.fg("Constant"),
|
||||
},
|
||||
{ require("lazy.status").updates, cond = require("lazy.status").has_updates, color = fg("Special") },
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return " " .. require("dap").status() end,
|
||||
cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end,
|
||||
color = Util.fg("Debug"),
|
||||
},
|
||||
{ require("lazy.status").updates, cond = require("lazy.status").has_updates, color = Util.fg("Special") },
|
||||
{
|
||||
"diff",
|
||||
symbols = {
|
||||
@ -172,7 +169,7 @@ return {
|
||||
opts = {
|
||||
-- char = "▏",
|
||||
char = "│",
|
||||
filetype_exclude = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy" },
|
||||
filetype_exclude = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy", "mason" },
|
||||
show_trailing_blankline_indent = false,
|
||||
show_current_context = false,
|
||||
},
|
||||
@ -196,9 +193,6 @@ return {
|
||||
end,
|
||||
})
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("mini.indentscope").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
-- noicer ui
|
||||
@ -221,12 +215,23 @@ return {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
},
|
||||
routes = {
|
||||
{
|
||||
filter = {
|
||||
event = "msg_show",
|
||||
find = "%d+L, %d+B",
|
||||
},
|
||||
view = "mini",
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
bottom_search = true,
|
||||
command_palette = true,
|
||||
long_message_to_split = true,
|
||||
inc_rename = true,
|
||||
},
|
||||
},
|
||||
-- stylua: ignore
|
||||
|
@ -13,7 +13,7 @@ return {
|
||||
{
|
||||
"folke/persistence.nvim",
|
||||
event = "BufReadPre",
|
||||
opts = { options = { "buffers", "curdir", "tabpages", "winsize", "help", "globals" } },
|
||||
opts = { options = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp" } },
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>qs", function() require("persistence").load() end, desc = "Restore Session" },
|
||||
|
@ -43,7 +43,7 @@ function M.keymaps()
|
||||
|
||||
group = "Plugins"
|
||||
|
||||
local core = require("lazy.core.plugin").Spec.new({ import = "lazyvim.plugins" })
|
||||
local core = require("lazy.core.plugin").Spec.new({ import = "lazyvim.plugins" }, { optional = true })
|
||||
Util.foreach(core.plugins, function(name, plugin)
|
||||
group = ("[%s](%s)"):format(plugin.name, plugin.url)
|
||||
for _, key in ipairs(plugin.keys or {}) do
|
||||
@ -58,7 +58,7 @@ function M.keymaps()
|
||||
if t == "file" and name:find("%.lua$") then
|
||||
local modname = path:gsub(".*/lua/", ""):gsub("/", "."):gsub("%.lua$", "")
|
||||
local extra_doc = "/plugins/extras/" .. modname:gsub("lazyvim%.plugins%.extras%.", "")
|
||||
local extra = require("lazy.core.plugin").Spec.new({ import = modname })
|
||||
local extra = require("lazy.core.plugin").Spec.new({ import = modname }, { optional = true })
|
||||
Util.foreach(extra.plugins, function(name, plugin)
|
||||
group = ("[%s](%s)\nPart of [%s](%s)"):format(plugin.name, plugin.url, modname, extra_doc)
|
||||
for _, key in ipairs(plugin.keys or {}) do
|
||||
@ -215,7 +215,7 @@ To use this, add it to your **lazy.nvim** imports:
|
||||
```lua title="lua/config/lazy.lua" {4}
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
{ "folke/LazyVim", import = "lazyvim.plugins" },
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
{ import = "%s" },
|
||||
{ import = "plugins" },
|
||||
},
|
||||
@ -249,7 +249,7 @@ end
|
||||
|
||||
function M.plugins(path)
|
||||
local test = root .. "/lua/lazyvim/plugins/" .. path
|
||||
local spec = require("lazy.core.plugin").Spec.new(dofile(test))
|
||||
local spec = require("lazy.core.plugin").Spec.new(dofile(test), { optional = true })
|
||||
local source = Util.read_file(test)
|
||||
local parser = vim.treesitter.get_string_parser(source, "lua")
|
||||
|
||||
@ -276,7 +276,8 @@ function M.plugins(path)
|
||||
local text = vim.treesitter.get_node_text(node, source):sub(2, -2)
|
||||
if text:find("/") and #node:parent():field("name") == 0 then
|
||||
local plugin_node = node:parent():parent()
|
||||
if plugin_node:named_child(0):field("value")[1]:id() ~= node:id() then
|
||||
local first_child = plugin_node:named_child(0)
|
||||
if first_child and first_child:field("value")[1] and first_child:field("value")[1]:id() ~= node:id() then
|
||||
plugin_node = node
|
||||
end
|
||||
local comment_node = plugin_node:parent():prev_named_sibling()
|
||||
@ -306,11 +307,13 @@ function M.plugins(path)
|
||||
end
|
||||
|
||||
parser:parse()
|
||||
-- if path ~= "extras/vscode.lua" then
|
||||
parser:for_each_tree(function(tree)
|
||||
local node = tree:root()
|
||||
find_plugins(node)
|
||||
-- print(vim.treesitter.query.get_node_text(node, str))
|
||||
end)
|
||||
-- end
|
||||
|
||||
---@type string[]
|
||||
local lines = {
|
||||
|
@ -20,6 +20,13 @@ function M.has(plugin)
|
||||
return require("lazy.core.config").plugins[plugin] ~= nil
|
||||
end
|
||||
|
||||
function M.fg(name)
|
||||
---@type {foreground?:number}?
|
||||
local hl = vim.api.nvim_get_hl and vim.api.nvim_get_hl(0, { name = name }) or vim.api.nvim_get_hl_by_name(name, true)
|
||||
local fg = hl and hl.fg or hl.foreground
|
||||
return fg and { fg = string.format("#%06x", fg) }
|
||||
end
|
||||
|
||||
---@param fn fun()
|
||||
function M.on_very_lazy(fn)
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
@ -98,6 +105,20 @@ function M.telescope(builtin, opts)
|
||||
builtin = "find_files"
|
||||
end
|
||||
end
|
||||
if opts.cwd and opts.cwd ~= vim.loop.cwd() then
|
||||
opts.attach_mappings = function(_, map)
|
||||
map("i", "<a-c>", function()
|
||||
local action_state = require("telescope.actions.state")
|
||||
local line = action_state.get_current_line()
|
||||
M.telescope(
|
||||
params.builtin,
|
||||
vim.tbl_deep_extend("force", {}, params.opts or {}, { cwd = false, default_text = line })
|
||||
)()
|
||||
end)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
require("telescope.builtin")[builtin](opts)
|
||||
end
|
||||
end
|
||||
@ -189,4 +210,21 @@ function M.lazy_notify()
|
||||
timer:start(500, 0, replay)
|
||||
end
|
||||
|
||||
function M.lsp_get_config(server)
|
||||
local configs = require("lspconfig.configs")
|
||||
return rawget(configs, server)
|
||||
end
|
||||
|
||||
---@param server string
|
||||
---@param cond fun( root_dir, config): boolean
|
||||
function M.lsp_disable(server, cond)
|
||||
local util = require("lspconfig.util")
|
||||
local def = M.lsp_get_config(server)
|
||||
def.document_config.on_new_config = util.add_hook_before(def.document_config.on_new_config, function(config, root_dir)
|
||||
if cond(root_dir, config) then
|
||||
config.enabled = false
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
|
Reference in New Issue
Block a user