Close active window with q

This commit is contained in:
Yannick Reiß 2024-09-17 10:51:53 +02:00
parent 4303240b69
commit 52c81a89a4
1 changed files with 12 additions and 0 deletions

View File

@ -2,6 +2,10 @@ local M = {}
local api = vim.api
local buf, win
if vim == nil then
vim = {}
end
local function open_window()
buf = api.nvim_create_buf(false, true)
@ -31,6 +35,14 @@ local function open_window()
-- and finally create it with buffer attached
win = api.nvim_open_win(buf, true, opts)
vim.cmd("nnoremap <buffer> q :call sourcer_close_window()<CR>")
end
-- @name sourcer_close_window
-- @param
-- @short close window
local function sourcer_close_window()
win.close()
end
local function httprequest(url)