boolean?
(fun(context: { instance: NvimDrawerInstance, bufnr: integer, bufname: string }):boolean)?
(fun(context: { instance: NvimDrawerInstance, winid: integer, bufnr: integer, bufname: string }):boolean)?
boolean?
Deprecated, please use should_reuse_previous_bufnr = false
instead.
(fun(event: { instance: NvimDrawerInstance, winid: integer }):nil)?
Called after the drawer is closed. Only called if the drawer was actually open. Not called in the context of the drawer window.
(fun(event: { instance: NvimDrawerInstance, winid: integer, bufnr: integer }):nil)?
Called after a buffer is created. This is called very rarely. Called in the context of the drawer window.
(fun(event: { instance: NvimDrawerInstance, winid: integer, bufnr: integer }):nil)?
Called after .open() is done. Note this will be called even if the drawer is open. Called in the context of the drawer window.
(fun(event: { instance: NvimDrawerInstance, winid: integer, bufnr: integer }):nil)?
Called after a buffer is opened. Called in the context of the drawer window.
(fun(event: { instance: NvimDrawerInstance, winid: integer, bufnr: integer }):nil)?
Called after a window is created. Called in the context of the drawer window.
(fun(event: { instance: NvimDrawerInstance }):nil)?
Called when vim starts up. Helpful to have drawers appear in the order they were created in. Not called in the context of the drawer window.
(fun(event: { instance: NvimDrawerInstance }):nil)?
Called before the drawer is closed. Note this will is called even if the drawer is closed. Not called in the context of the drawer window.
(fun(event: { instance: NvimDrawerInstance }):nil)?
Called before a buffer is created. This is called very rarely. Not called in the context of the drawer window.
(fun(event: { instance: NvimDrawerInstance, bufnr: integer, winid: integer }):nil)?
Called before a buffer is opened. Not called in the context of the drawer window.
(fun(event: { instance: NvimDrawerInstance, bufnr: integer }):nil)?
Called before the window is created. Not called in the context of the drawer window.
'above'|'below'|'float'|'left'|'right'
Position of the drawer.
boolean?
boolean?
boolean?
Don't keep the same buffer across all tabs.
integer
Initial size of the drawer, in lines or columns.
NvimDrawerWindowConfig?
Configuration for the floating window.
function NvimDrawerInstance.build_win_config()
-> vim.api.keyset.win_config
Builds a win_config for the drawer to be used with nvim_win_set_config
.
function NvimDrawerInstance.claim(winid: integer)
function NvimDrawerInstance.close(opts?: NvimDrawerCloseOptions)
Close the drawer. By default, the size of the drawer is saved.
example_drawer.close()
--- Don't save the size of the drawer.
example_drawer.close({ save_size = false })
function NvimDrawerInstance.does_own_buffer(bufnr: integer)
-> boolean
Check if a buffer belongs to the drawer.
function NvimDrawerInstance.does_own_window(winid: integer)
-> boolean
Check if a window belongs to the drawer.
function NvimDrawerInstance.focus()
Focus the drawer.
function NvimDrawerInstance.focus_and_return(callback: fun())
Helper function to focus the drawer, run a callback, and return focus to the previous window.
function NvimDrawerInstance.focus_or_toggle()
Focus the drawer if it's open, otherwise toggle it, and give it focus when it is opened.
function NvimDrawerInstance.get_size()
-> integer
Get the size of the drawer in lines or columns.
function NvimDrawerInstance.get_winid()
-> integer
Get the window id of the drawer. Returns -1
if the drawer is not
open.
function NvimDrawerInstance.go(distance: integer)
Navigate to the next or previous buffer.
--- Go to the next buffer.
example_drawer.go(1)
--- Go to the previous buffer.
example_drawer.go(-1)
function NvimDrawerInstance.initialize_window(winid: integer)
function NvimDrawerInstance.is_focused()
-> boolean
Check if the drawer is focused.
function NvimDrawerInstance.open(opts?: NvimDrawerOpenOptions)
Open the drawer.
example_drawer.open()
--- Keep focus in the drawer.
example_drawer.open({ focus = true })
--- Open a new tab and focus it.
example_drawer.open({ mode = 'new', focus = true })
function NvimDrawerInstance.store_buffer_info(winid: integer)
Store the current window and buffer information.
function NvimDrawerInstance.toggle(opts?: NvimDrawerToggleOptions)
Toggle the drawer. Also lets you pass options to open the drawer.
example_drawer.toggle()
--- Focus the drawer when opening it.
example_drawer.toggle({ open = { focus = true } })
function NvimDrawerInstance.toggle_zoom()
Toggles the drawer between its normal size and a zoomed size.
function NvimDrawerModule.create_drawer(opts: NvimDrawerCreateOptions)
-> NvimDrawerInstance
Create a new drawer.
local example_drawer = drawer.create_drawer({
size = 15,
position = 'bottom',
on_did_create_buffer = function()
end,
})
function NvimDrawerModule.find_instance_for_winid(winid: integer)
-> NvimDrawerInstance|nil
function NvimDrawerModule.setup(options?: NvimDrawerSetupOptions)
boolean?
('new'|'previous_or_new')?
('creation'|('above'|'below'|'float'|'left'|'right')[])?
integer[]
The number of all buffers that have been created.
integer
The internal ID of the drawer.
boolean
Whether the drawer assumes it's open or not.
boolean
Whether the drawer is zoomed or not.
integer
The number of the previous buffer that was opened.
integer
The last known size of the drawer.
table<integer, integer>
The windows and buffers belonging to the drawer.
NvimDrawerOpenOptions?
('C'|'CC'|'CE'|'CW'|'E'...(+9))?
Anchor the window to a corner or center. Accepts variants for centering as well.
(string|number)?
Width of the window. Can be a number or a percentage.
number?
Keep the window this many rows / columns away from the screen edge.
(string|number)?
Width of the window. Can be a number or a percentage.