@@ -32,6 +32,7 @@ vim.g.symbols_outline = {
|
|||||||
show_guides = true,
|
show_guides = true,
|
||||||
auto_preview = true,
|
auto_preview = true,
|
||||||
position = 'right',
|
position = 'right',
|
||||||
|
relative_width = true,
|
||||||
width = 25,
|
width = 25,
|
||||||
show_numbers = false,
|
show_numbers = false,
|
||||||
show_relative_numbers = false,
|
show_relative_numbers = false,
|
||||||
|
|||||||
@@ -123,10 +123,21 @@ position
|
|||||||
|
|
||||||
Type: 'right' or 'left'
|
Type: 'right' or 'left'
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
relative_width
|
||||||
|
|
||||||
|
Whether the width of the window is relative to the current split or an
|
||||||
|
absolute width
|
||||||
|
|
||||||
|
Default: true ~
|
||||||
|
|
||||||
|
Type: boolean
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
width
|
width
|
||||||
|
|
||||||
How big the window is (relative to the current split)
|
Width of the window as a percentage of the current split
|
||||||
|
(`relative_width `= true) or as number of columns (`relative_width `= false)
|
||||||
|
|
||||||
Default: 25 ~
|
Default: 25 ~
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ M.defaults = {
|
|||||||
highlight_hovered_item = true,
|
highlight_hovered_item = true,
|
||||||
show_guides = true,
|
show_guides = true,
|
||||||
position = 'right',
|
position = 'right',
|
||||||
|
relative_width = true,
|
||||||
width = 25,
|
width = 25,
|
||||||
auto_preview = true,
|
auto_preview = true,
|
||||||
show_numbers = false,
|
show_numbers = false,
|
||||||
@@ -68,7 +69,15 @@ function M.get_position_navigation_direction()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get_width_percentage() return M.options.width / 100 end
|
function M.get_window_width()
|
||||||
|
if M.options.relative_width then
|
||||||
|
-- local current_win_width = vim.api.nvim_win_get_width(0)
|
||||||
|
return math.ceil(vim.api.nvim_win_get_width(0) * (M.options.width / 100))
|
||||||
|
else
|
||||||
|
return M.options.width
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function M.get_split_command()
|
function M.get_split_command()
|
||||||
if M.options.position == 'left' then
|
if M.options.position == 'left' then
|
||||||
|
|||||||
@@ -11,15 +11,10 @@ function M.setup_view()
|
|||||||
|
|
||||||
-- delete buffer when window is closed / buffer is hidden
|
-- delete buffer when window is closed / buffer is hidden
|
||||||
vim.api.nvim_buf_set_option(bufnr, "bufhidden", "delete")
|
vim.api.nvim_buf_set_option(bufnr, "bufhidden", "delete")
|
||||||
|
|
||||||
local current_win = vim.api.nvim_get_current_win()
|
|
||||||
local current_win_width = vim.api.nvim_win_get_width(current_win)
|
|
||||||
|
|
||||||
-- create a split
|
-- create a split
|
||||||
vim.cmd(config.get_split_command())
|
vim.cmd(config.get_split_command())
|
||||||
-- resize to a % of the current window size
|
-- resize to a % of the current window size
|
||||||
vim.cmd("vertical resize " ..
|
vim.cmd("vertical resize " .. config.get_window_width())
|
||||||
math.ceil(current_win_width * config.get_width_percentage()))
|
|
||||||
|
|
||||||
-- get current (outline) window and attach our buffer to it
|
-- get current (outline) window and attach our buffer to it
|
||||||
local winnr = vim.api.nvim_get_current_win()
|
local winnr = vim.api.nvim_get_current_win()
|
||||||
|
|||||||
Reference in New Issue
Block a user