2021-11-23 20:53:35 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.programs.nixvim.plugins.floaterm;
|
|
|
|
helpers = import ../helpers.nix { inherit lib; };
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
programs.nixvim.plugins.floaterm = {
|
|
|
|
enable = mkEnableOption "Enable floaterm";
|
|
|
|
shell = mkOption {
|
2021-11-25 12:56:42 +01:00
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2021-11-23 20:53:35 +01:00
|
|
|
};
|
|
|
|
title = mkOption {
|
2021-11-25 12:56:42 +01:00
|
|
|
type = types.nullOr types.str;
|
2021-11-23 20:53:35 +01:00
|
|
|
description = "Show floaterm info at the top left corner of the floaterm window.";
|
2021-11-25 12:56:42 +01:00
|
|
|
default = null;
|
2021-11-23 20:53:35 +01:00
|
|
|
};
|
|
|
|
winType = mkOption {
|
2021-11-25 12:56:42 +01:00
|
|
|
type = types.nullOr (types.enum [ "float" "split" "vsplit" ]);
|
|
|
|
default = null;
|
2021-11-23 20:53:35 +01:00
|
|
|
};
|
|
|
|
winWidth = mkOption {
|
2021-11-25 12:56:42 +01:00
|
|
|
type = types.nullOr types.float;
|
2022-01-10 19:50:13 +00:00
|
|
|
description = "number of columns relative to &columns.";
|
2021-11-25 12:56:42 +01:00
|
|
|
default = null;
|
2021-11-23 20:53:35 +01:00
|
|
|
};
|
|
|
|
winHeight = mkOption {
|
2021-11-25 12:56:42 +01:00
|
|
|
type = types.nullOr types.float;
|
2022-01-10 19:50:13 +00:00
|
|
|
description = "number of lines relative to &lines.";
|
2021-11-25 12:56:42 +01:00
|
|
|
default = null;
|
2021-11-23 20:53:35 +01:00
|
|
|
};
|
|
|
|
borderChars = mkOption {
|
2021-11-25 12:56:42 +01:00
|
|
|
type = types.nullOr types.str;
|
2021-11-23 20:53:35 +01:00
|
|
|
description = "8 characters of the floating window border (top, right, bottom, left, topleft, topright, botright, botleft)";
|
2021-11-25 12:56:42 +01:00
|
|
|
default = null;
|
2021-11-23 20:53:35 +01:00
|
|
|
};
|
|
|
|
rootMarkers = mkOption {
|
2021-11-25 12:56:42 +01:00
|
|
|
type = types.nullOr (types.listOf types.str);
|
2022-01-10 19:50:13 +00:00
|
|
|
description = "Markers used to detect the project root directory for --cwd=<root>";
|
2021-11-25 12:56:42 +01:00
|
|
|
default = null;
|
2021-11-23 20:53:35 +01:00
|
|
|
};
|
|
|
|
opener = mkOption {
|
2021-11-25 12:56:42 +01:00
|
|
|
type = types.nullOr (types.enum [ "edit" "split" "vsplit" "tabe" "drop" ]);
|
2021-11-23 20:53:35 +01:00
|
|
|
description = "Command used for opening a file in the outside nvim from within :terminal";
|
2021-11-25 12:56:42 +01:00
|
|
|
default = null;
|
2021-11-23 20:53:35 +01:00
|
|
|
};
|
|
|
|
autoClose = mkOption {
|
2021-11-25 12:56:42 +01:00
|
|
|
type = types.nullOr (types.enum [ 0 1 2 ]);
|
2021-11-23 20:53:35 +01:00
|
|
|
description = "Whether to close floaterm window once the job gets finished.";
|
2021-11-25 12:56:42 +01:00
|
|
|
default = null;
|
2021-11-23 20:53:35 +01:00
|
|
|
};
|
|
|
|
autoHide = mkOption {
|
2021-11-25 12:56:42 +01:00
|
|
|
type = types.nullOr (types.enum [ 0 1 2 ]);
|
2021-11-23 20:53:35 +01:00
|
|
|
description = "Whether to hide previous floaterm before switching to or opening another one.";
|
2021-11-25 12:56:42 +01:00
|
|
|
default = null;
|
2021-11-23 20:53:35 +01:00
|
|
|
};
|
|
|
|
autoInsert = mkOption {
|
2021-11-25 12:56:42 +01:00
|
|
|
type = types.nullOr types.bool;
|
2021-11-23 20:53:35 +01:00
|
|
|
description = "Whether to enter Terminal-mode after opening a floaterm.";
|
2021-11-25 12:56:42 +01:00
|
|
|
default = null;
|
2021-11-23 20:53:35 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
programs.nixvim = {
|
|
|
|
extraPlugins = with pkgs.vimPlugins; [
|
|
|
|
vim-floaterm
|
|
|
|
];
|
|
|
|
globals = {
|
2021-11-25 12:56:42 +01:00
|
|
|
floaterm_shell = mkIf (!isNull cfg.shell) cfg.shell;
|
|
|
|
floaterm_title = mkIf (!isNull cfg.title) cfg.title;
|
|
|
|
floaterm_wintype = mkIf (!isNull cfg.winType) cfg.winType;
|
|
|
|
floaterm_width = mkIf (!isNull cfg.winWidth) cfg.winWidth;
|
|
|
|
floaterm_height = mkIf (!isNull cfg.winHeight) cfg.winHeight;
|
|
|
|
floaterm_borderchars = mkIf (!isNull cfg.borderChars) cfg.borderChars;
|
|
|
|
floaterm_rootmarkers = mkIf (!isNull cfg.rootMarkers) cfg.rootMarkers;
|
|
|
|
floaterm_opener = mkIf (!isNull cfg.opener) cfg.opener;
|
|
|
|
floaterm_autoclose = mkIf (!isNull cfg.autoClose) cfg.autoClose;
|
|
|
|
floaterm_autohide = mkIf (!isNull cfg.autoHide) cfg.autoHide;
|
|
|
|
floaterm_autoInsert = mkIf (!isNull cfg.autoInsert) cfg.autoInsert;
|
2021-11-23 20:53:35 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|