mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 17:03:39 +02:00
feat(flash)!: Make flash.nvim the default jump plugin for LazyVim
Use the `editor.leap` extra if you rather want to use leap/flit
This commit is contained in:
parent
9387ab388e
commit
ae759b947b
4 changed files with 111 additions and 109 deletions
|
@ -213,34 +213,76 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- easily jump to any location and enhanced f/t motions for Leap
|
-- disable old installations of leap and flit. Optional so it doesn't appear under disabled plugins
|
||||||
{
|
|
||||||
"ggandor/flit.nvim",
|
|
||||||
keys = function()
|
|
||||||
---@type LazyKeys[]
|
|
||||||
local ret = {}
|
|
||||||
for _, key in ipairs({ "f", "F", "t", "T" }) do
|
|
||||||
ret[#ret + 1] = { key, mode = { "n", "x", "o" }, desc = key }
|
|
||||||
end
|
|
||||||
return ret
|
|
||||||
end,
|
|
||||||
opts = { labeled_modes = "nx" },
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"ggandor/leap.nvim",
|
"ggandor/leap.nvim",
|
||||||
keys = {
|
enabled = function()
|
||||||
{ "s", mode = { "n", "x", "o" }, desc = "Leap forward to" },
|
vim.schedule(function()
|
||||||
{ "S", mode = { "n", "x", "o" }, desc = "Leap backward to" },
|
local Config = require("lazy.core.config")
|
||||||
{ "gs", mode = { "n", "x", "o" }, desc = "Leap from windows" },
|
if Config.spec.disabled["leap.nvim"] or Config.spec.disabled["flit.nvim"] then
|
||||||
},
|
require("lazy.core.util").warn(
|
||||||
config = function(_, opts)
|
[[`flash.nvim` is now the default **LazyVim** jump plugin.
|
||||||
local leap = require("leap")
|
**leap.nvim** and **flit.nvim** have been disabled.
|
||||||
for k, v in pairs(opts) do
|
Please remove the plugins from your config.
|
||||||
leap.opts[k] = v
|
If you rather use leap/flit instead, you can add the leap extra:
|
||||||
|
`lazyvim.plugins.extras.editor.leap`
|
||||||
|
]],
|
||||||
|
{ title = "LazyVim" }
|
||||||
|
)
|
||||||
end
|
end
|
||||||
leap.add_default_mappings(true)
|
end)
|
||||||
vim.keymap.del({ "x", "o" }, "x")
|
return false
|
||||||
vim.keymap.del({ "x", "o" }, "X")
|
end,
|
||||||
|
optional = true,
|
||||||
|
},
|
||||||
|
{ "ggandor/flit.nvim", enabled = false, optional = true },
|
||||||
|
|
||||||
|
-- Add Flash
|
||||||
|
{
|
||||||
|
"folke/flash.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
vscode = true,
|
||||||
|
---@type Flash.Config
|
||||||
|
opts = {},
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
||||||
|
{ "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
|
||||||
|
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
|
||||||
|
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
|
||||||
|
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Flash Telescope config
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = function(_, opts)
|
||||||
|
if not require("lazyvim.util").has("flash.nvim") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local function flash(prompt_bufnr)
|
||||||
|
require("flash").jump({
|
||||||
|
pattern = "^",
|
||||||
|
label = { after = { 0, 0 } },
|
||||||
|
search = {
|
||||||
|
mode = "search",
|
||||||
|
exclude = {
|
||||||
|
function(win)
|
||||||
|
return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "TelescopeResults"
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
action = function(match)
|
||||||
|
local picker = require("telescope.actions.state").get_current_picker(prompt_bufnr)
|
||||||
|
picker:set_selection(match.pos[1] - 1)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
opts.defaults = vim.tbl_deep_extend("force", opts.defaults or {}, {
|
||||||
|
mappings = { n = { s = flash }, i = { ["<c-s>"] = flash } },
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,83 +1,6 @@
|
||||||
return {
|
require("lazy.core.util").warn(
|
||||||
{ "ggandor/leap.nvim", enabled = false },
|
"`flash.nvim` is now the default jump plugin for **LazyVim**.\nPlease remove the `lazyvim.plugins.extras.editor.flash` import from your **lazy** config.",
|
||||||
{ "ggandor/flit.nvim", enabled = false },
|
{ title = "LazyVim" }
|
||||||
{
|
)
|
||||||
"folke/flash.nvim",
|
|
||||||
event = "VeryLazy",
|
return {}
|
||||||
vscode = true,
|
|
||||||
---@type Flash.Config
|
|
||||||
opts = {},
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
"s",
|
|
||||||
mode = { "n", "x", "o" },
|
|
||||||
function()
|
|
||||||
require("flash").jump()
|
|
||||||
end,
|
|
||||||
desc = "Flash",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"S",
|
|
||||||
mode = { "n", "o", "x" },
|
|
||||||
function()
|
|
||||||
require("flash").treesitter()
|
|
||||||
end,
|
|
||||||
desc = "Flash Treesitter",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"r",
|
|
||||||
mode = "o",
|
|
||||||
function()
|
|
||||||
require("flash").remote()
|
|
||||||
end,
|
|
||||||
desc = "Remote Flash",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"R",
|
|
||||||
mode = { "o", "x" },
|
|
||||||
function()
|
|
||||||
require("flash").treesitter_search()
|
|
||||||
end,
|
|
||||||
desc = "Treesitter Search",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"<c-s>",
|
|
||||||
mode = { "c" },
|
|
||||||
function()
|
|
||||||
require("flash").toggle()
|
|
||||||
end,
|
|
||||||
desc = "Toggle Flash Search",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"nvim-telescope/telescope.nvim",
|
|
||||||
optional = true,
|
|
||||||
opts = function(_, opts)
|
|
||||||
local function flash(prompt_bufnr)
|
|
||||||
require("flash").jump({
|
|
||||||
pattern = "^",
|
|
||||||
label = { after = { 0, 0 } },
|
|
||||||
search = {
|
|
||||||
mode = "search",
|
|
||||||
exclude = {
|
|
||||||
function(win)
|
|
||||||
return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "TelescopeResults"
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
action = function(match)
|
|
||||||
local picker = require("telescope.actions.state").get_current_picker(prompt_bufnr)
|
|
||||||
picker:set_selection(match.pos[1] - 1)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
opts.defaults = vim.tbl_deep_extend("force", opts.defaults or {}, {
|
|
||||||
mappings = {
|
|
||||||
n = { s = flash },
|
|
||||||
i = { ["<c-s>"] = flash },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
40
lua/lazyvim/plugins/extras/editor/leap.lua
Normal file
40
lua/lazyvim/plugins/extras/editor/leap.lua
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
return {
|
||||||
|
-- disable flash
|
||||||
|
{ "folke/flash.nvim", enabled = false, optional = true },
|
||||||
|
|
||||||
|
-- easily jump to any location and enhanced f/t motions for Leap
|
||||||
|
{
|
||||||
|
"ggandor/flit.nvim",
|
||||||
|
enabled = true,
|
||||||
|
keys = function()
|
||||||
|
---@type LazyKeys[]
|
||||||
|
local ret = {}
|
||||||
|
for _, key in ipairs({ "f", "F", "t", "T" }) do
|
||||||
|
ret[#ret + 1] = { key, mode = { "n", "x", "o" }, desc = key }
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end,
|
||||||
|
opts = { labeled_modes = "nx" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ggandor/leap.nvim",
|
||||||
|
enabled = true,
|
||||||
|
keys = {
|
||||||
|
{ "s", mode = { "n", "x", "o" }, desc = "Leap forward to" },
|
||||||
|
{ "S", mode = { "n", "x", "o" }, desc = "Leap backward to" },
|
||||||
|
{ "gs", mode = { "n", "x", "o" }, desc = "Leap from windows" },
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
local leap = require("leap")
|
||||||
|
for k, v in pairs(opts) do
|
||||||
|
leap.opts[k] = v
|
||||||
|
end
|
||||||
|
leap.add_default_mappings(true)
|
||||||
|
vim.keymap.del({ "x", "o" }, "x")
|
||||||
|
vim.keymap.del({ "x", "o" }, "X")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- makes some plugins dot-repeatable like leap
|
||||||
|
{ "tpope/vim-repeat", event = "VeryLazy" },
|
||||||
|
}
|
|
@ -24,7 +24,4 @@ return {
|
||||||
|
|
||||||
-- library used by other plugins
|
-- library used by other plugins
|
||||||
{ "nvim-lua/plenary.nvim", lazy = true },
|
{ "nvim-lua/plenary.nvim", lazy = true },
|
||||||
|
|
||||||
-- makes some plugins dot-repeatable like leap
|
|
||||||
{ "tpope/vim-repeat", event = "VeryLazy" },
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue