feat(plugins): add toggleterm
This commit is contained in:
parent
6045392e7d
commit
8aaa3b34b5
1 changed files with 77 additions and 0 deletions
77
plugins/toggleterm.nix
Normal file
77
plugins/toggleterm.nix
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
# homepage: https://github.com/akinsho/toggleterm.nvim
|
||||
# nixvim doc: https://nix-community.github.io/nixvim/plugins/toggleterm/index.html
|
||||
_:
|
||||
|
||||
{
|
||||
opts = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
direction = "float";
|
||||
float_opts.border = "rounded";
|
||||
shading_factor = 2;
|
||||
size = 10;
|
||||
|
||||
highlights = {
|
||||
Normal.link = "Normal";
|
||||
NormalNC.link = "NormalNC";
|
||||
NormalFloat.link = "NormalFloat";
|
||||
FloatBorder.link = "FloatBorder";
|
||||
StatusLine.link = "StatusLine";
|
||||
StatusLineNC.link = "StatusLineNC";
|
||||
WinBar.link = "WinBar";
|
||||
WinBarNC.link = "WinBarNC";
|
||||
};
|
||||
|
||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/toggleterm.lua#L66-L74
|
||||
on_create = ''
|
||||
function(t)
|
||||
vim.opt_local.foldcolumn = "0"
|
||||
vim.opt_local.signcolumn = "no"
|
||||
if t.hidden then
|
||||
vim.keymap.set({ "n", "t", "i" }, "<F7>", function() t:toggle() end, { desc = "Toggle terminal", buffer = t.bufnr })
|
||||
end
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
rootOpts.keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<Leader>tf";
|
||||
action = "<Cmd>ToggleTerm direction=float<CR>";
|
||||
options.desc = "Open floating terminal";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<Leader>th";
|
||||
action = "<Cmd>ToggleTerm size=10 direction=horizontal<CR>";
|
||||
options.desc = "Open terminal in horizontal split";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<Leader>tv";
|
||||
action = "<Cmd>ToggleTerm size=80 direction=vertical<CR>";
|
||||
options.desc = "Open terminal in vertical split";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<F7>";
|
||||
action = "<Cmd>execute v:count . 'ToggleTerm'<CR>";
|
||||
options.desc = "Toggle terminal";
|
||||
}
|
||||
{
|
||||
mode = "t";
|
||||
key = "<F7>";
|
||||
action = "<Cmd>ToggleTerm<CR>";
|
||||
options.desc = "Toggle terminal";
|
||||
}
|
||||
{
|
||||
mode = "i";
|
||||
key = "<F7>";
|
||||
action = "<Esc><Cmd>ToggleTerm<CR>";
|
||||
options.desc = "Toggle terminal";
|
||||
}
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue