mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
Add ability to customize menu window.
This commit is contained in:
parent
2d0cb2aabb
commit
c015ae5b5e
@ -139,6 +139,10 @@ M.get_mark_config = function()
|
||||
return HarpoonConfig.projects[cwd].mark
|
||||
end
|
||||
|
||||
M.get_menu_config = function()
|
||||
return HarpoonConfig.menu or {}
|
||||
end
|
||||
|
||||
-- should only be called for debug purposes
|
||||
M.print_config = function()
|
||||
print(vim.inspect(HarpoonConfig))
|
||||
|
@ -1,23 +1,35 @@
|
||||
local float = require('plenary.window.float')
|
||||
local harpoon = require('harpoon')
|
||||
local popup = require('popup')
|
||||
local Marked = require('harpoon.mark')
|
||||
|
||||
local factorw = 0.42069
|
||||
local factorh = 0.69420
|
||||
|
||||
local M = {}
|
||||
|
||||
win_id = nil
|
||||
bufh = nil
|
||||
|
||||
function create_window()
|
||||
local win_info = float.percentage_range_window(
|
||||
factorw,
|
||||
factorh,
|
||||
{
|
||||
winblend = 0
|
||||
})
|
||||
local config = harpoon.get_menu_config()
|
||||
local width = config.width or 60
|
||||
local height = config.height or 10
|
||||
local borderchars = config.borderchars or { '─', '│', '─', '│', '╭', '╮', '╯', '╰' }
|
||||
local bufnr = vim.api.nvim_create_buf(false, false)
|
||||
|
||||
return win_info
|
||||
local win_id, win = popup.create(bufnr, {
|
||||
title = 'Harpoon',
|
||||
highlight = 'HarpoonWindow',
|
||||
line = math.floor(((vim.o.lines - height) / 2) - 1),
|
||||
col = math.floor((vim.o.columns - width) / 2),
|
||||
minwidth = width,
|
||||
minheight = height,
|
||||
borderchars = borderchars,
|
||||
})
|
||||
|
||||
vim.api.nvim_win_set_option(win.border.win_id, 'winhl', 'Normal:HarpoonBorder')
|
||||
|
||||
return {
|
||||
bufnr = bufnr,
|
||||
win_id = win_id,
|
||||
}
|
||||
end
|
||||
|
||||
function get_menu_items()
|
||||
|
@ -68,3 +68,6 @@ fun! Harpoon_SendTerminalCommand(ctrlId, command)
|
||||
call term_sendkeys(l:bufh, a:command)
|
||||
endif
|
||||
endfun
|
||||
|
||||
highlight default HarpoonWindow ctermbg=none
|
||||
highlight default HarpoonBorder ctermbg=none ctermfg=white
|
||||
|
Loading…
x
Reference in New Issue
Block a user