mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +00:00
feat: #372 -- configurable fallback width and width ratio
This commit is contained in:
parent
e2e582e776
commit
23fe6410bc
@ -27,6 +27,8 @@ M.DEFAULT_LIST = DEFAULT_LIST
|
||||
---@class HarpoonSettings
|
||||
---@field border_chars string[] defaults to { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }
|
||||
---@field save_on_toggle boolean defaults to true
|
||||
---@field ui_fallback_width number defaults 69, nice
|
||||
---@field ui_width_ratio number defaults to 0.62569
|
||||
---@field key (fun(): string)
|
||||
|
||||
---@class HarpoonPartialSettings
|
||||
@ -55,6 +57,8 @@ function M.get_default_config()
|
||||
settings = {
|
||||
save_on_toggle = false,
|
||||
border_chars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||
ui_fallback_width = 69,
|
||||
ui_width_ratio = 0.62569,
|
||||
key = function()
|
||||
return vim.loop.cwd()
|
||||
end,
|
||||
|
@ -1,7 +1,6 @@
|
||||
local popup = require("plenary").popup
|
||||
local Buffer = require("harpoon.buffer")
|
||||
local Logger = require("harpoon.logger")
|
||||
local DEFAULT_WINDOW_WIDTH = 69 -- nice
|
||||
|
||||
---@class HarpoonUI
|
||||
---@field win_id number
|
||||
@ -69,11 +68,11 @@ end
|
||||
function HarpoonUI:_create_window()
|
||||
local win = vim.api.nvim_list_uis()
|
||||
|
||||
local width = DEFAULT_WINDOW_WIDTH
|
||||
local width = self.settings.ui_fallback_width
|
||||
if #win > 0 then
|
||||
-- no ackshual reason for 0.62569, just looks complicated, and i want
|
||||
-- to make my boss think i am smart
|
||||
width = math.floor(win[1].width * 0.62569)
|
||||
width = math.floor(win[1].width * self.settings.ui_width_ratio)
|
||||
end
|
||||
|
||||
local height = 8
|
||||
|
Loading…
x
Reference in New Issue
Block a user