feat: fennelize harpoon
This commit is contained in:
parent
bfc960ff3b
commit
b76c23ac41
2 changed files with 79 additions and 77 deletions
47
fnl/plugins/harpoon.fnl
Normal file
47
fnl/plugins/harpoon.fnl
Normal file
|
@ -0,0 +1,47 @@
|
|||
{1 :harpoon2
|
||||
:after (fn [] (: (require :harpoon) :setup))
|
||||
:keys [{1 :<leader>a
|
||||
2 (fn []
|
||||
(: (: (require :harpoon) :list) :add))
|
||||
:desc "Add to harpoon"
|
||||
:mode :n}
|
||||
{1 :<C-h><C-a>
|
||||
2 (fn []
|
||||
(: (: (require :harpoon) :list) :select 1))
|
||||
:desc "Select harpoon 1"
|
||||
:mode :n}
|
||||
{1 :<C-h><C-s>
|
||||
2 (fn []
|
||||
(: (: (require :harpoon) :list) :select 2))
|
||||
:desc "Select harpoon 2"
|
||||
:mode :n}
|
||||
{1 :<C-h><C-d>
|
||||
2 (fn []
|
||||
(: (: (require :harpoon) :list) :select 3))
|
||||
:desc "Select harpoon 3"
|
||||
:mode :n}
|
||||
{1 :<C-h><C-f>
|
||||
2 (fn []
|
||||
(: (: (require :harpoon) :list) :select 4))
|
||||
:desc "Select harpoon 4"
|
||||
:mode :n}
|
||||
{1 :<C-h><C-h>
|
||||
2 (fn []
|
||||
((. (require :lz.n) :trigger_load) :telescope.nvim)
|
||||
(local conf (. (require :telescope.config) :values))
|
||||
|
||||
(fn toggle-telescope [harpoon-files]
|
||||
(local file-paths {})
|
||||
(each [_ item (ipairs harpoon-files.items)]
|
||||
(table.insert file-paths item.value))
|
||||
(: ((. (require :telescope.pickers) :new) {}
|
||||
{:finder ((. (require :telescope.finders)
|
||||
:new_table) {:results file-paths})
|
||||
:previewer (conf.file_previewer {})
|
||||
:prompt_title :Harpoon
|
||||
:sorter (conf.generic_sorter {})})
|
||||
:find))
|
||||
|
||||
(toggle-telescope (: (require :harpoon) :list)))
|
||||
:desc "toggle harpoon menu"
|
||||
:mode :n}]}
|
93
lua/plugins/harpoon.lua
generated
93
lua/plugins/harpoon.lua
generated
|
@ -1,77 +1,32 @@
|
|||
return {
|
||||
"harpoon2",
|
||||
after = function()
|
||||
require("harpoon"):setup()
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>a",
|
||||
function()
|
||||
require("harpoon"):list():add()
|
||||
end,
|
||||
desc = "Add to harpoon",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<C-h><C-a>",
|
||||
function()
|
||||
require("harpoon"):list():select(1)
|
||||
end,
|
||||
desc = "Select harpoon 1",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<C-h><C-s>",
|
||||
function()
|
||||
require("harpoon"):list():select(2)
|
||||
end,
|
||||
desc = "Select harpoon 2",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<C-h><C-d>",
|
||||
function()
|
||||
require("harpoon"):list():select(3)
|
||||
end,
|
||||
desc = "Select harpoon 3",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<C-h><C-f>",
|
||||
function()
|
||||
require("harpoon"):list():select(4)
|
||||
end,
|
||||
desc = "Select harpoon 4",
|
||||
mode = "n",
|
||||
},
|
||||
{
|
||||
"<C-h><C-h>",
|
||||
function()
|
||||
-- [nfnl] Compiled from ./fnl/plugins/harpoon.fnl by https://github.com/Olical/nfnl, do not edit.
|
||||
local function _1_()
|
||||
return require("harpoon"):setup()
|
||||
end
|
||||
local function _2_()
|
||||
return require("harpoon"):list():add()
|
||||
end
|
||||
local function _3_()
|
||||
return require("harpoon"):list():select(1)
|
||||
end
|
||||
local function _4_()
|
||||
return require("harpoon"):list():select(2)
|
||||
end
|
||||
local function _5_()
|
||||
return require("harpoon"):list():select(3)
|
||||
end
|
||||
local function _6_()
|
||||
return require("harpoon"):list():select(4)
|
||||
end
|
||||
local function _7_()
|
||||
require("lz.n").trigger_load("telescope.nvim")
|
||||
|
||||
local conf = require("telescope.config").values
|
||||
local function toggle_telescope(harpoon_files)
|
||||
local file_paths = {}
|
||||
for _, item in ipairs(harpoon_files.items) do
|
||||
table.insert(file_paths, item.value)
|
||||
end
|
||||
|
||||
require("telescope.pickers")
|
||||
.new({}, {
|
||||
prompt_title = "Harpoon",
|
||||
finder = require("telescope.finders").new_table({
|
||||
results = file_paths,
|
||||
}),
|
||||
previewer = conf.file_previewer({}),
|
||||
sorter = conf.generic_sorter({}),
|
||||
})
|
||||
:find()
|
||||
return require("telescope.pickers").new({}, {finder = require("telescope.finders").new_table({results = file_paths}), previewer = conf.file_previewer({}), prompt_title = "Harpoon", sorter = conf.generic_sorter({})}):find()
|
||||
end
|
||||
|
||||
toggle_telescope(require("harpoon"):list())
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "toggle harpoon menu",
|
||||
},
|
||||
},
|
||||
}
|
||||
return toggle_telescope(require("harpoon"):list())
|
||||
end
|
||||
return {"harpoon2", after = _1_, keys = {{"<leader>a", _2_, desc = "Add to harpoon", mode = "n"}, {"<C-h><C-a>", _3_, desc = "Select harpoon 1", mode = "n"}, {"<C-h><C-s>", _4_, desc = "Select harpoon 2", mode = "n"}, {"<C-h><C-d>", _5_, desc = "Select harpoon 3", mode = "n"}, {"<C-h><C-f>", _6_, desc = "Select harpoon 4", mode = "n"}, {"<C-h><C-h>", _7_, desc = "toggle harpoon menu", mode = "n"}}}
|
||||
|
|
Loading…
Reference in a new issue