mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 23:16:46 +00:00
use separate dag for toggleterm
This commit is contained in:
parent
24b631f343
commit
f8ff3cd9fa
1 changed files with 45 additions and 38 deletions
|
@ -8,12 +8,13 @@ with builtins; let
|
||||||
cfg = config.vim.terminal.toggleterm;
|
cfg = config.vim.terminal.toggleterm;
|
||||||
toggleKey = "<c-t>";
|
toggleKey = "<c-t>";
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkMerge [
|
||||||
|
(mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim.startPlugins = [
|
||||||
"toggleterm-nvim"
|
"toggleterm-nvim"
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere (''
|
vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere ''
|
||||||
require("toggleterm").setup({
|
require("toggleterm").setup({
|
||||||
open_mapping = [[${toggleKey}]],
|
open_mapping = [[${toggleKey}]],
|
||||||
direction = '${toString cfg.direction}',
|
direction = '${toString cfg.direction}',
|
||||||
|
@ -32,9 +33,13 @@ in {
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
''
|
'';
|
||||||
+ optionalString cfg.lazygit.enable ''
|
}
|
||||||
|
)
|
||||||
|
(
|
||||||
|
mkIf (cfg.enable && cfg.lazygit.enable)
|
||||||
|
{
|
||||||
|
vim.luaConfigRC.toggleterm-lazygit = mkIf cfg.lazygit.enable nvim.dag.entryAfter ["toggleterm"] ''
|
||||||
local terminal = require 'toggleterm.terminal'
|
local terminal = require 'toggleterm.terminal'
|
||||||
local lazygit = terminal.Terminal:new({
|
local lazygit = terminal.Terminal:new({
|
||||||
cmd = "lazygit",
|
cmd = "lazygit",
|
||||||
|
@ -47,6 +52,8 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set( 'n', [[<leader>gg]], function() lazygit:toggle() end, {silent = true, noremap = true})
|
vim.keymap.set( 'n', [[<leader>gg]], function() lazygit:toggle() end, {silent = true, noremap = true})
|
||||||
'');
|
'';
|
||||||
};
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue