Now have 3 separate terms, window, vert & hori, renamed some variables (#251)

This commit is contained in:
Galen Rowell 2021-08-14 23:58:24 +10:00 committed by GitHub
parent c80d79a7cc
commit e80a6935d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 9 deletions

View File

@ -101,8 +101,9 @@ local M = {
},
toggleterm = {
toggle_window = "<leader>w",
toggle_right = "<leader>v",
toggle_bot = "<leader>h"
toggle_vert = "<leader>v",
toggle_hori = "<leader>h",
hide_term = "JK"
},
insert_nav = {
forward = "<C-l>",

View File

@ -49,14 +49,14 @@ M.toggleterm = function()
local m = user_map.toggleterm
-- Open terminals
map("n", m.toggle_window, ":execute v:count . 'ToggleTerm direction=window' <CR>", opt)
map("n", m.toggle_right, ":execute v:count . 'ToggleTerm direction=vertical' <CR>", opt)
map("n", m.toggle_bot, ":execute v:count . 'ToggleTerm direction=horizontal' <CR>", opt)
map("n", m.toggle_window, ":lua termW:toggle() <CR>", opt)
map("n", m.toggle_vert, ":lua termV:toggle() <CR>", opt)
map("n", m.toggle_hori, ":lua termH:toggle() <CR>", opt)
-- 'Un' toggle a term from within terminal edit mode
map("t", m.toggle_window, "<C-\\><C-n> :ToggleTerm <CR>", opt)
map("t", m.toggle_right, "<C-\\><C-n> :ToggleTerm <CR>", opt)
map("t", m.toggle_bot, "<C-\\><C-n> :ToggleTerm <CR>", opt)
-- toggle(HIDE) a term from within terminal edit mode
map("t", m.hide_term, "<C-\\><C-n> :ToggleTerm <CR>", opt)
map("t", m.hide_term, "<C-\\><C-n> :ToggleTerm <CR>", opt)
map("t", m.hide_term, "<C-\\><C-n> :ToggleTerm <CR>", opt)
end
M.truezen = function()

View File

@ -31,3 +31,17 @@ toggleterm.setup {
}
}
}
local Terminal = require("toggleterm.terminal").Terminal
_G.termW = Terminal:new {
direction = "window",
}
_G.termV = Terminal:new {
direction = "vertical",
}
_G.termH = Terminal:new {
direction = "horizontal",
}