Created
August 31, 2023 15:54
-
-
Save luckasRanarison/6013025d75be8a9ea5e16916e18564c0 to your computer and use it in GitHub Desktop.
nvim-help-float
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open_help_float = function() | |
local ui = vim.api.nvim_list_uis()[1] | |
local width = 80 | |
local height = 25 | |
local row = (ui.height - height) * 0.4 | |
local col = (ui.width - width) * 0.5 | |
local win = vim.api.nvim_get_current_win() | |
local buf = vim.api.nvim_win_get_buf(win) | |
vim.api.nvim_win_set_config(win, { | |
col = col, | |
row = row, | |
width = width, | |
height = height, | |
border = "rounded", | |
relative = "editor", | |
style = "minimal", | |
}) | |
vim.api.nvim_create_autocmd("WinClosed", { | |
pattern = tostring(win), | |
callback = function() vim.api.nvim_buf_delete(buf, {}) end, | |
}) | |
end | |
vim.api.nvim_create_autocmd("FileType", { | |
pattern = { "help" }, | |
callback = open_help_float, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment