blob: 7dcb0441b1fb3992462fb18ad1c1ddda8babbebb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
local spt = {}
function spt:create()
self = {
height = 80,
buf_nr = nil,
win_id = nil,
visible = false,
}
end
function spt:show()
vim.eval('botright new')
if self.buf_nr then
vim.eval('buffer ' .. self.buf_nr)
else
vim.termopen(self.exec, { detach=0 })
self.buf_nr = vim.bufnr('%')
end
end
function spt:open()
end
function spt:hide()
end
function spt:close()
local force = true
vim.api.nvim_win_close(self.win_id, force)
self.buf_nr = nil
self.win_id = nil
end
function spt_toggle()
if spt.win_id then
if spt.visible then
spt:hide()
else
spt:show()
end
else
spt:create()
spt:show()
end
end
|