Close active window with q
This commit is contained in:
parent
4303240b69
commit
52c81a89a4
|
@ -2,6 +2,10 @@ local M = {}
|
||||||
local api = vim.api
|
local api = vim.api
|
||||||
local buf, win
|
local buf, win
|
||||||
|
|
||||||
|
if vim == nil then
|
||||||
|
vim = {}
|
||||||
|
end
|
||||||
|
|
||||||
local function open_window()
|
local function open_window()
|
||||||
buf = api.nvim_create_buf(false, true)
|
buf = api.nvim_create_buf(false, true)
|
||||||
|
|
||||||
|
@ -31,6 +35,14 @@ local function open_window()
|
||||||
|
|
||||||
-- and finally create it with buffer attached
|
-- and finally create it with buffer attached
|
||||||
win = api.nvim_open_win(buf, true, opts)
|
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
|
end
|
||||||
|
|
||||||
local function httprequest(url)
|
local function httprequest(url)
|
||||||
|
|
Loading…
Reference in New Issue