mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-02-04 10:55:50 +00:00
feat(toggleterm): custom setup opts
This commit is contained in:
parent
59d5ac0d63
commit
daa10b508b
2 changed files with 51 additions and 28 deletions
|
|
@ -9,6 +9,7 @@
|
|||
inherit (lib.meta) getExe;
|
||||
inherit (lib.nvim.binds) mkBinding;
|
||||
inherit (lib.nvim.dag) entryAnywhere entryAfter;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.terminal.toggleterm;
|
||||
in {
|
||||
|
|
@ -23,24 +24,7 @@ in {
|
|||
maps.normal = mkBinding cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal";
|
||||
|
||||
luaConfigRC.toggleterm = entryAnywhere ''
|
||||
require("toggleterm").setup({
|
||||
open_mapping = null,
|
||||
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
|
||||
},
|
||||
})
|
||||
require("toggleterm").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue