mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-09-01 07:30:03 +02:00
Merge branch 'main' into fix/tailwindcss-settings
This commit is contained in:
commit
7ca50b5ea7
35 changed files with 910 additions and 217 deletions
2
.github/.release-please-manifest.json
vendored
2
.github/.release-please-manifest.json
vendored
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
".": "14.6.0"
|
".": "14.12.0"
|
||||||
}
|
}
|
||||||
|
|
121
CHANGELOG.md
121
CHANGELOG.md
|
@ -1,5 +1,126 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [14.12.0](https://github.com/LazyVim/LazyVim/compare/v14.11.0...v14.12.0) (2025-02-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **config:** add option to disable the order check to warning message ([da3b515](https://github.com/LazyVim/LazyVim/commit/da3b5159df326bc31d5a0ebdfa2c5cbbd32df9d2))
|
||||||
|
* **config:** allow disabling the order check with `vim.g.lazyvim_check_order = false` ([0bbce17](https://github.com/LazyVim/LazyVim/commit/0bbce1775b7d6750d3c4d761f3ad1bcfb77fb805))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **copilot-chat:** added support for snacks picker. Closes [#5432](https://github.com/LazyVim/LazyVim/issues/5432). Closes [#5552](https://github.com/LazyVim/LazyVim/issues/5552) ([2a608f0](https://github.com/LazyVim/LazyVim/commit/2a608f00d47bb6679a27a313fb0404e4d3a2196c))
|
||||||
|
* **extras:** disable import handling when loading `:LazyExtras` + changed some recommendations ([121a2e2](https://github.com/LazyVim/LazyVim/commit/121a2e27ef0f4d8ab64bf76768b9600c45fd2364))
|
||||||
|
|
||||||
|
## [14.11.0](https://github.com/LazyVim/LazyVim/compare/v14.10.0...v14.11.0) (2025-02-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **config:** show a warning when lazy.nvim imports order is incorrect ([83988ea](https://github.com/LazyVim/LazyVim/commit/83988ea46eccbe20953cd807984d2e89d679aa6e))
|
||||||
|
* **defaults:** new installs now default to snacks picker/explorer. Existing installs don't change. ([25d90b5](https://github.com/LazyVim/LazyVim/commit/25d90b54a3b1863cb4428fd309ab855732289710))
|
||||||
|
* **extras:** big rework of default extras ([525377d](https://github.com/LazyVim/LazyVim/commit/525377dee9ac3d19f53e333538e4e85586163ad8))
|
||||||
|
* **util:** `has_extra` now also checks for manual imports in `lazy.lua` ([0416376](https://github.com/LazyVim/LazyVim/commit/041637673371db7866f8bf00d77fc2fb6cc673c6))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **extras:** remove debug ([b4c24a3](https://github.com/LazyVim/LazyVim/commit/b4c24a3fe882c21555e60a1ec44087526e856eb9))
|
||||||
|
* **snacks.explorer:** no longer needed to disable neo-tree ([2d6b492](https://github.com/LazyVim/LazyVim/commit/2d6b49281d2550222be6aada0b7eeca07bb26e10))
|
||||||
|
* **snacks.picker:** move dashboard shortcut to picker extra. Closes [#5549](https://github.com/LazyVim/LazyVim/issues/5549) ([2b3bcf3](https://github.com/LazyVim/LazyVim/commit/2b3bcf36b2392bef94afefc07e2fcf32960960d7))
|
||||||
|
|
||||||
|
## [14.10.0](https://github.com/LazyVim/LazyVim/compare/v14.9.0...v14.10.0) (2025-02-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **bufferline:** support for snacks picker sidebars ([3500d6a](https://github.com/LazyVim/LazyVim/commit/3500d6a826a32d06d921f3e22342734c61ef09fe))
|
||||||
|
* **refactoring:** fallback to using vim ui select for refactoring.nvim ([#5540](https://github.com/LazyVim/LazyVim/issues/5540)) ([23a1bbd](https://github.com/LazyVim/LazyVim/commit/23a1bbdae90f37aab4a86bfb4c113531a28e7f71))
|
||||||
|
* **snacks.explorer:** enabled netrw integration ([4f006f1](https://github.com/LazyVim/LazyVim/commit/4f006f1fba5fdaa0150c544ad7966b96ec9cb04a))
|
||||||
|
* **snacks.picker:** add projects picker to dashboard if snacks picker is enabled ([fb256f2](https://github.com/LazyVim/LazyVim/commit/fb256f2b688cb7ac9875f704fe6c00f27efc2354))
|
||||||
|
* **snacks.picker:** some extra keymaps ([ab30442](https://github.com/LazyVim/LazyVim/commit/ab304426527723e116742cd7862fc976f876107c))
|
||||||
|
* **snippets:** mini.snippets is out of beta ([#5505](https://github.com/LazyVim/LazyVim/issues/5505)) ([4a81a37](https://github.com/LazyVim/LazyVim/commit/4a81a370d7868d7db32042f69b0fc5a6218059c5))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **copilot:** remove load on BufReadPost instead of InsertEnter ([8f4e9b8](https://github.com/LazyVim/LazyVim/commit/8f4e9b8c1e43e354d91529484aedca54f04bdcf6))
|
||||||
|
* **go:** update go.lua to eliminate fieldalignment from analyses ([#5170](https://github.com/LazyVim/LazyVim/issues/5170)) ([5c97327](https://github.com/LazyVim/LazyVim/commit/5c9732733de62a4e15988826f53d16a4dfdf960c))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* **snacks_picker:** lazy-load trouble open action ([1a4d948](https://github.com/LazyVim/LazyVim/commit/1a4d948e0dae360836187be8c86283d7e814b7ef))
|
||||||
|
|
||||||
|
## [14.9.0](https://github.com/LazyVim/LazyVim/compare/v14.8.0...v14.9.0) (2025-01-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **markdown:** added markdown support for codecompanion ([e9db488](https://github.com/LazyVim/LazyVim/commit/e9db488acaa04f1a9eca6d022e57fed4271b8af8))
|
||||||
|
* **snacks.picker:** added <leader>si to search icons ([#5460](https://github.com/LazyVim/LazyVim/issues/5460)) ([eea52be](https://github.com/LazyVim/LazyVim/commit/eea52be3447502dde77d9e6fa75fd597a0b5a86a))
|
||||||
|
* **snacks.picker:** added <leader>su to search undotree ([#5447](https://github.com/LazyVim/LazyVim/issues/5447)) ([332b320](https://github.com/LazyVim/LazyVim/commit/332b32080c52727a16db90e06989caa0c378caa1))
|
||||||
|
* **snacks.picker:** added `leader-fB` to find any buffer (including hidden & nofile) ([83bf636](https://github.com/LazyVim/LazyVim/commit/83bf6360a1f28a3fc1afe31ae300247fc01c7a90))
|
||||||
|
* **snacks.picker:** added `leader-sp` to search for plugin spec ([7cf4185](https://github.com/LazyVim/LazyVim/commit/7cf4185dc4d1fe49ad004d33a6703603fb4500ff))
|
||||||
|
* **snacks.picker:** added alt-c to toggle between cwd/root dir ([6be7c4f](https://github.com/LazyVim/LazyVim/commit/6be7c4fee4fb755ff07f7bcc13eac96e1d8c279a))
|
||||||
|
* **snacks.picker:** flash.nvim integration ([5d24aa6](https://github.com/LazyVim/LazyVim/commit/5d24aa63111af68fbada8c97fedb75b07b8c3c92))
|
||||||
|
* **snacks.picker:** use snacks picker for notifications when enabled ([01a70cc](https://github.com/LazyVim/LazyVim/commit/01a70cc60ed2760afc819510177fb8d12a371b25))
|
||||||
|
* **snacks:** extra for snacks explorer (replacement for neo-tree) ([e20d9af](https://github.com/LazyVim/LazyVim/commit/e20d9afcbc980510093a3753a3991d8c934cbb75))
|
||||||
|
* **snippets:** an extra for mini.snippets ([#5274](https://github.com/LazyVim/LazyVim/issues/5274)) ([8b4e6ff](https://github.com/LazyVim/LazyVim/commit/8b4e6ff70d682cad3b1f4999623c3f0ac639fa82))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **keymaps:** remove unneeded and ambiguous `<leader>w` keymap ([#5459](https://github.com/LazyVim/LazyVim/issues/5459)) ([132986a](https://github.com/LazyVim/LazyVim/commit/132986a624b49bf740161d90ce94f16dd5ea5883))
|
||||||
|
* **luasnip:** schedule `jump` to be compatible with blink, nvim-cmp still works after change ([#5470](https://github.com/LazyVim/LazyVim/issues/5470)) ([0350934](https://github.com/LazyVim/LazyVim/commit/0350934d56579f3e6a9d40fa47313b2970d74772))
|
||||||
|
* **root:** pass args to root.get ([dc8512f](https://github.com/LazyVim/LazyVim/commit/dc8512fce1ec1cd4b0ca52d1077b2ed3894d51c8))
|
||||||
|
* **snacks.picker:** flash integration ([b5cd0d0](https://github.com/LazyVim/LazyVim/commit/b5cd0d0e27081be3ef1905475a0fe541b7661870))
|
||||||
|
* **snacks.picker:** snacks => flash ([3de7b24](https://github.com/LazyVim/LazyVim/commit/3de7b24cf6ed844772ea047476a400c56d5f4b42))
|
||||||
|
* **snacks:** use `Snacks.picker` for recent files ([#5485](https://github.com/LazyVim/LazyVim/issues/5485)) ([f0d2629](https://github.com/LazyVim/LazyVim/commit/f0d2629bd859eeac343999b0fe145f9beb227c4a))
|
||||||
|
* **sql:** better nvim-cmp check. Closes [#5188](https://github.com/LazyVim/LazyVim/issues/5188) ([1e83b4f](https://github.com/LazyVim/LazyVim/commit/1e83b4f843f88678189df81b1c88a400c53abdbc))
|
||||||
|
* **vscode:** diabled some snacks plugins. Fixes [#5364](https://github.com/LazyVim/LazyVim/issues/5364) ([c7a7ab5](https://github.com/LazyVim/LazyVim/commit/c7a7ab51129692927ae47f4e57ce22d10d48467e))
|
||||||
|
|
||||||
|
## [14.8.0](https://github.com/LazyVim/LazyVim/compare/v14.7.0...v14.8.0) (2025-01-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **chezmoi:** add snacks picker integration for chezmoi files ([#5429](https://github.com/LazyVim/LazyVim/issues/5429)) ([970d1a0](https://github.com/LazyVim/LazyVim/commit/970d1a05da37554aa17b671c869431a7b387d8be))
|
||||||
|
* **dial:** add checkbox augend for markdown ([#5411](https://github.com/LazyVim/LazyVim/issues/5411)) ([b19f207](https://github.com/LazyVim/LazyVim/commit/b19f2070b847a3067436f4d16a0cc5b84a9f9819))
|
||||||
|
* **snacks.picker:** added leader-sS to search lsp workspace symbols ([8787ec1](https://github.com/LazyVim/LazyVim/commit/8787ec1227e10123ad7291cf916020d9a8626525))
|
||||||
|
* **snacks:** added git diff keymap to pick hunks with leader-gd ([62cb4a4](https://github.com/LazyVim/LazyVim/commit/62cb4a465c490c7d41f7a3bf52fb0e222f2cf83b))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **markdown:** disable checkbox rendering since it's annoying to edit ([4f31bfa](https://github.com/LazyVim/LazyVim/commit/4f31bfab86402c819e5ea1e18b3c5d139628c864))
|
||||||
|
* **snacks.picker:** fix mapping for `Recent (cwd)` ([#5407](https://github.com/LazyVim/LazyVim/issues/5407)) ([8307b0f](https://github.com/LazyVim/LazyVim/commit/8307b0fe506a38417f3b7835e2c4b43d9a970946))
|
||||||
|
* **snacks.picker:** fix mapping for Projects for consistency ([#5433](https://github.com/LazyVim/LazyVim/issues/5433)) ([eb7b453](https://github.com/LazyVim/LazyVim/commit/eb7b453b48ab7e3008013e0edf2822f622111e97))
|
||||||
|
* **snacks.picker:** respect lazyvim.config.kind_filter ([#5415](https://github.com/LazyVim/LazyVim/issues/5415)) ([df7426e](https://github.com/LazyVim/LazyVim/commit/df7426eefa79d5dfa2fcbe2f381abfb2cca70bad))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* **java:** setting opts.dap_main to false to disable main class scan ([#5391](https://github.com/LazyVim/LazyVim/issues/5391)) ([66c3577](https://github.com/LazyVim/LazyVim/commit/66c3577bc779d31a7c2addd47de7cc6d215795ba))
|
||||||
|
|
||||||
|
## [14.7.0](https://github.com/LazyVim/LazyVim/compare/v14.6.1...v14.7.0) (2025-01-14)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **extras:** added extra for snacks picker ([#5368](https://github.com/LazyVim/LazyVim/issues/5368)) ([13044c2](https://github.com/LazyVim/LazyVim/commit/13044c298ed1837a2d938b64710528d359dc8407))
|
||||||
|
|
||||||
|
## [14.6.1](https://github.com/LazyVim/LazyVim/compare/v14.6.0...v14.6.1) (2025-01-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **blink:** added new luasnip preset ([8d2d9a9](https://github.com/LazyVim/LazyVim/commit/8d2d9a9bd965aab0a752f24ec327d2f391a8406b))
|
||||||
|
* **luasnip:** correctly remove duplicate snippets ([#5214](https://github.com/LazyVim/LazyVim/issues/5214)) ([05c3447](https://github.com/LazyVim/LazyVim/commit/05c3447558fa6eef7ae3c0d3e7ed1c281572274d))
|
||||||
|
* **nlua:** debugger not responding ([#5319](https://github.com/LazyVim/LazyVim/issues/5319)) ([4e746d0](https://github.com/LazyVim/LazyVim/commit/4e746d0e5625662e1f121b39f63836b653ed728b))
|
||||||
|
|
||||||
## [14.6.0](https://github.com/LazyVim/LazyVim/compare/v14.5.0...v14.6.0) (2024-12-20)
|
## [14.6.0](https://github.com/LazyVim/LazyVim/compare/v14.5.0...v14.6.0) (2024-12-20)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
*LazyVim.txt* For Neovim Last change: 2025 January 08
|
*LazyVim.txt* For Neovim Last change: 2025 February 11
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Table of Contents *LazyVim-table-of-contents*
|
Table of Contents *LazyVim-table-of-contents*
|
||||||
|
|
|
@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util")
|
||||||
---@class LazyVimConfig: LazyVimOptions
|
---@class LazyVimConfig: LazyVimOptions
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.version = "14.6.0" -- x-release-please-version
|
M.version = "14.12.0" -- x-release-please-version
|
||||||
LazyVim.config = M
|
LazyVim.config = M
|
||||||
|
|
||||||
---@class LazyVimOptions
|
---@class LazyVimOptions
|
||||||
|
@ -136,16 +136,19 @@ local defaults = {
|
||||||
}
|
}
|
||||||
|
|
||||||
M.json = {
|
M.json = {
|
||||||
version = 7,
|
version = 8,
|
||||||
|
loaded = false,
|
||||||
path = vim.g.lazyvim_json or vim.fn.stdpath("config") .. "/lazyvim.json",
|
path = vim.g.lazyvim_json or vim.fn.stdpath("config") .. "/lazyvim.json",
|
||||||
data = {
|
data = {
|
||||||
version = nil, ---@type string?
|
version = nil, ---@type number?
|
||||||
|
install_version = nil, ---@type number?
|
||||||
news = {}, ---@type table<string, string>
|
news = {}, ---@type table<string, string>
|
||||||
extras = {}, ---@type string[]
|
extras = {}, ---@type string[]
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.json.load()
|
function M.json.load()
|
||||||
|
M.json.loaded = true
|
||||||
local f = io.open(M.json.path, "r")
|
local f = io.open(M.json.path, "r")
|
||||||
if f then
|
if f then
|
||||||
local data = f:read("*a")
|
local data = f:read("*a")
|
||||||
|
@ -157,6 +160,8 @@ function M.json.load()
|
||||||
LazyVim.json.migrate()
|
LazyVim.json.migrate()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
M.json.data.install_version = M.json.version
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -206,6 +211,37 @@ function M.setup(opts)
|
||||||
"desc",
|
"desc",
|
||||||
"vscode",
|
"vscode",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if vim.g.lazyvim_check_order == false then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check lazy.nvim import order
|
||||||
|
local imports = require("lazy.core.config").spec.modules
|
||||||
|
local function find(pat, last)
|
||||||
|
for i = last and #imports or 1, last and 1 or #imports, last and -1 or 1 do
|
||||||
|
if imports[i]:find(pat) then
|
||||||
|
return i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local lazyvim_plugins = find("^lazyvim%.plugins$")
|
||||||
|
local extras = find("^lazyvim%.plugins%.extras%.", true) or lazyvim_plugins
|
||||||
|
local plugins = find("^plugins$") or math.huge
|
||||||
|
if lazyvim_plugins ~= 1 or extras > plugins then
|
||||||
|
local msg = {
|
||||||
|
"The order of your `lazy.nvim` imports is incorrect:",
|
||||||
|
"- `lazyvim.plugins` should be first",
|
||||||
|
"- followed by any `lazyvim.plugins.extras`",
|
||||||
|
"- and finally your own `plugins`",
|
||||||
|
"",
|
||||||
|
"If you think you know what you're doing, you can disable this check with:",
|
||||||
|
"```lua",
|
||||||
|
"vim.g.lazyvim_check_order = false",
|
||||||
|
"```",
|
||||||
|
}
|
||||||
|
vim.notify(table.concat(msg, "\n"), "warn", { title = "LazyVim" })
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -302,6 +338,69 @@ function M.init()
|
||||||
M.json.load()
|
M.json.load()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@alias LazyVimDefault {name: string, extra: string, enabled?: boolean, origin?: "global" | "default" | "extra" }
|
||||||
|
|
||||||
|
local default_extras ---@type table<string, LazyVimDefault>
|
||||||
|
function M.get_defaults()
|
||||||
|
if default_extras then
|
||||||
|
return default_extras
|
||||||
|
end
|
||||||
|
---@type table<string, LazyVimDefault[]>
|
||||||
|
local checks = {
|
||||||
|
picker = {
|
||||||
|
{ name = "snacks", extra = "editor.snacks_picker" },
|
||||||
|
{ name = "fzf", extra = "editor.fzf" },
|
||||||
|
{ name = "telescope", extra = "editor.telescope" },
|
||||||
|
},
|
||||||
|
cmp = {
|
||||||
|
{ name = "blink.cmp", extra = "coding.blink", enabled = vim.fn.has("nvim-0.10") == 1 },
|
||||||
|
{ name = "nvim-cmp", extra = "coding.nvim-cmp" },
|
||||||
|
},
|
||||||
|
explorer = {
|
||||||
|
{ name = "snacks", extra = "editor.snacks_explorer" },
|
||||||
|
{ name = "neo-tree", extra = "editor.neo-tree" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- existing installs keep their defaults
|
||||||
|
if (LazyVim.config.json.data.install_version or 7) < 8 then
|
||||||
|
table.insert(checks.picker, 1, table.remove(checks.picker, 2))
|
||||||
|
table.insert(checks.explorer, 1, table.remove(checks.explorer, 2))
|
||||||
|
end
|
||||||
|
|
||||||
|
default_extras = {}
|
||||||
|
for name, check in pairs(checks) do
|
||||||
|
local valid = {} ---@type string[]
|
||||||
|
for _, extra in ipairs(check) do
|
||||||
|
if extra.enabled ~= false then
|
||||||
|
valid[#valid + 1] = extra.name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local origin = "default"
|
||||||
|
local use = vim.g["lazyvim_" .. name]
|
||||||
|
use = vim.tbl_contains(valid, use or "auto") and use or nil
|
||||||
|
origin = use and "global" or origin
|
||||||
|
for _, extra in ipairs(use and {} or check) do
|
||||||
|
if extra.enabled ~= false and LazyVim.has_extra(extra.extra) then
|
||||||
|
use = extra.name
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
origin = use and "extra" or origin
|
||||||
|
use = use or valid[1]
|
||||||
|
for _, extra in ipairs(check) do
|
||||||
|
local import = "lazyvim.plugins.extras." .. extra.extra
|
||||||
|
extra = vim.deepcopy(extra)
|
||||||
|
extra.enabled = extra.name == use
|
||||||
|
if extra.enabled then
|
||||||
|
extra.origin = origin
|
||||||
|
end
|
||||||
|
default_extras[import] = extra
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return default_extras
|
||||||
|
end
|
||||||
|
|
||||||
setmetatable(M, {
|
setmetatable(M, {
|
||||||
__index = function(_, key)
|
__index = function(_, key)
|
||||||
if options == nil then
|
if options == nil then
|
||||||
|
|
|
@ -150,12 +150,12 @@ end
|
||||||
if vim.fn.executable("lazygit") == 1 then
|
if vim.fn.executable("lazygit") == 1 then
|
||||||
map("n", "<leader>gg", function() Snacks.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" })
|
map("n", "<leader>gg", function() Snacks.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" })
|
||||||
map("n", "<leader>gG", function() Snacks.lazygit() end, { desc = "Lazygit (cwd)" })
|
map("n", "<leader>gG", function() Snacks.lazygit() end, { desc = "Lazygit (cwd)" })
|
||||||
map("n", "<leader>gf", function() Snacks.lazygit.log_file() end, { desc = "Lazygit Current File History" })
|
map("n", "<leader>gf", function() Snacks.picker.git_log_file() end, { desc = "Git Current File History" })
|
||||||
map("n", "<leader>gl", function() Snacks.lazygit.log({ cwd = LazyVim.root.git() }) end, { desc = "Lazygit Log" })
|
map("n", "<leader>gl", function() Snacks.picker.git_log({ cwd = LazyVim.root.git() }) end, { desc = "Git Log" })
|
||||||
map("n", "<leader>gL", function() Snacks.lazygit.log() end, { desc = "Lazygit Log (cwd)" })
|
map("n", "<leader>gL", function() Snacks.picker.git_log() end, { desc = "Git Log (cwd)" })
|
||||||
end
|
end
|
||||||
|
|
||||||
map("n", "<leader>gb", function() Snacks.git.blame_line() end, { desc = "Git Blame Line" })
|
map("n", "<leader>gb", function() Snacks.picker.git_log_line() end, { desc = "Git Blame Line" })
|
||||||
map({ "n", "x" }, "<leader>gB", function() Snacks.gitbrowse() end, { desc = "Git Browse (open)" })
|
map({ "n", "x" }, "<leader>gB", function() Snacks.gitbrowse() end, { desc = "Git Browse (open)" })
|
||||||
map({"n", "x" }, "<leader>gY", function()
|
map({"n", "x" }, "<leader>gY", function()
|
||||||
Snacks.gitbrowse({ open = function(url) vim.fn.setreg("+", url) end, notify = false })
|
Snacks.gitbrowse({ open = function(url) vim.fn.setreg("+", url) end, notify = false })
|
||||||
|
@ -182,7 +182,6 @@ map("t", "<C-/>", "<cmd>close<cr>", { desc = "Hide Terminal" })
|
||||||
map("t", "<c-_>", "<cmd>close<cr>", { desc = "which_key_ignore" })
|
map("t", "<c-_>", "<cmd>close<cr>", { desc = "which_key_ignore" })
|
||||||
|
|
||||||
-- windows
|
-- windows
|
||||||
map("n", "<leader>w", "<c-w>", { desc = "Windows", remap = true })
|
|
||||||
map("n", "<leader>-", "<C-W>s", { desc = "Split Window Below", 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 })
|
map("n", "<leader>|", "<C-W>v", { desc = "Split Window Right", remap = true })
|
||||||
map("n", "<leader>wd", "<C-W>c", { desc = "Delete Window", remap = true })
|
map("n", "<leader>wd", "<C-W>c", { desc = "Delete Window", remap = true })
|
||||||
|
|
|
@ -1,17 +1,4 @@
|
||||||
return {
|
return {
|
||||||
{
|
|
||||||
import = "lazyvim.plugins.extras.coding.nvim-cmp",
|
|
||||||
enabled = function()
|
|
||||||
return LazyVim.cmp_engine() == "nvim-cmp"
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
import = "lazyvim.plugins.extras.coding.blink",
|
|
||||||
enabled = function()
|
|
||||||
return LazyVim.cmp_engine() == "blink.cmp"
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- auto pairs
|
-- auto pairs
|
||||||
{
|
{
|
||||||
"echasnovski/mini.pairs",
|
"echasnovski/mini.pairs",
|
||||||
|
|
|
@ -1,131 +1,5 @@
|
||||||
return {
|
return {
|
||||||
|
|
||||||
-- file explorer
|
|
||||||
{
|
|
||||||
"nvim-neo-tree/neo-tree.nvim",
|
|
||||||
cmd = "Neotree",
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
"<leader>fe",
|
|
||||||
function()
|
|
||||||
require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() })
|
|
||||||
end,
|
|
||||||
desc = "Explorer NeoTree (Root Dir)",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"<leader>fE",
|
|
||||||
function()
|
|
||||||
require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() })
|
|
||||||
end,
|
|
||||||
desc = "Explorer NeoTree (cwd)",
|
|
||||||
},
|
|
||||||
{ "<leader>e", "<leader>fe", desc = "Explorer NeoTree (Root Dir)", remap = true },
|
|
||||||
{ "<leader>E", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true },
|
|
||||||
{
|
|
||||||
"<leader>ge",
|
|
||||||
function()
|
|
||||||
require("neo-tree.command").execute({ source = "git_status", toggle = true })
|
|
||||||
end,
|
|
||||||
desc = "Git Explorer",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"<leader>be",
|
|
||||||
function()
|
|
||||||
require("neo-tree.command").execute({ source = "buffers", toggle = true })
|
|
||||||
end,
|
|
||||||
desc = "Buffer Explorer",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
deactivate = function()
|
|
||||||
vim.cmd([[Neotree close]])
|
|
||||||
end,
|
|
||||||
init = function()
|
|
||||||
-- FIX: use `autocmd` for lazy-loading neo-tree instead of directly requiring it,
|
|
||||||
-- because `cwd` is not set up properly.
|
|
||||||
vim.api.nvim_create_autocmd("BufEnter", {
|
|
||||||
group = vim.api.nvim_create_augroup("Neotree_start_directory", { clear = true }),
|
|
||||||
desc = "Start Neo-tree with directory",
|
|
||||||
once = true,
|
|
||||||
callback = function()
|
|
||||||
if package.loaded["neo-tree"] then
|
|
||||||
return
|
|
||||||
else
|
|
||||||
local stats = vim.uv.fs_stat(vim.fn.argv(0))
|
|
||||||
if stats and stats.type == "directory" then
|
|
||||||
require("neo-tree")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
opts = {
|
|
||||||
sources = { "filesystem", "buffers", "git_status" },
|
|
||||||
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
|
|
||||||
filesystem = {
|
|
||||||
bind_to_cwd = false,
|
|
||||||
follow_current_file = { enabled = true },
|
|
||||||
use_libuv_file_watcher = true,
|
|
||||||
},
|
|
||||||
window = {
|
|
||||||
mappings = {
|
|
||||||
["l"] = "open",
|
|
||||||
["h"] = "close_node",
|
|
||||||
["<space>"] = "none",
|
|
||||||
["Y"] = {
|
|
||||||
function(state)
|
|
||||||
local node = state.tree:get_node()
|
|
||||||
local path = node:get_id()
|
|
||||||
vim.fn.setreg("+", path, "c")
|
|
||||||
end,
|
|
||||||
desc = "Copy Path to Clipboard",
|
|
||||||
},
|
|
||||||
["O"] = {
|
|
||||||
function(state)
|
|
||||||
require("lazy.util").open(state.tree:get_node().path, { system = true })
|
|
||||||
end,
|
|
||||||
desc = "Open with System Application",
|
|
||||||
},
|
|
||||||
["P"] = { "toggle_preview", config = { use_float = false } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
default_component_configs = {
|
|
||||||
indent = {
|
|
||||||
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
|
|
||||||
expander_collapsed = "",
|
|
||||||
expander_expanded = "",
|
|
||||||
expander_highlight = "NeoTreeExpander",
|
|
||||||
},
|
|
||||||
git_status = {
|
|
||||||
symbols = {
|
|
||||||
unstaged = "",
|
|
||||||
staged = "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
local function on_move(data)
|
|
||||||
Snacks.rename.on_rename_file(data.source, data.destination)
|
|
||||||
end
|
|
||||||
|
|
||||||
local events = require("neo-tree.events")
|
|
||||||
opts.event_handlers = opts.event_handlers or {}
|
|
||||||
vim.list_extend(opts.event_handlers, {
|
|
||||||
{ event = events.FILE_MOVED, handler = on_move },
|
|
||||||
{ event = events.FILE_RENAMED, handler = on_move },
|
|
||||||
})
|
|
||||||
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
|
-- search/replace in multiple files
|
||||||
{
|
{
|
||||||
"MagicDuck/grug-far.nvim",
|
"MagicDuck/grug-far.nvim",
|
||||||
|
@ -384,17 +258,4 @@ return {
|
||||||
{ "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" },
|
{ "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
import = "lazyvim.plugins.extras.editor.fzf",
|
|
||||||
enabled = function()
|
|
||||||
return LazyVim.pick.want() == "fzf"
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
import = "lazyvim.plugins.extras.editor.telescope",
|
|
||||||
enabled = function()
|
|
||||||
return LazyVim.pick.want() == "telescope"
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,17 @@ function M.pick(kind)
|
||||||
LazyVim.warn("No " .. kind .. " found on the current line")
|
LazyVim.warn("No " .. kind .. " found on the current line")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local ok = pcall(require, "fzf-lua")
|
local map = {
|
||||||
require("CopilotChat.integrations." .. (ok and "fzflua" or "telescope")).pick(items)
|
telescope = "telescope",
|
||||||
|
fzf = "fzflua",
|
||||||
|
snacks = "snacks",
|
||||||
|
}
|
||||||
|
for _, def in pairs(LazyVim.config.get_defaults()) do
|
||||||
|
if def.enabled and map[def.name] then
|
||||||
|
return require("CopilotChat.integrations." .. map[def.name]).pick(items)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Snacks.notify.error("No picker found")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,12 @@ return {
|
||||||
"zbirenbaum/copilot.lua",
|
"zbirenbaum/copilot.lua",
|
||||||
cmd = "Copilot",
|
cmd = "Copilot",
|
||||||
build = ":Copilot auth",
|
build = ":Copilot auth",
|
||||||
event = "InsertEnter",
|
event = "BufReadPost",
|
||||||
opts = {
|
opts = {
|
||||||
suggestion = {
|
suggestion = {
|
||||||
enabled = not vim.g.ai_cmp,
|
enabled = not vim.g.ai_cmp,
|
||||||
auto_trigger = true,
|
auto_trigger = true,
|
||||||
|
hide_during_completion = vim.g.ai_cmp,
|
||||||
keymap = {
|
keymap = {
|
||||||
accept = false, -- handled by nvim-cmp / blink.cmp
|
accept = false, -- handled by nvim-cmp / blink.cmp
|
||||||
next = "<M-]>",
|
next = "<M-]>",
|
||||||
|
|
|
@ -158,9 +158,7 @@ return {
|
||||||
"saghen/blink.cmp",
|
"saghen/blink.cmp",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
opts.appearance = opts.appearance or {}
|
opts.appearance = opts.appearance or {}
|
||||||
opts.appearance.kind_icons = vim.tbl_extend("keep", {
|
opts.appearance.kind_icons = vim.tbl_extend("force", opts.appearance.kind_icons or {}, LazyVim.config.icons.kinds)
|
||||||
Color = "██", -- Use block instead of icon for color items to make swatches more usable
|
|
||||||
}, LazyVim.config.icons.kinds)
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,9 @@ return {
|
||||||
opts = function()
|
opts = function()
|
||||||
LazyVim.cmp.actions.snippet_forward = function()
|
LazyVim.cmp.actions.snippet_forward = function()
|
||||||
if require("luasnip").jumpable(1) then
|
if require("luasnip").jumpable(1) then
|
||||||
|
vim.schedule(function()
|
||||||
require("luasnip").jump(1)
|
require("luasnip").jump(1)
|
||||||
|
end)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
167
lua/lazyvim/plugins/extras/coding/mini-snippets.lua
Normal file
167
lua/lazyvim/plugins/extras/coding/mini-snippets.lua
Normal file
|
@ -0,0 +1,167 @@
|
||||||
|
if lazyvim_docs then
|
||||||
|
-- Set to `false` to prevent "non-lsp snippets"" from appearing inside completion windows
|
||||||
|
-- Motivation: Less clutter in completion windows and a more direct usage of snippits
|
||||||
|
vim.g.lazyvim_mini_snippets_in_completion = true
|
||||||
|
|
||||||
|
-- NOTE: Please also read:
|
||||||
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-snippets.md#expand
|
||||||
|
-- :h MiniSnippets-session
|
||||||
|
|
||||||
|
-- Example override for your own config:
|
||||||
|
--[[
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"echasnovski/mini.snippets",
|
||||||
|
opts = function(_, opts)
|
||||||
|
-- By default, for opts.snippets, the extra for mini.snippets only adds gen_loader.from_lang()
|
||||||
|
-- This provides a sensible quickstart, integrating with friendly-snippets
|
||||||
|
-- and your own language-specific snippets
|
||||||
|
--
|
||||||
|
-- In order to change opts.snippets, replace the entire table inside your own opts
|
||||||
|
|
||||||
|
local snippets, config_path = require("mini.snippets"), vim.fn.stdpath("config")
|
||||||
|
|
||||||
|
opts.snippets = { -- override opts.snippets provided by extra...
|
||||||
|
-- Load custom file with global snippets first (order matters)
|
||||||
|
snippets.gen_loader.from_file(config_path .. "/snippets/global.json"),
|
||||||
|
|
||||||
|
-- Load snippets based on current language by reading files from
|
||||||
|
-- "snippets/" subdirectories from 'runtimepath' directories.
|
||||||
|
snippets.gen_loader.from_lang(), -- this is the default in the extra...
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
--]]
|
||||||
|
end
|
||||||
|
|
||||||
|
local include_in_completion = vim.g.lazyvim_mini_snippets_in_completion == nil
|
||||||
|
or vim.g.lazyvim_mini_snippets_in_completion
|
||||||
|
|
||||||
|
local function expand_from_lsp(snippet)
|
||||||
|
local insert = MiniSnippets.config.expand.insert or MiniSnippets.default_insert
|
||||||
|
insert({ body = snippet })
|
||||||
|
end
|
||||||
|
|
||||||
|
local function jump(direction)
|
||||||
|
local is_active = MiniSnippets.session.get(false) ~= nil
|
||||||
|
if is_active then
|
||||||
|
MiniSnippets.session.jump(direction)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type fun(snippets, insert) | nil
|
||||||
|
local expand_select_override = nil
|
||||||
|
|
||||||
|
return {
|
||||||
|
-- disable builtin snippet support:
|
||||||
|
{ "garymjr/nvim-snippets", optional = true, enabled = false },
|
||||||
|
-- disable luasnip:
|
||||||
|
{ "L3MON4D3/LuaSnip", optional = true, enabled = false },
|
||||||
|
|
||||||
|
-- add mini.snippets
|
||||||
|
desc = "Manage and expand snippets (alternative to Luasnip)",
|
||||||
|
{
|
||||||
|
"echasnovski/mini.snippets",
|
||||||
|
event = "InsertEnter", -- don't depend on other plugins to load...
|
||||||
|
dependencies = "rafamadriz/friendly-snippets",
|
||||||
|
opts = function()
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
|
LazyVim.cmp.actions.snippet_stop = function() end -- by design, <esc> should not stop the session!
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
|
LazyVim.cmp.actions.snippet_forward = function()
|
||||||
|
return jump("next")
|
||||||
|
end
|
||||||
|
|
||||||
|
local mini_snippets = require("mini.snippets")
|
||||||
|
return {
|
||||||
|
snippets = { mini_snippets.gen_loader.from_lang() },
|
||||||
|
|
||||||
|
-- Following the behavior of vim.snippets,
|
||||||
|
-- the intended usage of <esc> is to be able to temporarily exit into normal mode for quick edits.
|
||||||
|
--
|
||||||
|
-- If you'd rather stop the snippet on <esc>, activate the line below in your own config:
|
||||||
|
-- mappings = { stop = "<esc>" }, -- <c-c> by default, see :h MiniSnippets-session
|
||||||
|
|
||||||
|
expand = {
|
||||||
|
select = function(snippets, insert)
|
||||||
|
-- Close completion window on snippet select - vim.ui.select
|
||||||
|
-- Needed to remove virtual text for fzf-lua and telescope, but not for mini.pick...
|
||||||
|
local select = expand_select_override or MiniSnippets.default_select
|
||||||
|
select(snippets, insert)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- nvim-cmp integration
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
optional = true,
|
||||||
|
dependencies = include_in_completion and { "abeldekat/cmp-mini-snippets" } or nil,
|
||||||
|
opts = function(_, opts)
|
||||||
|
local cmp = require("cmp")
|
||||||
|
local cmp_config = require("cmp.config")
|
||||||
|
|
||||||
|
opts.snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
expand_from_lsp(args.body)
|
||||||
|
cmp.resubscribe({ "TextChangedI", "TextChangedP" })
|
||||||
|
cmp_config.set_onetime({ sources = {} })
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
if include_in_completion then
|
||||||
|
table.insert(opts.sources, { name = "mini_snippets" })
|
||||||
|
else
|
||||||
|
expand_select_override = function(snippets, insert)
|
||||||
|
-- stylua: ignore
|
||||||
|
if cmp.visible() then cmp.close() end
|
||||||
|
MiniSnippets.default_select(snippets, insert)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
-- stylua: ignore
|
||||||
|
-- counterpart to <tab> defined in cmp.mappings
|
||||||
|
keys = include_in_completion and { { "<s-tab>", function() jump("prev") end, mode = "i" } } or nil,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- blink.cmp integration
|
||||||
|
{
|
||||||
|
"saghen/blink.cmp",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
-- Return early
|
||||||
|
if include_in_completion then
|
||||||
|
opts.snippets = { preset = "mini_snippets" }
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Standalone --
|
||||||
|
expand_select_override = function(snippets, insert)
|
||||||
|
-- Schedule, otherwise blink's virtual text is not removed on vim.ui.select
|
||||||
|
require("blink.cmp").cancel()
|
||||||
|
vim.schedule(function()
|
||||||
|
MiniSnippets.default_select(snippets, insert)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
--
|
||||||
|
-- Blink performs a require on blink.cmp.sources.snippets.default
|
||||||
|
-- By removing the source, the default engine will not be used
|
||||||
|
opts.sources.default = vim.tbl_filter(function(source)
|
||||||
|
return source ~= "snippets"
|
||||||
|
end, opts.sources.default)
|
||||||
|
opts.snippets = { -- need to repeat blink's preset here
|
||||||
|
expand = expand_from_lsp,
|
||||||
|
active = function()
|
||||||
|
return MiniSnippets.session.get(false) ~= nil
|
||||||
|
end,
|
||||||
|
jump = function(direction)
|
||||||
|
jump(direction == -1 and "prev" or "next")
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -4,7 +4,6 @@
|
||||||
-- and more.
|
-- and more.
|
||||||
return {
|
return {
|
||||||
"echasnovski/mini.surround",
|
"echasnovski/mini.surround",
|
||||||
recommended = true,
|
|
||||||
keys = function(_, keys)
|
keys = function(_, keys)
|
||||||
-- Populate the keys based on the user's options
|
-- Populate the keys based on the user's options
|
||||||
local opts = LazyVim.opts("mini.surround")
|
local opts = LazyVim.opts("mini.surround")
|
||||||
|
|
|
@ -140,6 +140,11 @@ return {
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
markdown = {
|
markdown = {
|
||||||
|
augend.constant.new({
|
||||||
|
elements = { "[ ]", "[x]" },
|
||||||
|
word = false,
|
||||||
|
cyclic = true,
|
||||||
|
}),
|
||||||
augend.misc.alias.markdown_header,
|
augend.misc.alias.markdown_header,
|
||||||
},
|
},
|
||||||
json = {
|
json = {
|
||||||
|
|
|
@ -40,7 +40,6 @@ end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
desc = "Awesome picker for FZF (alternative to Telescope)",
|
desc = "Awesome picker for FZF (alternative to Telescope)",
|
||||||
recommended = true,
|
|
||||||
{
|
{
|
||||||
"ibhagwan/fzf-lua",
|
"ibhagwan/fzf-lua",
|
||||||
cmd = "FzfLua",
|
cmd = "FzfLua",
|
||||||
|
|
128
lua/lazyvim/plugins/extras/editor/neo-tree.lua
Normal file
128
lua/lazyvim/plugins/extras/editor/neo-tree.lua
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- file explorer
|
||||||
|
{
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
cmd = "Neotree",
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>fe",
|
||||||
|
function()
|
||||||
|
require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() })
|
||||||
|
end,
|
||||||
|
desc = "Explorer NeoTree (Root Dir)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>fE",
|
||||||
|
function()
|
||||||
|
require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() })
|
||||||
|
end,
|
||||||
|
desc = "Explorer NeoTree (cwd)",
|
||||||
|
},
|
||||||
|
{ "<leader>e", "<leader>fe", desc = "Explorer NeoTree (Root Dir)", remap = true },
|
||||||
|
{ "<leader>E", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true },
|
||||||
|
{
|
||||||
|
"<leader>ge",
|
||||||
|
function()
|
||||||
|
require("neo-tree.command").execute({ source = "git_status", toggle = true })
|
||||||
|
end,
|
||||||
|
desc = "Git Explorer",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>be",
|
||||||
|
function()
|
||||||
|
require("neo-tree.command").execute({ source = "buffers", toggle = true })
|
||||||
|
end,
|
||||||
|
desc = "Buffer Explorer",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
deactivate = function()
|
||||||
|
vim.cmd([[Neotree close]])
|
||||||
|
end,
|
||||||
|
init = function()
|
||||||
|
-- FIX: use `autocmd` for lazy-loading neo-tree instead of directly requiring it,
|
||||||
|
-- because `cwd` is not set up properly.
|
||||||
|
vim.api.nvim_create_autocmd("BufEnter", {
|
||||||
|
group = vim.api.nvim_create_augroup("Neotree_start_directory", { clear = true }),
|
||||||
|
desc = "Start Neo-tree with directory",
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
if package.loaded["neo-tree"] then
|
||||||
|
return
|
||||||
|
else
|
||||||
|
local stats = vim.uv.fs_stat(vim.fn.argv(0))
|
||||||
|
if stats and stats.type == "directory" then
|
||||||
|
require("neo-tree")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
opts = {
|
||||||
|
sources = { "filesystem", "buffers", "git_status" },
|
||||||
|
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
|
||||||
|
filesystem = {
|
||||||
|
bind_to_cwd = false,
|
||||||
|
follow_current_file = { enabled = true },
|
||||||
|
use_libuv_file_watcher = true,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
mappings = {
|
||||||
|
["l"] = "open",
|
||||||
|
["h"] = "close_node",
|
||||||
|
["<space>"] = "none",
|
||||||
|
["Y"] = {
|
||||||
|
function(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
local path = node:get_id()
|
||||||
|
vim.fn.setreg("+", path, "c")
|
||||||
|
end,
|
||||||
|
desc = "Copy Path to Clipboard",
|
||||||
|
},
|
||||||
|
["O"] = {
|
||||||
|
function(state)
|
||||||
|
require("lazy.util").open(state.tree:get_node().path, { system = true })
|
||||||
|
end,
|
||||||
|
desc = "Open with System Application",
|
||||||
|
},
|
||||||
|
["P"] = { "toggle_preview", config = { use_float = false } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default_component_configs = {
|
||||||
|
indent = {
|
||||||
|
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
|
||||||
|
expander_collapsed = "",
|
||||||
|
expander_expanded = "",
|
||||||
|
expander_highlight = "NeoTreeExpander",
|
||||||
|
},
|
||||||
|
git_status = {
|
||||||
|
symbols = {
|
||||||
|
unstaged = "",
|
||||||
|
staged = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
local function on_move(data)
|
||||||
|
Snacks.rename.on_rename_file(data.source, data.destination)
|
||||||
|
end
|
||||||
|
|
||||||
|
local events = require("neo-tree.events")
|
||||||
|
opts.event_handlers = opts.event_handlers or {}
|
||||||
|
vim.list_extend(opts.event_handlers, {
|
||||||
|
{ event = events.FILE_MOVED, handler = on_move },
|
||||||
|
{ event = events.FILE_RENAMED, handler = on_move },
|
||||||
|
})
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
local pick = function()
|
local pick = function()
|
||||||
|
local refactoring = require("refactoring")
|
||||||
if LazyVim.pick.picker.name == "telescope" then
|
if LazyVim.pick.picker.name == "telescope" then
|
||||||
return require("telescope").extensions.refactoring.refactors()
|
return require("telescope").extensions.refactoring.refactors()
|
||||||
elseif LazyVim.pick.picker.name == "fzf" then
|
elseif LazyVim.pick.picker.name == "fzf" then
|
||||||
local fzf_lua = require("fzf-lua")
|
local fzf_lua = require("fzf-lua")
|
||||||
local results = require("refactoring").get_refactors()
|
local results = refactoring.get_refactors()
|
||||||
local refactoring = require("refactoring")
|
|
||||||
|
|
||||||
local opts = {
|
local opts = {
|
||||||
fzf_opts = {},
|
fzf_opts = {},
|
||||||
|
@ -16,6 +16,8 @@ local pick = function()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
fzf_lua.fzf_exec(results, opts)
|
fzf_lua.fzf_exec(results, opts)
|
||||||
|
else
|
||||||
|
refactoring.select_refactor()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
24
lua/lazyvim/plugins/extras/editor/snacks_explorer.lua
Normal file
24
lua/lazyvim/plugins/extras/editor/snacks_explorer.lua
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
return {
|
||||||
|
desc = "Snacks File Explorer",
|
||||||
|
recommended = true,
|
||||||
|
"folke/snacks.nvim",
|
||||||
|
opts = { explorer = {} },
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>fe",
|
||||||
|
function()
|
||||||
|
Snacks.explorer({ cwd = LazyVim.root() })
|
||||||
|
end,
|
||||||
|
desc = "Explorer Snacks (root dir)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>fE",
|
||||||
|
function()
|
||||||
|
Snacks.explorer()
|
||||||
|
end,
|
||||||
|
desc = "Explorer Snacks (cwd)",
|
||||||
|
},
|
||||||
|
{ "<leader>e", "<leader>fe", desc = "Explorer Snacks (root dir)", remap = true },
|
||||||
|
{ "<leader>E", "<leader>fE", desc = "Explorer Snacks (cwd)", remap = true },
|
||||||
|
},
|
||||||
|
}
|
212
lua/lazyvim/plugins/extras/editor/snacks_picker.lua
Normal file
212
lua/lazyvim/plugins/extras/editor/snacks_picker.lua
Normal file
|
@ -0,0 +1,212 @@
|
||||||
|
if lazyvim_docs then
|
||||||
|
-- In case you don't want to use `:LazyExtras`,
|
||||||
|
-- then you need to set the option below.
|
||||||
|
vim.g.lazyvim_picker = "snacks"
|
||||||
|
end
|
||||||
|
|
||||||
|
---@module 'snacks'
|
||||||
|
|
||||||
|
---@type LazyPicker
|
||||||
|
local picker = {
|
||||||
|
name = "snacks",
|
||||||
|
commands = {
|
||||||
|
files = "files",
|
||||||
|
live_grep = "grep",
|
||||||
|
oldfiles = "recent",
|
||||||
|
},
|
||||||
|
|
||||||
|
---@param source string
|
||||||
|
---@param opts? snacks.picker.Config
|
||||||
|
open = function(source, opts)
|
||||||
|
return Snacks.picker.pick(source, opts)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
if not LazyVim.pick.register(picker) then
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
desc = "Fast and modern file picker",
|
||||||
|
recommended = true,
|
||||||
|
{
|
||||||
|
"folke/snacks.nvim",
|
||||||
|
opts = {
|
||||||
|
picker = {
|
||||||
|
win = {
|
||||||
|
input = {
|
||||||
|
keys = {
|
||||||
|
["<a-c>"] = {
|
||||||
|
"toggle_cwd",
|
||||||
|
mode = { "n", "i" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
actions = {
|
||||||
|
---@param p snacks.Picker
|
||||||
|
toggle_cwd = function(p)
|
||||||
|
local root = LazyVim.root({ buf = p.input.filter.current_buf, normalize = true })
|
||||||
|
local cwd = vim.fs.normalize((vim.uv or vim.loop).cwd() or ".")
|
||||||
|
local current = p:cwd()
|
||||||
|
p:set_cwd(current == root and cwd or root)
|
||||||
|
p:find()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "<leader>,", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
||||||
|
{ "<leader>/", LazyVim.pick("grep"), desc = "Grep (Root Dir)" },
|
||||||
|
{ "<leader>:", function() Snacks.picker.command_history() end, desc = "Command History" },
|
||||||
|
{ "<leader><space>", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
|
||||||
|
{ "<leader>n", function() Snacks.picker.notifications() end, desc = "Notification History" },
|
||||||
|
-- find
|
||||||
|
{ "<leader>fb", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
||||||
|
{ "<leader>fB", function() Snacks.picker.buffers({ hidden = true, nofile = true }) end, desc = "Buffers (all)" },
|
||||||
|
{ "<leader>fc", LazyVim.pick.config_files(), desc = "Find Config File" },
|
||||||
|
{ "<leader>ff", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
|
||||||
|
{ "<leader>fF", LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" },
|
||||||
|
{ "<leader>fg", function() Snacks.picker.git_files() end, desc = "Find Files (git-files)" },
|
||||||
|
{ "<leader>fr", LazyVim.pick("oldfiles"), desc = "Recent" },
|
||||||
|
{ "<leader>fR", function() Snacks.picker.recent({ filter = { cwd = true }}) end, desc = "Recent (cwd)" },
|
||||||
|
{ "<leader>fp", function() Snacks.picker.projects() end, desc = "Projects" },
|
||||||
|
-- git
|
||||||
|
{ "<leader>gc", function() Snacks.picker.git_log() end, desc = "Git Log" },
|
||||||
|
{ "<leader>gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (hunks)" },
|
||||||
|
{ "<leader>gs", function() Snacks.picker.git_status() end, desc = "Git Status" },
|
||||||
|
{ "<leader>gS", function() Snacks.picker.git_stash() end, desc = "Git Stash" },
|
||||||
|
-- Grep
|
||||||
|
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
|
||||||
|
{ "<leader>sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" },
|
||||||
|
{ "<leader>sg", LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" },
|
||||||
|
{ "<leader>sG", LazyVim.pick("live_grep", { root = false }), desc = "Grep (cwd)" },
|
||||||
|
{ "<leader>sp", function() Snacks.picker.lazy() end, desc = "Search for Plugin Spec" },
|
||||||
|
{ "<leader>sw", LazyVim.pick("grep_word"), desc = "Visual selection or word (Root Dir)", mode = { "n", "x" } },
|
||||||
|
{ "<leader>sW", LazyVim.pick("grep_word", { root = false }), desc = "Visual selection or word (cwd)", mode = { "n", "x" } },
|
||||||
|
-- search
|
||||||
|
{ '<leader>s"', function() Snacks.picker.registers() end, desc = "Registers" },
|
||||||
|
{ '<leader>s/', function() Snacks.picker.search_history() end, desc = "Search History" },
|
||||||
|
{ "<leader>sa", function() Snacks.picker.autocmds() end, desc = "Autocmds" },
|
||||||
|
{ "<leader>sc", function() Snacks.picker.command_history() end, desc = "Command History" },
|
||||||
|
{ "<leader>sC", function() Snacks.picker.commands() end, desc = "Commands" },
|
||||||
|
{ "<leader>sd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" },
|
||||||
|
{ "<leader>sD", function() Snacks.picker.diagnostics_buffer() end, desc = "Buffer Diagnostics" },
|
||||||
|
{ "<leader>sh", function() Snacks.picker.help() end, desc = "Help Pages" },
|
||||||
|
{ "<leader>sH", function() Snacks.picker.highlights() end, desc = "Highlights" },
|
||||||
|
{ "<leader>si", function() Snacks.picker.icons() end, desc = "Icons" },
|
||||||
|
{ "<leader>sj", function() Snacks.picker.jumps() end, desc = "Jumps" },
|
||||||
|
{ "<leader>sk", function() Snacks.picker.keymaps() end, desc = "Keymaps" },
|
||||||
|
{ "<leader>sl", function() Snacks.picker.loclist() end, desc = "Location List" },
|
||||||
|
{ "<leader>sM", function() Snacks.picker.man() end, desc = "Man Pages" },
|
||||||
|
{ "<leader>sm", function() Snacks.picker.marks() end, desc = "Marks" },
|
||||||
|
{ "<leader>sR", function() Snacks.picker.resume() end, desc = "Resume" },
|
||||||
|
{ "<leader>sq", function() Snacks.picker.qflist() end, desc = "Quickfix List" },
|
||||||
|
{ "<leader>su", function() Snacks.picker.undo() end, desc = "Undotree" },
|
||||||
|
-- ui
|
||||||
|
{ "<leader>uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/snacks.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
if LazyVim.has("trouble.nvim") then
|
||||||
|
return vim.tbl_deep_extend("force", opts or {}, {
|
||||||
|
picker = {
|
||||||
|
actions = {
|
||||||
|
trouble_open = function(...)
|
||||||
|
return require("trouble.sources.snacks").actions.trouble_open.action(...)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
win = {
|
||||||
|
input = {
|
||||||
|
keys = {
|
||||||
|
["<c-t>"] = {
|
||||||
|
"trouble_open",
|
||||||
|
mode = { "n", "i" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = function()
|
||||||
|
local Keys = require("lazyvim.plugins.lsp.keymaps").get()
|
||||||
|
-- stylua: ignore
|
||||||
|
vim.list_extend(Keys, {
|
||||||
|
{ "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition", has = "definition" },
|
||||||
|
{ "gr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References" },
|
||||||
|
{ "gI", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" },
|
||||||
|
{ "gy", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition" },
|
||||||
|
{ "<leader>ss", function() Snacks.picker.lsp_symbols({ filter = LazyVim.config.kind_filter }) end, desc = "LSP Symbols", has = "documentSymbol" },
|
||||||
|
{ "<leader>sS", function() Snacks.picker.lsp_workspace_symbols({ filter = LazyVim.config.kind_filter }) end, desc = "LSP Workspace Symbols", has = "workspace/symbols" },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/todo-comments.nvim",
|
||||||
|
optional = true,
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "<leader>st", function() Snacks.picker.todo_comments() end, desc = "Todo" },
|
||||||
|
{ "<leader>sT", function () Snacks.picker.todo_comments({ keywords = { "TODO", "FIX", "FIXME" } }) end, desc = "Todo/Fix/Fixme" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/snacks.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(opts.dashboard.preset.keys, 3, {
|
||||||
|
icon = " ",
|
||||||
|
key = "p",
|
||||||
|
desc = "Projects",
|
||||||
|
action = ":lua Snacks.picker.projects()",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/flash.nvim",
|
||||||
|
optional = true,
|
||||||
|
specs = {
|
||||||
|
{
|
||||||
|
"folke/snacks.nvim",
|
||||||
|
opts = {
|
||||||
|
picker = {
|
||||||
|
win = {
|
||||||
|
input = {
|
||||||
|
keys = {
|
||||||
|
["<a-s>"] = { "flash", mode = { "n", "i" } },
|
||||||
|
["s"] = { "flash" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
actions = {
|
||||||
|
flash = function(picker)
|
||||||
|
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 ~= "snacks_picker_list"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
action = function(match)
|
||||||
|
local idx = picker.list:row2idx(match.pos[1])
|
||||||
|
picker.list:_move(idx, true, true)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -61,9 +61,6 @@ return {
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
cmd = "Telescope",
|
cmd = "Telescope",
|
||||||
enabled = function()
|
|
||||||
return LazyVim.pick.want() == "telescope"
|
|
||||||
end,
|
|
||||||
version = false, -- telescope did only one release, so use HEAD for now
|
version = false, -- telescope did only one release, so use HEAD for now
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{
|
{
|
||||||
|
@ -267,9 +264,6 @@ return {
|
||||||
{
|
{
|
||||||
"stevearc/dressing.nvim",
|
"stevearc/dressing.nvim",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
enabled = function()
|
|
||||||
return LazyVim.pick.want() == "telescope"
|
|
||||||
end,
|
|
||||||
init = function()
|
init = function()
|
||||||
---@diagnostic disable-next-line: duplicate-set-field
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
vim.ui.select = function(...)
|
vim.ui.select = function(...)
|
||||||
|
@ -287,9 +281,6 @@ return {
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
opts = function()
|
opts = function()
|
||||||
if LazyVim.pick.want() ~= "telescope" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local Keys = require("lazyvim.plugins.lsp.keymaps").get()
|
local Keys = require("lazyvim.plugins.lsp.keymaps").get()
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
vim.list_extend(Keys, {
|
vim.list_extend(Keys, {
|
||||||
|
|
|
@ -37,7 +37,6 @@ return {
|
||||||
rangeVariableTypes = true,
|
rangeVariableTypes = true,
|
||||||
},
|
},
|
||||||
analyses = {
|
analyses = {
|
||||||
fieldalignment = true,
|
|
||||||
nilness = true,
|
nilness = true,
|
||||||
unusedparams = true,
|
unusedparams = true,
|
||||||
unusedwrite = true,
|
unusedwrite = true,
|
||||||
|
|
|
@ -130,6 +130,7 @@ return {
|
||||||
|
|
||||||
-- These depend on nvim-dap, but can additionally be disabled by setting false here.
|
-- These depend on nvim-dap, but can additionally be disabled by setting false here.
|
||||||
dap = { hotcodereplace = "auto", config_overrides = {} },
|
dap = { hotcodereplace = "auto", config_overrides = {} },
|
||||||
|
-- Can set this to false to disable main class scan, which is a performance killer for large project
|
||||||
dap_main = {},
|
dap_main = {},
|
||||||
test = true,
|
test = true,
|
||||||
settings = {
|
settings = {
|
||||||
|
@ -246,7 +247,9 @@ return {
|
||||||
if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
|
if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
|
||||||
-- custom init for Java debugger
|
-- custom init for Java debugger
|
||||||
require("jdtls").setup_dap(opts.dap)
|
require("jdtls").setup_dap(opts.dap)
|
||||||
|
if opts.dap_main then
|
||||||
require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main)
|
require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main)
|
||||||
|
end
|
||||||
|
|
||||||
-- Java Test require Java debugger to work
|
-- Java Test require Java debugger to work
|
||||||
if opts.test and mason_registry.is_installed("java-test") then
|
if opts.test and mason_registry.is_installed("java-test") then
|
||||||
|
|
|
@ -104,8 +104,11 @@ return {
|
||||||
sign = false,
|
sign = false,
|
||||||
icons = {},
|
icons = {},
|
||||||
},
|
},
|
||||||
|
checkbox = {
|
||||||
|
enabled = false,
|
||||||
},
|
},
|
||||||
ft = { "markdown", "norg", "rmd", "org" },
|
},
|
||||||
|
ft = { "markdown", "norg", "rmd", "org", "codecompanion" },
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require("render-markdown").setup(opts)
|
require("render-markdown").setup(opts)
|
||||||
Snacks.toggle({
|
Snacks.toggle({
|
||||||
|
|
|
@ -48,7 +48,7 @@ return {
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = sql_ft,
|
pattern = sql_ft,
|
||||||
callback = function()
|
callback = function()
|
||||||
if LazyVim.has("nvim-cmp") then
|
if LazyVim.has_extra("coding.nvim-cmp") then
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
|
|
||||||
-- global sources
|
-- global sources
|
||||||
|
|
|
@ -19,6 +19,38 @@ local pick_chezmoi = function()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
fzf_lua.fzf_exec(results, opts)
|
fzf_lua.fzf_exec(results, opts)
|
||||||
|
elseif LazyVim.pick.picker.name == "snacks" then
|
||||||
|
local results = require("chezmoi.commands").list({
|
||||||
|
args = {
|
||||||
|
"--path-style",
|
||||||
|
"absolute",
|
||||||
|
"--include",
|
||||||
|
"files",
|
||||||
|
"--exclude",
|
||||||
|
"externals",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
local items = {}
|
||||||
|
|
||||||
|
for _, czFile in ipairs(results) do
|
||||||
|
table.insert(items, {
|
||||||
|
text = czFile,
|
||||||
|
file = czFile,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type snacks.picker.Config
|
||||||
|
local opts = {
|
||||||
|
items = items,
|
||||||
|
confirm = function(picker, item)
|
||||||
|
picker:close()
|
||||||
|
require("chezmoi.commands").edit({
|
||||||
|
targets = { item.text },
|
||||||
|
args = { "--watch" },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
Snacks.picker.pick(opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -57,9 +57,14 @@ return {
|
||||||
{
|
{
|
||||||
"snacks.nvim",
|
"snacks.nvim",
|
||||||
opts = {
|
opts = {
|
||||||
|
bigfile = { enabled = false },
|
||||||
|
dashboard = { enabled = false },
|
||||||
indent = { enabled = false },
|
indent = { enabled = false },
|
||||||
scroll = { enabled = false },
|
input = { enabled = false },
|
||||||
notifier = { enabled = false },
|
notifier = { enabled = false },
|
||||||
|
picker = { enabled = false },
|
||||||
|
quickfile = { enabled = false },
|
||||||
|
scroll = { enabled = false },
|
||||||
statuscolumn = { enabled = false },
|
statuscolumn = { enabled = false },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,7 +13,7 @@ function M.get()
|
||||||
end
|
end
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
M._keys = {
|
M._keys = {
|
||||||
{ "<leader>cl", "<cmd>LspInfo<cr>", desc = "Lsp Info" },
|
{ "<leader>cl", function() Snacks.picker.lsp_config() end, desc = "Lsp Info" },
|
||||||
{ "gd", vim.lsp.buf.definition, desc = "Goto Definition", has = "definition" },
|
{ "gd", vim.lsp.buf.definition, desc = "Goto Definition", has = "definition" },
|
||||||
{ "gr", vim.lsp.buf.references, desc = "References", nowait = true },
|
{ "gr", vim.lsp.buf.references, desc = "References", nowait = true },
|
||||||
{ "gI", vim.lsp.buf.implementation, desc = "Goto Implementation" },
|
{ "gI", vim.lsp.buf.implementation, desc = "Goto Implementation" },
|
||||||
|
|
|
@ -37,6 +37,9 @@ return {
|
||||||
highlight = "Directory",
|
highlight = "Directory",
|
||||||
text_align = "left",
|
text_align = "left",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
filetype = "snacks_layout_box",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
---@param opts bufferline.IconFetcherOpts
|
---@param opts bufferline.IconFetcherOpts
|
||||||
get_element_icon = function(opts)
|
get_element_icon = function(opts)
|
||||||
|
@ -278,7 +281,13 @@ return {
|
||||||
},
|
},
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>n", function() Snacks.notifier.show_history() end, desc = "Notification History" },
|
{ "<leader>n", function()
|
||||||
|
if Snacks.config.picker and Snacks.config.picker.enabled then
|
||||||
|
Snacks.picker.notifications()
|
||||||
|
else
|
||||||
|
Snacks.notifier.show_history()
|
||||||
|
end
|
||||||
|
end, desc = "Notification History" },
|
||||||
{ "<leader>un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" },
|
{ "<leader>un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -288,6 +297,9 @@ return {
|
||||||
opts = {
|
opts = {
|
||||||
dashboard = {
|
dashboard = {
|
||||||
preset = {
|
preset = {
|
||||||
|
pick = function(cmd, opts)
|
||||||
|
return LazyVim.pick(cmd, opts)()
|
||||||
|
end,
|
||||||
header = [[
|
header = [[
|
||||||
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
|
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
|
||||||
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
|
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
|
||||||
|
|
|
@ -7,6 +7,7 @@ local prios = {
|
||||||
["lazyvim.plugins.extras.lang.typescript"] = 5,
|
["lazyvim.plugins.extras.lang.typescript"] = 5,
|
||||||
["lazyvim.plugins.extras.coding.blink"] = 5,
|
["lazyvim.plugins.extras.coding.blink"] = 5,
|
||||||
["lazyvim.plugins.extras.formatting.prettier"] = 10,
|
["lazyvim.plugins.extras.formatting.prettier"] = 10,
|
||||||
|
-- default core extra priority is 20
|
||||||
-- default priority is 50
|
-- default priority is 50
|
||||||
["lazyvim.plugins.extras.editor.aerial"] = 100,
|
["lazyvim.plugins.extras.editor.aerial"] = 100,
|
||||||
["lazyvim.plugins.extras.editor.outline"] = 100,
|
["lazyvim.plugins.extras.editor.outline"] = 100,
|
||||||
|
@ -16,8 +17,27 @@ if vim.g.xtras_prios then
|
||||||
prios = vim.tbl_deep_extend("force", prios, vim.g.xtras_prios or {})
|
prios = vim.tbl_deep_extend("force", prios, vim.g.xtras_prios or {})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local extras = {} ---@type string[]
|
||||||
|
local defaults = LazyVim.config.get_defaults()
|
||||||
|
|
||||||
|
-- Add extras from LazyExtras that are not disabled
|
||||||
|
for _, extra in ipairs(LazyVim.config.json.data.extras) do
|
||||||
|
local def = defaults[extra]
|
||||||
|
if not (def and def.enabled == false) then
|
||||||
|
extras[#extras + 1] = extra
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add default extras
|
||||||
|
for name, extra in pairs(defaults) do
|
||||||
|
if extra.enabled then
|
||||||
|
prios[name] = prios[name] or 20
|
||||||
|
extras[#extras + 1] = name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
---@type string[]
|
---@type string[]
|
||||||
local extras = LazyVim.dedup(LazyVim.config.json.data.extras)
|
extras = LazyVim.dedup(extras)
|
||||||
|
|
||||||
local version = vim.version()
|
local version = vim.version()
|
||||||
local v = version.major .. "_" .. version.minor
|
local v = version.major .. "_" .. version.minor
|
||||||
|
|
|
@ -83,6 +83,7 @@ end
|
||||||
---@param modname string
|
---@param modname string
|
||||||
---@param source LazyExtraSource
|
---@param source LazyExtraSource
|
||||||
function M.get_extra(source, modname)
|
function M.get_extra(source, modname)
|
||||||
|
LazyVim.plugin.handle_defaults = false
|
||||||
local enabled = vim.tbl_contains(M.state, modname)
|
local enabled = vim.tbl_contains(M.state, modname)
|
||||||
local spec = Plugin.Spec.new(nil, { optional = true, pkg = false })
|
local spec = Plugin.Spec.new(nil, { optional = true, pkg = false })
|
||||||
spec:parse({ import = modname })
|
spec:parse({ import = modname })
|
||||||
|
@ -248,6 +249,9 @@ end
|
||||||
|
|
||||||
---@param extra LazyExtra
|
---@param extra LazyExtra
|
||||||
function X:extra(extra)
|
function X:extra(extra)
|
||||||
|
local defaults = LazyVim.config.get_defaults()
|
||||||
|
local def = defaults[extra.module]
|
||||||
|
local origin = def and (def.origin or "user") or nil
|
||||||
if not extra.managed then
|
if not extra.managed then
|
||||||
---@type LazyExtra[]
|
---@type LazyExtra[]
|
||||||
local parents = {}
|
local parents = {}
|
||||||
|
@ -263,7 +267,7 @@ function X:extra(extra)
|
||||||
self:diagnostic({
|
self:diagnostic({
|
||||||
message = "Required by " .. table.concat(pp, ", "),
|
message = "Required by " .. table.concat(pp, ", "),
|
||||||
})
|
})
|
||||||
elseif vim.tbl_contains(LazyVim.plugin.core_imports, extra.module) then
|
elseif vim.tbl_contains(LazyVim.plugin.core_imports, extra.module) or origin == "default" then
|
||||||
self:diagnostic({
|
self:diagnostic({
|
||||||
message = "This extra is included by default",
|
message = "This extra is included by default",
|
||||||
})
|
})
|
||||||
|
|
|
@ -55,12 +55,33 @@ function M.has(plugin)
|
||||||
return M.get_plugin(plugin) ~= nil
|
return M.get_plugin(plugin) ~= nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Checks if the extras is enabled:
|
||||||
|
--- * If the module was imported
|
||||||
|
--- * If the module was added by LazyExtras
|
||||||
|
--- * If the module is in the user's lazy imports
|
||||||
---@param extra string
|
---@param extra string
|
||||||
function M.has_extra(extra)
|
function M.has_extra(extra)
|
||||||
local Config = require("lazyvim.config")
|
local Config = require("lazyvim.config")
|
||||||
local modname = "lazyvim.plugins.extras." .. extra
|
local modname = "lazyvim.plugins.extras." .. extra
|
||||||
return vim.tbl_contains(require("lazy.core.config").spec.modules, modname)
|
local LazyConfig = require("lazy.core.config")
|
||||||
or vim.tbl_contains(Config.json.data.extras, modname)
|
-- check if it was imported already
|
||||||
|
if vim.tbl_contains(LazyConfig.spec.modules, modname) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
-- check if it was added by LazyExtras
|
||||||
|
if vim.tbl_contains(Config.json.data.extras, modname) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
-- check if it's in the imports
|
||||||
|
local spec = LazyConfig.options.spec
|
||||||
|
if type(spec) == "table" then
|
||||||
|
for _, s in ipairs(spec) do
|
||||||
|
if type(s) == "table" and s.import == modname then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param fn fun()
|
---@param fn fun()
|
||||||
|
@ -265,13 +286,4 @@ function M.memoize(fn)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@return "nvim-cmp" | "blink.cmp"
|
|
||||||
function M.cmp_engine()
|
|
||||||
vim.g.lazyvim_cmp = vim.g.lazyvim_cmp or "auto"
|
|
||||||
if vim.g.lazyvim_cmp == "auto" then
|
|
||||||
return LazyVim.has_extra("coding.nvim-cmp") and "nvim-cmp" or "blink.cmp"
|
|
||||||
end
|
|
||||||
return vim.g.lazyvim_cmp
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -97,6 +97,8 @@ function M.migrate()
|
||||||
return vim.tbl_contains(ai, name) and ("lazyvim.plugins.extras.ai." .. name) or extra
|
return vim.tbl_contains(ai, name) and ("lazyvim.plugins.extras.ai." .. name) or extra
|
||||||
end)
|
end)
|
||||||
end, json.data.extras or {})
|
end, json.data.extras or {})
|
||||||
|
elseif json.data.version == 7 then
|
||||||
|
json.data.install_version = 7
|
||||||
end
|
end
|
||||||
|
|
||||||
M.save()
|
M.save()
|
||||||
|
|
|
@ -28,10 +28,6 @@ function M.register(picker)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if M.picker and M.picker.name ~= M.want() then
|
|
||||||
M.picker = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
if M.picker and M.picker.name ~= picker.name then
|
if M.picker and M.picker.name ~= picker.name then
|
||||||
LazyVim.warn(
|
LazyVim.warn(
|
||||||
"`LazyVim.pick`: picker already set to `" .. M.picker.name .. "`,\nignoring new picker `" .. picker.name .. "`"
|
"`LazyVim.pick`: picker already set to `" .. M.picker.name .. "`,\nignoring new picker `" .. picker.name .. "`"
|
||||||
|
@ -42,15 +38,6 @@ function M.register(picker)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
---@return "telescope" | "fzf"
|
|
||||||
function M.want()
|
|
||||||
vim.g.lazyvim_picker = vim.g.lazyvim_picker or "auto"
|
|
||||||
if vim.g.lazyvim_picker == "auto" then
|
|
||||||
return LazyVim.has_extra("editor.telescope") and "telescope" or "fzf"
|
|
||||||
end
|
|
||||||
return vim.g.lazyvim_picker
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param command? string
|
---@param command? string
|
||||||
---@param opts? lazyvim.util.pick.Opts
|
---@param opts? lazyvim.util.pick.Opts
|
||||||
function M.open(command, opts)
|
function M.open(command, opts)
|
||||||
|
|
|
@ -5,6 +5,7 @@ local M = {}
|
||||||
|
|
||||||
---@type string[]
|
---@type string[]
|
||||||
M.core_imports = {}
|
M.core_imports = {}
|
||||||
|
M.handle_defaults = true
|
||||||
|
|
||||||
M.lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" }
|
M.lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" }
|
||||||
|
|
||||||
|
@ -79,7 +80,16 @@ function M.lazy_file()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.fix_imports()
|
function M.fix_imports()
|
||||||
|
local defaults ---@type table<string, LazyVimDefault>
|
||||||
Plugin.Spec.import = LazyVim.inject.args(Plugin.Spec.import, function(_, spec)
|
Plugin.Spec.import = LazyVim.inject.args(Plugin.Spec.import, function(_, spec)
|
||||||
|
if M.handle_defaults and LazyVim.config.json.loaded then
|
||||||
|
-- extra disabled by defaults?
|
||||||
|
defaults = defaults or LazyVim.config.get_defaults()
|
||||||
|
local def = defaults[spec.import]
|
||||||
|
if def and def.enabled == false then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
local dep = M.deprecated_extras[spec and spec.import]
|
local dep = M.deprecated_extras[spec and spec.import]
|
||||||
if dep then
|
if dep then
|
||||||
dep = dep .. "\n" .. "Please remove the extra from `lazyvim.json` to hide this warning."
|
dep = dep .. "\n" .. "Please remove the extra from `lazyvim.json` to hide this warning."
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
---@class lazyvim.util.root
|
---@class lazyvim.util.root
|
||||||
---@overload fun(): string
|
---@overload fun(): string
|
||||||
local M = setmetatable({}, {
|
local M = setmetatable({}, {
|
||||||
__call = function(m)
|
__call = function(m, ...)
|
||||||
return m.get()
|
return m.get(...)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue