refine key mapping
This commit is contained in:
@@ -12,14 +12,33 @@ return {
|
||||
{
|
||||
",tt",
|
||||
function()
|
||||
local size = vim.o.lines * 0.4
|
||||
require("toggleterm").toggle(nil, size)
|
||||
local term = require "toggleterm.terminal"
|
||||
local id = term.get_focused_id()
|
||||
local last = term.get_last_focused()
|
||||
if id then
|
||||
require("toggleterm").toggle(id)
|
||||
elseif last then
|
||||
require("toggleterm").toggle(last.id)
|
||||
else
|
||||
require("astrocore").notify("No terminal is opening", vim.log.levels.INFO, { title = "Toggle Term" })
|
||||
end
|
||||
end,
|
||||
mode = { "n", "t" },
|
||||
desc = "Toggle terminal horizontal",
|
||||
desc = "Toggle terminal",
|
||||
},
|
||||
{ ",tn", "<Cmd>ToggleTerm direction=tab<CR>", desc = "Toggle terminal in tab" },
|
||||
{ ",tN", "<Cmd>TermNew direction=tab<CR>", desc = "New terminal in tab" },
|
||||
-- select
|
||||
{ ",ts", "<Cmd>TermSelect<CR>", desc = "Select Terminal", mode = { "t", "n" } },
|
||||
|
||||
-- toggle
|
||||
{ ",tf", "<Cmd>ToggleTerm direction=float<CR>", desc = "Toggle terminal float", mode = { "t", "n" } },
|
||||
-- { ",tn", "<Cmd>ToggleTerm direction=tab<CR>", desc = "Toggle terminal in tab" },
|
||||
|
||||
-- new
|
||||
{ ",tn", desc = "New terminal" },
|
||||
{ ",tnt", "<Cmd>TermNew name=tab direction=tab<CR>", desc = "New terminal in tab" },
|
||||
{ ",tnh", "<Cmd>TermNew name=horiz direction=horizontal<CR>", desc = "New horizontal terminal" },
|
||||
{ ",tnv", "<Cmd>TermNew name=verti direction=vertical<CR>", desc = "New vertical terminal" },
|
||||
{ ",tnf", "<Cmd>TermNew name=float direction=float<CR>", desc = "New float terminal" },
|
||||
|
||||
{ "<C-Up>", "<Cmd>resize +2<CR>", desc = "Resize terminal up", mode = "t" },
|
||||
{ "<C-Down>", "<Cmd>resize -2<CR>", desc = "Resize terminal down", mode = "t" },
|
||||
|
Reference in New Issue
Block a user