mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +02:00
fix(refactoring): use pick
for both Telescope and fzf-lua (#3769)
## What is this PR for? Provide a `pick` function to `refactoring.nvim` similar to `project.nvim` <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> ## Does this PR fix an existing issue? Fixes #3762 <!-- If this PR fixes any issues, please link to the issue here. Fixes #<issue_number> --> ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
This commit is contained in:
parent
55464b77c6
commit
b45d4ed62c
1 changed files with 22 additions and 3 deletions
|
@ -1,3 +1,24 @@
|
||||||
|
local pick = function()
|
||||||
|
if LazyVim.pick.picker.name == "telescope" then
|
||||||
|
return require("telescope").extensions.refactoring.refactors()
|
||||||
|
elseif LazyVim.pick.picker.name == "fzf" then
|
||||||
|
local fzf_lua = require("fzf-lua")
|
||||||
|
local results = require("refactoring").get_refactors()
|
||||||
|
local refactoring = require("refactoring")
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
fzf_opts = {},
|
||||||
|
fzf_colors = true,
|
||||||
|
actions = {
|
||||||
|
["default"] = function(selected)
|
||||||
|
refactoring.refactor(selected[1])
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
fzf_lua.fzf_exec(results, opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"ThePrimeagen/refactoring.nvim",
|
"ThePrimeagen/refactoring.nvim",
|
||||||
|
@ -10,9 +31,7 @@ return {
|
||||||
{ "<leader>r", "", desc = "+refactor", mode = { "n", "v" } },
|
{ "<leader>r", "", desc = "+refactor", mode = { "n", "v" } },
|
||||||
{
|
{
|
||||||
"<leader>rs",
|
"<leader>rs",
|
||||||
function()
|
pick,
|
||||||
require("telescope").extensions.refactoring.refactors()
|
|
||||||
end,
|
|
||||||
mode = "v",
|
mode = "v",
|
||||||
desc = "Refactor",
|
desc = "Refactor",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue