add mapping for toggle term
This commit is contained in:
@@ -56,7 +56,26 @@ return {
|
||||
|
||||
-- setting a mapping to false will disable it
|
||||
-- ["<C-S>"] = false,
|
||||
["<M-h>"] = { "<Cmd>ToggleTerm size=20<CR>", desc = "Toggle terminal" },
|
||||
[",tt"] = {
|
||||
function()
|
||||
local size = vim.o.lines * 0.4
|
||||
require("toggleterm").toggle(nil, size)
|
||||
end,
|
||||
desc = "Toggle terminal",
|
||||
},
|
||||
[",tn"] = { "<Cmd>ToggleTerm direction=tab<CR>", desc = "Toggle terminal" },
|
||||
},
|
||||
t = {
|
||||
["<M-h>"] = { "<Cmd>ToggleTerm<CR>", desc = "Toggle terminal" },
|
||||
[",tt"] = { "<Cmd>ToggleTerm<CR>", desc = "Toggle terminal" },
|
||||
|
||||
["<C-Up>"] = { "<Cmd>resize +2<CR>", desc = "Resize terminal up" },
|
||||
["<C-Down>"] = { "<Cmd>resize -2<CR>", desc = "Resize terminal down" },
|
||||
|
||||
-- Navigate tabs
|
||||
["]t"] = { function() vim.cmd.tabnext() end, desc = "Next tab" },
|
||||
["[t"] = { function() vim.cmd.tabprevious() end, desc = "Previous tab" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
18
lua/plugins/term.lua
Normal file
18
lua/plugins/term.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
if true then return {} end
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
"akinsho/toggleterm.nvim",
|
||||
config = function(plugin, opts)
|
||||
require("toggleterm").setup {
|
||||
-- size can be a number or function which is passed the current terminal
|
||||
size = function(term)
|
||||
if term.direction == "horizontal" then
|
||||
return vim.o.lines * 0.4
|
||||
elseif term.direction == "vertical" then
|
||||
return vim.o.columns * 0.4
|
||||
end
|
||||
end,
|
||||
} --[[@type ToggleTermConfig]]
|
||||
end,
|
||||
}
|
Reference in New Issue
Block a user