1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-08 19:46:06 +01:00

plugins/toggleterm: cleanup, remove most settings declarations

Signed-off-by: saygo-png <saygo.mail@proton.me>
This commit is contained in:
saygo-png 2025-10-31 22:05:17 +01:00 committed by Gaétan Lepage
parent 281f36c9af
commit 7f633db591

View file

@ -1,18 +1,19 @@
{ {
lib, lib,
helpers,
... ...
}: }:
with lib; let
inherit (lib) types;
in
lib.nixvim.plugins.mkNeovimPlugin { lib.nixvim.plugins.mkNeovimPlugin {
name = "toggleterm"; name = "toggleterm";
package = "toggleterm-nvim"; package = "toggleterm-nvim";
description = "A neovim lua plugin to help easily manage multiple terminal windows."; description = "A neovim lua plugin to help easily manage multiple terminal windows.";
maintainers = [ maintainers.GaetanLepage ]; maintainers = [ lib.maintainers.GaetanLepage ];
settingsOptions = { settingsOptions = {
size = helpers.defaultNullOpts.mkStrLuaFnOr types.number 12 '' size = lib.nixvim.defaultNullOpts.mkStrLuaFnOr types.number 12 ''
Size of the terminal. Size of the terminal.
`size` can be a number or a function. `size` can be a number or a function.
@ -35,164 +36,74 @@ lib.nixvim.plugins.mkNeovimPlugin {
``` ```
''; '';
open_mapping = helpers.mkNullOrLua '' open_mapping = lib.nixvim.mkNullOrLua ''
Setting the `open_mapping` key to use for toggling the terminal(s) will set up mappings for Setting the `open_mapping` key to use for toggling the terminal(s) will set up mappings for
normal mode. normal mode.
''; '';
on_create = helpers.mkNullOrLuaFn '' on_create = lib.nixvim.mkNullOrLuaFn ''
Function to run when the terminal is first created. Function to run when the terminal is first created.
`fun(t: Terminal)` `fun(t: Terminal)`
''; '';
on_open = helpers.mkNullOrLuaFn '' on_open = lib.nixvim.mkNullOrLuaFn ''
Function to run when the terminal opens. Function to run when the terminal opens.
`fun(t: Terminal)` `fun(t: Terminal)`
''; '';
on_close = helpers.mkNullOrLuaFn '' on_close = lib.nixvim.mkNullOrLuaFn ''
Function to run when the terminal closes. Function to run when the terminal closes.
`fun(t: Terminal)` `fun(t: Terminal)`
''; '';
on_stdout = helpers.mkNullOrLuaFn '' on_stdout = lib.nixvim.mkNullOrLuaFn ''
Callback for processing output on stdout. Callback for processing output on stdout.
`fun(t: Terminal, job: number, data: string[], name: string)` `fun(t: Terminal, job: number, data: string[], name: string)`
''; '';
on_stderr = helpers.mkNullOrLuaFn '' on_stderr = lib.nixvim.mkNullOrLuaFn ''
Callback for processing output on stderr. Callback for processing output on stderr.
`fun(t: Terminal, job: number, data: string[], name: string)` `fun(t: Terminal, job: number, data: string[], name: string)`
''; '';
on_exit = helpers.mkNullOrLuaFn '' on_exit = lib.nixvim.mkNullOrLuaFn ''
Function to run when terminal process exits. Function to run when terminal process exits.
`fun(t: Terminal, job: number, exit_code: number, name: string)` `fun(t: Terminal, job: number, exit_code: number, name: string)`
''; '';
hide_numbers = helpers.defaultNullOpts.mkBool true ''
Hide the number column in toggleterm buffers.
'';
shade_filetypes = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Shade filetypes.
'';
autochdir = helpers.defaultNullOpts.mkBool false ''
When neovim changes it current directory the terminal will change it's own when next it's
opened.
'';
highlights = helpers.defaultNullOpts.mkAttrsOf lib.types.highlight {
NormalFloat.link = "Normal";
FloatBorder.link = "Normal";
StatusLine.gui = "NONE";
StatusLineNC = {
cterm = "italic";
gui = "NONE";
};
} "Highlights which map a highlight group name to an attrs of it's values.";
shade_terminals = helpers.defaultNullOpts.mkBool true ''
NOTE: This option takes priority over highlights specified so if you specify Normal
highlights you should set this to `false`.
'';
shading_factor = helpers.mkNullOrOption types.int ''
The percentage by which to lighten terminal background.
default: -30 (gets multiplied by -3 if background is light).
'';
start_in_insert = helpers.defaultNullOpts.mkBool true ''
Whether to start toggleterm in insert mode.
'';
insert_mappings = helpers.defaultNullOpts.mkBool true ''
Whether or not the open mapping applies in insert mode.
'';
terminal_mappings = helpers.defaultNullOpts.mkBool true ''
Whether or not the open mapping applies in the opened terminals.
'';
persist_size = helpers.defaultNullOpts.mkBool true ''
Whether the terminal size should persist.
'';
persist_mode = helpers.defaultNullOpts.mkBool true ''
If set to true (default) the previous terminal mode will be remembered.
'';
direction = helpers.defaultNullOpts.mkEnum [
"vertical"
"horizontal"
"tab"
"float"
] "horizontal" "The direction the terminal should be opened in.";
close_on_exit = helpers.defaultNullOpts.mkBool true ''
Close the terminal window when the process exits.
'';
shell = helpers.defaultNullOpts.mkStr (lib.nixvim.literalLua "vim.o.shell") ''
Change the default shell.
'';
auto_scroll = helpers.defaultNullOpts.mkBool true ''
Automatically scroll to the bottom on terminal output.
'';
float_opts = { float_opts = {
border = helpers.mkNullOrOption lib.types.border '' width = lib.nixvim.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null ''
`border` = "single" | "double" | "shadow" | "curved" | ... other options supported by
`win open`.
The border key is *almost* the same as 'nvim_open_win'.
The 'curved' border is a custom border type not natively supported but implemented in this plugin.
'';
width = helpers.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null ''
Width of the floating terminal. Like `size`, `width` can be a number or Width of the floating terminal. Like `size`, `width` can be a number or
function which is passed the current terminal. function which is passed the current terminal.
''; '';
height = helpers.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null '' height = lib.nixvim.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null ''
Height of the floating terminal. Like `size`, `height` can be a number Height of the floating terminal. Like `size`, `height` can be a number
or function which is passed the current terminal. or function which is passed the current terminal.
''; '';
row = helpers.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null '' row = lib.nixvim.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null ''
Start row of the floating terminal. Defaults to the center of the Start row of the floating terminal. Defaults to the center of the
screen. Like `size`, `row` can be a number or function which is passed screen. Like `size`, `row` can be a number or function which is passed
the current terminal. the current terminal.
''; '';
col = helpers.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null '' col = lib.nixvim.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null ''
Start column of the floating terminal. Defaults to the center of the Start column of the floating terminal. Defaults to the center of the
screen. Like `size`, `col` can be a number or function which is passed screen. Like `size`, `col` can be a number or function which is passed
the current terminal. the current terminal.
''; '';
winblend = helpers.defaultNullOpts.mkUnsignedInt 0 "";
zindex = helpers.mkNullOrOption types.ints.unsigned "";
title_pos = helpers.defaultNullOpts.mkStr "left" "";
}; };
winbar = { winbar = {
enabled = helpers.defaultNullOpts.mkBool false ''
Whether to enable winbar.
'';
name_formatter = name_formatter =
helpers.defaultNullOpts.mkLuaFn lib.nixvim.defaultNullOpts.mkLuaFn
'' ''
function(term) function(term)
return term.name return term.name