mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +00:00
Merge pull request #46 from jesseleite/customize-menu-window-yayaya
Customizable menu window
This commit is contained in:
commit
abb717f174
@ -149,6 +149,10 @@ M.get_mark_config = function()
|
|||||||
return HarpoonConfig.projects[cwd].mark
|
return HarpoonConfig.projects[cwd].mark
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.get_menu_config = function()
|
||||||
|
return HarpoonConfig.menu or {}
|
||||||
|
end
|
||||||
|
|
||||||
-- should only be called for debug purposes
|
-- should only be called for debug purposes
|
||||||
M.print_config = function()
|
M.print_config = function()
|
||||||
print(vim.inspect(HarpoonConfig))
|
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 Marked = require('harpoon.mark')
|
||||||
|
|
||||||
local factorw = 0.42069
|
|
||||||
local factorh = 0.69420
|
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
win_id = nil
|
win_id = nil
|
||||||
bufh = nil
|
bufh = nil
|
||||||
|
|
||||||
local function create_window()
|
function create_window()
|
||||||
local win_info = float.percentage_range_window(
|
local config = harpoon.get_menu_config()
|
||||||
factorw,
|
local width = config.width or 60
|
||||||
factorh,
|
local height = config.height or 10
|
||||||
{
|
local borderchars = config.borderchars or { '─', '│', '─', '│', '╭', '╮', '╯', '╰' }
|
||||||
winblend = 0
|
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
|
end
|
||||||
|
|
||||||
local function get_menu_items()
|
local function get_menu_items()
|
||||||
|
@ -68,3 +68,6 @@ fun! Harpoon_SendTerminalCommand(ctrlId, command)
|
|||||||
call term_sendkeys(l:bufh, a:command)
|
call term_sendkeys(l:bufh, a:command)
|
||||||
endif
|
endif
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
|
highlight default HarpoonWindow ctermbg=none
|
||||||
|
highlight default HarpoonBorder ctermbg=none ctermfg=white
|
||||||
|
Loading…
x
Reference in New Issue
Block a user