arrow.nvim
arrow.nvim copied to clipboard
How do I call custom_actions entry?
How do I call my detour function via binding?
this is my config
function config.arrow()
local mappings = {
edit = "e",
delete_mode = "d",
clear_all_items = "C",
toggle = "a", -- used as save if separate_save_and_remove is true
open_vertical = "v",
open_horizontal = "-",
quit = "q",
remove = "x", -- only used if separate_save_and_remove is true
next_item = "]",
prev_item = "[",
}
local detour_file = function(target_file_name, current_file_name)
print("detour")
local ok = require('detour').Detour() -- open a detour popup
if not ok then
return
end
vim.api.nvim_command("e " .. target_file_name)
end
local opts = {
mappings = mappings,
show_icons = true,
separate_by_branch = false,
separate_save_and_remove = true,
leader_key = "J", -- Recommended to be a single key
buffer_leader_key = "mj", -- Recommended to be a single key
window = { -- controls the appearance and position of an arrow window (see nvim_open_win() for all options)
width = "auto",
height = "auto",
row = "auto",
col = "auto",
border = "double",
},
per_buffer_config = {
lines = 4, -- Number of lines showed on preview.
sort_automatically = true, -- Auto sort buffer marks.
treesitter_context = nil, -- it can be { line_shift_down = 2 }
},
save_key = "cwd", -- what will be used as root to save the bookmarks. Can be also `git_root`.
global_bookmarks = false, -- if true, arrow will save files globally (ignores separate_by_branch)
index_keys = "123456789zxcbnmZXVBNM,afghjklAFGHJKLwrtyuiopWRTYUIOP", -- keys mapped to bookmark index, i.e. 1st bookmark will be accessible by 1, and 12th - by c
full_path_list = { "init" }, -- filenames on this list will ALWAYS show the file path too.
custom_actions = {
detour = detour_file,
}
}
require("arrow").setup(opts)
end
I've tried adding mappings.detour but it doesnt do anything. I tried reading the code and the docs but I can't figure it out