diff options
author | Squibid <me@zacharyscheiman.com> | 2024-08-09 02:45:31 -0400 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2024-08-09 02:45:31 -0400 |
commit | c489d393695e90d424f9ae51e35c4d42358e6a71 (patch) | |
tree | 12ea97ec4684fd82cd6b73dd127d0137b115837b /lua/core/harpoon.lua | |
parent | ad76983d969c318e6e234bc82384b4b025d70447 (diff) | |
download | nvim-c489d393695e90d424f9ae51e35c4d42358e6a71.tar.gz nvim-c489d393695e90d424f9ae51e35c4d42358e6a71.tar.bz2 nvim-c489d393695e90d424f9ae51e35c4d42358e6a71.zip |
yes there's a bit of java in my nvim config why do you ask?
Diffstat (limited to 'lua/core/harpoon.lua')
-rw-r--r-- | lua/core/harpoon.lua | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/lua/core/harpoon.lua b/lua/core/harpoon.lua deleted file mode 100644 index ce68bdd..0000000 --- a/lua/core/harpoon.lua +++ /dev/null @@ -1,61 +0,0 @@ -local pickers = require("telescope.pickers") -local finders = require("telescope.finders") -local conf = require("telescope.config").values -local actions = require("telescope.actions") -local action_set = require("telescope.actions.set") -local action_state = require("telescope.actions.state") -local harpoon = require('harpoon') - -local M = {} - -function M.switcher() - local filepaths = {} - for _, item in ipairs(harpoon:list().items) do - table.insert(filepaths, item.value) - end - - pickers.new({ - prompt_title = "Harpoon", - finder = finders.new_table { results = filepaths }, - sorter = conf.generic_sorter(), - previewer = conf.file_previewer {}, - attach_mappings = function(prompt_bufnr, map) - actions.move_selection_previous:replace(function() - action_set.shift_selection(prompt_bufnr, -1) - end) - actions.move_selection_next:replace(function() - action_set.shift_selection(prompt_bufnr, 1) - end) - - -- remove harpoon item - vim.keymap.set("i", "<C-a>", function() - if action_state.get_selected_entry() then - for i, v in ipairs(filepaths) do - if v == action_state.get_selected_entry()[1] then - harpoon:list():removeAt(i) - actions.close(prompt_bufnr) - M.switcher() - end - end - end - end) - - -- select items, and open buffer - vim.keymap.set("i", "<C-s>", function() - if action_state.get_selected_entry() then - actions.close(prompt_bufnr) - vim.cmd("split "..action_state.get_selected_entry()[1]) - end - end, { buffer = true, remap = true }) - actions.select_default:replace(function() - if action_state.get_selected_entry() then - actions.close(prompt_bufnr) - vim.cmd("e "..action_state.get_selected_entry()[1]) - end - end) - return true - end - }):find() -end - -return M |