nvf/modules/terminal/toggleterm/config.nix

39 lines
1 KiB
Nix
Raw Normal View History

2023-02-05 23:44:38 +00:00
{
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.terminal.toggleterm;
in {
config = mkIf cfg.enable {
vim.startPlugins = [
"toggleterm-nvim"
];
vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere ''
require("toggleterm").setup({
2023-04-11 12:38:27 +00:00
open_mapping = null,
2023-02-05 23:44:38 +00:00
direction = '${toString cfg.direction}',
-- TODO: this should probably be turned into a module that uses the lua function if and only if the user has not set it
size = function(term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
winbar = {
enabled = '${toString cfg.enable_winbar}',
name_formatter = function(term) -- term: Terminal
return term.name
end
},
})
'';
2023-04-11 12:38:27 +00:00
vim.maps.normal = mkBinding cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal";
2023-02-05 23:44:38 +00:00
};
}