Merge pull request #46 from jesseleite/customize-menu-window-yayaya

Customizable menu window
This commit is contained in:
ThePrimeagen 2021-03-25 11:24:28 -06:00 committed by GitHub
commit abb717f174
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 12 deletions

View File

@ -149,6 +149,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))

View File

@ -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
local function create_window()
local win_info = float.percentage_range_window(
factorw,
factorh,
{
winblend = 0
})
function create_window()
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
local function get_menu_items()

View File

@ -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