Compare commits

..

8 Commits

Author SHA1 Message Date
Folke Lemaitre 8c3f9fd497 fix(terraform): make telescope optional 2024-06-12 23:13:18 +02:00
Folke Lemaitre f608564517 refactor: check active picker 2024-06-12 23:10:16 +02:00
Folke Lemaitre 3b0810c003 fix(fzf): path.dirname_first 2024-06-12 20:54:56 +02:00
Folke Lemaitre ef0d55e651 refactor: new formatter is merged, so removde custom :) 2024-06-12 18:20:16 +02:00
Folke Lemaitre 1f97b9d120 fix(fzf): refactor 2024-06-12 18:20:16 +02:00
Folke Lemaitre db8e0f7d35 fix(telescope): flash integration 2024-06-12 18:20:16 +02:00
Folke Lemaitre ff223e7347 fix(fzf): use custom formatter for now, since filename_search messes with searching 2024-06-12 18:20:16 +02:00
Folke Lemaitre b2b6ff0738 feat(pick): move pickers to extras telescope & fzf-lua and include telescope by default 2024-06-12 18:20:16 +02:00
21 changed files with 62 additions and 209 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ body:
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
"folke/LazyVim",
-- add any other plugins here
}
require("lazy").setup(plugins, {
-39
View File
@@ -1,44 +1,5 @@
# Changelog
## [12.14.1](https://github.com/LazyVim/LazyVim/compare/v12.14.0...v12.14.1) (2024-06-14)
### Bug Fixes
* **edgy:** only track other neo-tree windows with a source ([6efbdab](https://github.com/LazyVim/LazyVim/commit/6efbdabd1b2272401566354686ce85e1372fe925))
* **extras:** better reasons as to why some extras are included in your config. ([eeccbbc](https://github.com/LazyVim/LazyVim/commit/eeccbbc40721bb825182251acf201750741c77b2))
* **fzf:** esc and c-j, c-k keymaps with nowait. update fzf-lua as well ([c9380a3](https://github.com/LazyVim/LazyVim/commit/c9380a309dbdc9fe45ec1bc9f8f27700540c2eea))
* **fzf:** esc and nowait ([7c7703d](https://github.com/LazyVim/LazyVim/commit/7c7703d79226cda99b1ec3d25fbfff54af04ba5b))
* **fzf:** floating previewer closed fail ([#3638](https://github.com/LazyVim/LazyVim/issues/3638)) ([427e57d](https://github.com/LazyVim/LazyVim/commit/427e57ddf7030f7081d858d923fb9337f94bf0a7))
* **issue template:** repro.lua didn't work ([#3628](https://github.com/LazyVim/LazyVim/issues/3628)) ([25cccb5](https://github.com/LazyVim/LazyVim/commit/25cccb5db858ad0640fd6a9eb5da4c5f465749d9))
* **pick:** allow configuring pickers without LazyExtras. Fixes [#3626](https://github.com/LazyVim/LazyVim/issues/3626) ([304e743](https://github.com/LazyVim/LazyVim/commit/304e7439aa8ae646adafb737b292707bf77a31d9))
## [12.14.0](https://github.com/LazyVim/LazyVim/compare/v12.13.0...v12.14.0) (2024-06-13)
### Features
* **fzf:** better default window size/position ([74cf6e4](https://github.com/LazyVim/LazyVim/commit/74cf6e446247661ccb074838f92537c96a378ff4))
* **fzf:** better layout for code actions ([e948435](https://github.com/LazyVim/LazyVim/commit/e948435f17afbbccfe1e7f2b355977efce9f1ff8))
* **fzf:** disable dressing in favor of noice (vim.ui.input) and fzf-lua (vim.ui.select) ([5c876b7](https://github.com/LazyVim/LazyVim/commit/5c876b754999eb5fe8b79c5b6f5249b5bbddb454))
* **fzf:** use vscode style path names formatter ([14d1ca9](https://github.com/LazyVim/LazyVim/commit/14d1ca93d0e927b60fdf43424158f2336437f3a6))
* **noice:** added support for fzf-lua. Closes [#3596](https://github.com/LazyVim/LazyVim/issues/3596) ([ec3dba2](https://github.com/LazyVim/LazyVim/commit/ec3dba20af86187a44c953eb326725f76559cc12))
* **pick:** move pickers to extras (telescope still the default) ([#3606](https://github.com/LazyVim/LazyVim/issues/3606)) ([39a908c](https://github.com/LazyVim/LazyVim/commit/39a908c9faca2387c5444de89191275b7bd02576))
* **yanky:** added fzf-lua support ([82f680e](https://github.com/LazyVim/LazyVim/commit/82f680ee6b681f9f39fbfb8431a4f362af134d1c))
### Bug Fixes
* **dashboard:** proper fix for dashboard's weird action loading ([1d50c75](https://github.com/LazyVim/LazyVim/commit/1d50c75a4b149f1cf00f4d4163f1469bc2fa77fc))
* **lsp:** add file completion to rename file ([52b5728](https://github.com/LazyVim/LazyVim/commit/52b572881b6fcbc805e5e584c4970c920d314f86))
* **pick:** ignore registering the same picker ([48a70aa](https://github.com/LazyVim/LazyVim/commit/48a70aa8f5e201dc6c0a4997f4084193dd9b29a5))
* **pick:** move some leftovers from `editor.lua` to `editor.telescope` ([#3620](https://github.com/LazyVim/LazyVim/issues/3620)) ([b9f7264](https://github.com/LazyVim/LazyVim/commit/b9f726404fce2f5db8bfec713ed3e053537586ad))
* **pick:** use LazyVim.pick instead of M since dashboard dumps/loadstrings functions. Why though... Fixes [#3617](https://github.com/LazyVim/LazyVim/issues/3617) ([425e6e0](https://github.com/LazyVim/LazyVim/commit/425e6e0ea3006c87645240d003a3b289cbfc446a))
* **project:** add fzf-lua integration. Fixes [#3609](https://github.com/LazyVim/LazyVim/issues/3609) ([4b9e4ed](https://github.com/LazyVim/LazyVim/commit/4b9e4edbb115f1f13906b2cdb68986e336b05729))
* **project:** telescope name ([d82c11f](https://github.com/LazyVim/LazyVim/commit/d82c11f889b03effa5248170ac1b4b4681391f08))
* **python:** only enable venv-selector when telescope is availble. See [#3612](https://github.com/LazyVim/LazyVim/issues/3612) ([74c1766](https://github.com/LazyVim/LazyVim/commit/74c1766479411357054819b5d8c8376ca12c2504))
* **ui:** use `LazyVim.pick` for alpha.nvim and mini.starter extras ([#3611](https://github.com/LazyVim/LazyVim/issues/3611)) ([339979d](https://github.com/LazyVim/LazyVim/commit/339979d3143d46a37c304d45a00c7a4f448e707d))
## [12.13.0](https://github.com/LazyVim/LazyVim/compare/v12.12.0...v12.13.0) (2024-06-11)
-4
View File
@@ -113,10 +113,6 @@ docker run -w /root -it --rm alpine:edge sh -uelic '
[![Watch the video](https://img.youtube.com/vi/N93cTbtLCIM/hqdefault.jpg)](https://www.youtube.com/watch?v=N93cTbtLCIM)
[@dusty-phillips](https://github.com/dusty-phillips) 正在编写一本名为
[LazyVim for Ambitious Developers](https://lazyvim-ambitious-devs.phillips.codes)
的书,该书可在线免费获得。
## 📂 文件结构
config 下的文件会在适当的时候自动加载,所以你不需要手动引入这些文件。
+1 -1
View File
@@ -1,4 +1,4 @@
*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 June 14
*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 June 12
==============================================================================
Table of Contents *LazyVim-table-of-contents*
-6
View File
@@ -5,12 +5,6 @@ vim.g.maplocalleader = "\\"
-- LazyVim auto format
vim.g.autoformat = true
-- LazyVim picker to use.
-- Can be one of: telescope, fzf
-- Leave it to "auto" to automatically use the picker
-- enabled with `:LazyExtras`
vim.g.lazyvim_picker = "auto"
-- LazyVim root dir detection
-- Each entry can be:
-- * the name of a detector function like `lsp` or `cwd`
-9
View File
@@ -26,13 +26,4 @@ return {
"neovim/nvim-lspconfig",
dependencies = {},
},
-- dummy import to save core imports
{
import = "foobar",
enabled = function()
LazyVim.plugin.save_core()
return false
end,
},
}
+7 -4
View File
@@ -1,3 +1,6 @@
local have_make = vim.fn.executable("make") == 1
local have_cmake = vim.fn.executable("cmake") == 1
return {
-- file explorer
@@ -236,8 +239,8 @@ return {
-- better diagnostics list and others
{
"folke/trouble.nvim",
cmd = { "Trouble" },
opts = {},
cmd = { "TroubleToggle", "Trouble" },
opts = { use_diagnostic_signs = true },
keys = {
{ "<leader>xx", "<cmd>Trouble diagnostics toggle<cr>", desc = "Diagnostics (Trouble)" },
{ "<leader>xX", "<cmd>Trouble diagnostics toggle filter.buf=0<cr>", desc = "Buffer Diagnostics (Trouble)" },
@@ -301,13 +304,13 @@ return {
{
import = "lazyvim.plugins.extras.editor.fzf",
enabled = function()
return LazyVim.pick.want() == "fzf"
return LazyVim.has_extra("editor.fzf")
end,
},
{
import = "lazyvim.plugins.extras.editor.telescope",
enabled = function()
return LazyVim.pick.want() == "telescope"
return not LazyVim.has_extra("editor.fzf")
end,
},
}
+12 -27
View File
@@ -1,9 +1,3 @@
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 = "fzf"
end
---@class FzfLuaOpts: lazyvim.util.pick.Opts
---@field cmd string?
@@ -82,7 +76,7 @@ return {
end
fix(defaults)
return vim.tbl_deep_extend("force", defaults, {
return vim.tbl_deep_extend("force", opts, defaults, {
fzf_colors = true,
fzf_opts = {
["--no-scrollbar"] = true,
@@ -93,28 +87,18 @@ return {
},
-- Custom LazyVim option to configure vim.ui.select
ui_select = function(fzf_opts, items)
local title = vim.trim((fzf_opts.prompt or "Select"):gsub("%s*:%s*$", ""))
local width, height ---@type number?, number?
if fzf_opts.kind ~= "codeaction" then
width, height = 0.5, math.floor(math.min(vim.o.lines * 0.8, #items + 2) + 0.5)
end
return vim.tbl_deep_extend("force", fzf_opts, {
prompt = "",
winopts = {
title = " " .. vim.trim((fzf_opts.prompt or "Select"):gsub("%s*:%s*$", "")) .. " ",
title = " " .. title .. " ",
title_pos = "center",
},
}, fzf_opts.kind == "codeaction" and {
winopts = {
layout = "vertical",
-- height is number of items minus 15 lines for the preview, with a max of 80% screen height
height = math.floor(math.min(vim.o.lines * 0.8 - 16, #items + 2) + 0.5) + 16,
width = 0.5,
preview = {
layout = "vertical",
vertical = "down:15,border-top",
},
},
} or {
winopts = {
width = 0.5,
-- height is number of items, with a max of 80% screen height
height = math.floor(math.min(vim.o.lines * 0.8, #items + 2) + 0.5),
width = width,
height = height,
},
})
end,
@@ -161,8 +145,9 @@ return {
require("fzf-lua").register_ui_select(opts.ui_select or nil)
end,
keys = {
{ "<c-j>", "<c-j>", ft = "fzf", mode = "t", nowait = true },
{ "<c-k>", "<c-k>", ft = "fzf", mode = "t", nowait = true },
{ "<esc>", "<cmd>close<cr>", ft = "fzf", mode = "t", nowait = true },
{ "<c-j>", "<Down>", ft = "fzf", mode = "t", nowait = true },
{ "<c-k>", "<Up>", ft = "fzf", mode = "t", nowait = true },
{
"<leader>,",
"<cmd>FzfLua buffers sort_mru=true sort_lastused=true<cr>",
@@ -1,11 +1,6 @@
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 = "telescope"
end
local have_make = vim.fn.executable("make") == 1
local have_cmake = vim.fn.executable("cmake") == 1
-- TODO:
-- - [ ] remove telescope util
-- - [ ] better lsp bindings
---@type LazyPicker
local picker = {
@@ -55,9 +50,6 @@ return {
{
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
enabled = function()
return LazyVim.pick.want() == "telescope"
end,
version = false, -- telescope did only one release, so use HEAD for now
dependencies = {
{
@@ -237,9 +229,6 @@ return {
{
"stevearc/dressing.nvim",
lazy = true,
enabled = function()
return LazyVim.pick.want() == "telescope"
end,
init = function()
---@diagnostic disable-next-line: duplicate-set-field
vim.ui.select = function(...)
@@ -253,21 +242,4 @@ return {
end
end,
},
{
"neovim/nvim-lspconfig",
opts = function()
if LazyVim.pick.want() ~= "telescope" then
return
end
local Keys = require("lazyvim.plugins.lsp.keymaps").get()
-- stylua: ignore
vim.list_extend(Keys, {
{ "gd", function() require("telescope.builtin").lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" },
{ "gr", "<cmd>Telescope lsp_references<cr>", desc = "References", nowait = true },
{ "gI", function() require("telescope.builtin").lsp_implementations({ reuse_win = true }) end, desc = "Goto Implementation" },
{ "gy", function() require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) end, desc = "Goto T[y]pe Definition" },
})
end,
},
}
@@ -96,14 +96,10 @@ return {
end,
},
},
{
"linux-cultist/venv-selector.nvim",
branch = "regexp", -- Use this branch for the new version
cmd = "VenvSelect",
enabled = function()
return LazyVim.has("telescope.nvim")
end,
opts = {
settings = {
options = {
@@ -115,7 +111,6 @@ return {
ft = "python",
keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv", ft = "python" } },
},
{
"hrsh7th/nvim-cmp",
opts = function(_, opts)
+5 -5
View File
@@ -23,11 +23,11 @@ return {
dashboard.section.header.val = vim.split(logo, "\n")
-- stylua: ignore
dashboard.section.buttons.val = {
dashboard.button("f", "" .. " Find file", LazyVim.pick()),
dashboard.button("n", "" .. " New file", [[<cmd> ene <BAR> startinsert <cr>]]),
dashboard.button("r", "" .. " Recent files", LazyVim.pick("oldfiles")),
dashboard.button("g", "" .. " Find text", LazyVim.pick("live_grep")),
dashboard.button("c", "" .. " Config", LazyVim.pick.config_files()),
dashboard.button("f", "" .. " Find file", "<cmd> Telescope find_files <cr>"),
dashboard.button("n", "" .. " New file", "<cmd> ene <BAR> startinsert <cr>"),
dashboard.button("r", "" .. " Recent files", "<cmd> Telescope oldfiles <cr>"),
dashboard.button("g", "" .. " Find text", "<cmd> Telescope live_grep <cr>"),
dashboard.button("c", "" .. " Config", "<cmd> lua require('lazyvim.util').telescope.config_files()() <cr>"),
dashboard.button("s", "" .. " Restore Session", [[<cmd> lua require("persistence").load() <cr>]]),
dashboard.button("x", "" .. " Lazy Extras", "<cmd> LazyExtras <cr>"),
dashboard.button("l", "󰒲 " .. " Lazy", "<cmd> Lazy <cr>"),
+1 -8
View File
@@ -84,14 +84,7 @@ return {
pinned = true,
open = "Neotree position=top buffers",
},
{
title = "Neo-Tree Other",
ft = "neo-tree",
filter = function(buf)
return vim.b[buf].neo_tree_source ~= nil
end,
},
-- "neo-tree",
"neo-tree",
},
keys = {
-- increase width
@@ -29,15 +29,15 @@ return {
evaluate_single = true,
header = logo,
items = {
new_section("Find file", LazyVim.pick(), "Telescope"),
new_section("New file", "ene | startinsert", "Built-in"),
new_section("Recent files", LazyVim.pick("oldfiles"), "Telescope"),
new_section("Find text", LazyVim.pick("live_grep"), "Telescope"),
new_section("Config", LazyVim.pick.config_files(), "Config"),
new_section("Restore session", [[lua require("persistence").load()]], "Session"),
new_section("Lazy Extras", "LazyExtras", "Config"),
new_section("Lazy", "Lazy", "Config"),
new_section("Quit", "qa", "Built-in"),
new_section("Find file", "Telescope find_files", "Telescope"),
new_section("Recent files", "Telescope oldfiles", "Telescope"),
new_section("Grep text", "Telescope live_grep", "Telescope"),
new_section("Config", "lua require('lazyvim.util').telescope.config_files()()", "Config"),
new_section("Extras", "LazyExtras", "Config"),
new_section("Lazy", "Lazy", "Config"),
new_section("New file", "ene | startinsert", "Built-in"),
new_section("Quit", "qa", "Built-in"),
new_section("Session restore", [[lua require("persistence").load()]], "Session"),
},
content_hooks = {
starter.gen_hook.adding_bullet(pad .. "", false),
+1 -1
View File
@@ -33,7 +33,7 @@ return {
},
{
"nvim-telescope/telescope.nvim",
"telescope.nvim",
optional = true,
keys = {
{ "<leader>fp", pick, desc = "Projects" },
+4 -4
View File
@@ -14,11 +14,11 @@ function M.get()
-- stylua: ignore
M._keys = {
{ "<leader>cl", "<cmd>LspInfo<cr>", desc = "Lsp Info" },
{ "gd", vim.lsp.buf.definition(), desc = "Goto Definition", has = "definition" },
{ "gr", vim.lsp.buf.references(), desc = "References", nowait = true },
{ "gI", vim.lsp.buf.implementation(), desc = "Goto Implementation" },
{ "gy", vim.lsp.buf.type_definition(), desc = "Goto T[y]pe Definition" },
{ "gd", function() require("telescope.builtin").lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" },
{ "gr", "<cmd>Telescope lsp_references<cr>", desc = "References", nowait = true },
{ "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" },
{ "gI", function() require("telescope.builtin").lsp_implementations({ reuse_win = true }) end, desc = "Goto Implementation" },
{ "gy", function() require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) end, desc = "Goto T[y]pe Definition" },
{ "K", vim.lsp.buf.hover, desc = "Hover" },
{ "gK", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" },
{ "<c-k>", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" },
+4 -4
View File
@@ -325,11 +325,11 @@ return {
header = vim.split(logo, "\n"),
-- stylua: ignore
center = {
{ action = 'lua LazyVim.pick()()', desc = " Find File", icon = "", key = "f" },
{ action = LazyVim.pick(), desc = " Find File", icon = "", key = "f" },
{ action = "ene | startinsert", desc = " New File", icon = "", key = "n" },
{ action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = "", key = "r" },
{ action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = "", key = "g" },
{ action = 'lua LazyVim.pick.config_files()()', desc = " Config", icon = "", key = "c" },
{ action = LazyVim.pick("oldfiles"), desc = " Recent Files", icon = "", key = "r" },
{ action = LazyVim.pick("live_grep"), desc = " Find Text", icon = "", key = "g" },
{ action = LazyVim.pick.config_files(), desc = " Config", icon = "", key = "c" },
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = "", key = "s" },
{ action = "LazyExtras", desc = " Lazy Extras", icon = "", key = "x" },
{ action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" },
+1 -2
View File
@@ -20,9 +20,8 @@ local v = version.major .. "_" .. version.minor
local compat = { "0_9" }
LazyVim.plugin.save_core()
if vim.tbl_contains(compat, v) then
table.insert(extras, 1, "lazyvim.plugins.compat.nvim-" .. v)
extras[#extras + 1] = "lazyvim.plugins.compat.nvim-" .. v
end
table.sort(extras, function(a, b)
+4 -24
View File
@@ -250,30 +250,10 @@ end
---@param extra LazyExtra
function X:extra(extra)
if not extra.managed then
---@type LazyExtra[]
local parents = {}
for _, x in ipairs(self.extras) do
if x.enabled and vim.tbl_contains(x.imports, extra.module) then
parents[#parents + 1] = x
end
end
if #parents > 0 then
local pp = vim.tbl_map(function(x)
return x.name
end, parents)
self:diagnostic({
message = "Required by " .. table.concat(pp, ", "),
})
elseif vim.tbl_contains(LazyVim.plugin.core_imports, extra.module) then
self:diagnostic({
message = "This extra is included by default",
})
else
self:diagnostic({
message = "Not managed by LazyExtras (config)",
severity = vim.diagnostic.severity.WARN,
})
end
self:diagnostic({
message = "Not managed by LazyExtras (config)",
severity = vim.diagnostic.severity.WARN,
})
end
extra.row = self.text:row()
local hl = extra.managed and "LazySpecial" or "LazyLocal"
+1
View File
@@ -5,6 +5,7 @@ local LazyUtil = require("lazy.core.util")
---@field ui lazyvim.util.ui
---@field lsp lazyvim.util.lsp
---@field root lazyvim.util.root
---@field telescope lazyvim.util.telescope
---@field terminal lazyvim.util.terminal
---@field lazygit lazyvim.util.lazygit
---@field toggle lazyvim.util.toggle
+8 -15
View File
@@ -32,12 +32,7 @@ function M.register(picker)
if vim.v.vim_did_enter == 1 then
return true
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 then
LazyVim.warn(
"`LazyVim.pick`: picker already set to `" .. M.picker.name .. "`,\nignoring new picker `" .. picker.name .. "`"
)
@@ -47,14 +42,6 @@ function M.register(picker)
return true
end
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.fzf") and "fzf" or "telescope"
end
return vim.g.lazyvim_picker
end
---@param command? string
---@param opts? lazyvim.util.pick.Opts
function M.open(command, opts)
@@ -97,10 +84,16 @@ end
function M.wrap(command, opts)
opts = opts or {}
return function()
LazyVim.pick.open(command, vim.deepcopy(opts))
M.open(command, vim.deepcopy(opts))
end
end
---@param command string
---@param opts? lazyvim.util.pick.Opts
function M._open(command, opts)
return LazyVim.telescope.open(command, opts)
end
function M.config_files()
return M.wrap("files", { cwd = vim.fn.stdpath("config") })
end
-10
View File
@@ -3,9 +3,6 @@ local Plugin = require("lazy.core.plugin")
---@class lazyvim.util.plugin
local M = {}
---@type string[]
M.core_imports = {}
M.lazy_file_events = { "BufReadPost", "BufNewFile", "BufWritePre" }
---@type table<string, string>
@@ -35,13 +32,6 @@ M.renames = {
["glepnir/dashboard-nvim"] = "nvimdev/dashboard-nvim",
}
function M.save_core()
if vim.v.vim_did_enter == 1 then
return
end
M.core_imports = vim.deepcopy(require("lazy.core.config").spec.modules)
end
function M.setup()
M.fix_imports()
M.fix_renames()