2023-05-30 17:20:08 +02:00
|
|
|
{
|
|
|
|
lib,
|
2024-02-09 14:21:22 +01:00
|
|
|
config,
|
|
|
|
helpers,
|
2023-11-06 15:04:08 +01:00
|
|
|
pkgs,
|
2023-05-30 17:20:08 +02:00
|
|
|
...
|
2024-02-09 14:21:22 +01:00
|
|
|
}:
|
|
|
|
with lib;
|
|
|
|
with helpers.vim-plugin;
|
|
|
|
mkVimPlugin config {
|
|
|
|
name = "vim-slime";
|
2024-02-15 09:51:43 +01:00
|
|
|
defaultPackage = pkgs.vimPlugins.vim-slime;
|
2024-02-09 14:21:22 +01:00
|
|
|
globalPrefix = "slime_";
|
|
|
|
|
2024-03-04 09:35:28 +01:00
|
|
|
maintainers = [maintainers.GaetanLepage];
|
|
|
|
|
2024-03-02 23:24:35 +01:00
|
|
|
# TODO introduced 2024-03-02: remove 2024-05-02
|
|
|
|
deprecateExtraConfig = true;
|
|
|
|
optionsRenamedToSettings = [
|
|
|
|
"target"
|
|
|
|
"vimterminalCmd"
|
|
|
|
"noMappings"
|
|
|
|
"pasteFile"
|
|
|
|
"preserveCurpos"
|
|
|
|
"defaultConfig"
|
|
|
|
"dontAskDefault"
|
|
|
|
"bracketedPaste"
|
|
|
|
];
|
|
|
|
|
|
|
|
settingsOptions = {
|
|
|
|
target =
|
|
|
|
helpers.defaultNullOpts.mkEnum
|
|
|
|
[
|
2024-02-09 14:21:22 +01:00
|
|
|
"dtach"
|
|
|
|
"kitty"
|
|
|
|
"neovim"
|
|
|
|
"screen"
|
|
|
|
"tmux"
|
|
|
|
"vimterminal"
|
|
|
|
"wezterm"
|
|
|
|
"whimrepl"
|
|
|
|
"x11"
|
|
|
|
"zellij"
|
2024-03-02 23:24:35 +01:00
|
|
|
]
|
|
|
|
"screen"
|
|
|
|
"Which backend vim-slime should use.";
|
|
|
|
|
|
|
|
vimterminal_cmd = helpers.mkNullOrStr ''
|
|
|
|
The vim terminal command to execute.
|
|
|
|
'';
|
|
|
|
|
|
|
|
no_mappings = helpers.defaultNullOpts.mkBool false ''
|
|
|
|
Whether to disable the default mappings.
|
|
|
|
'';
|
|
|
|
|
|
|
|
paste_file = helpers.defaultNullOpts.mkStr "$HOME/.slime_paste" ''
|
|
|
|
Required to transfer data from vim to GNU screen or tmux.
|
|
|
|
Setting this explicitly can work around some occasional portability issues.
|
|
|
|
whimrepl does not require or support this setting.
|
|
|
|
'';
|
|
|
|
|
|
|
|
preserve_curpos = helpers.defaultNullOpts.mkBool true ''
|
|
|
|
Whether to preserve cursor position when sending a line or paragraph.
|
|
|
|
'';
|
|
|
|
|
|
|
|
default_config =
|
|
|
|
helpers.mkNullOrOption
|
|
|
|
(
|
|
|
|
with helpers.nixvimTypes;
|
|
|
|
attrsOf
|
|
|
|
(either str rawLua)
|
|
|
|
)
|
|
|
|
''
|
2024-02-09 14:21:22 +01:00
|
|
|
Pre-filled prompt answer.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
- `tmux`:
|
|
|
|
```nix
|
|
|
|
{
|
|
|
|
socket_name = "default";
|
|
|
|
target_pane = "{last}";
|
|
|
|
}
|
|
|
|
```
|
|
|
|
- `zellij`:
|
|
|
|
```nix
|
|
|
|
{
|
|
|
|
session_id = "current";
|
|
|
|
relative_pane = "right";
|
|
|
|
}
|
|
|
|
```
|
|
|
|
'';
|
|
|
|
|
2024-03-02 23:24:35 +01:00
|
|
|
dont_ask_default = helpers.defaultNullOpts.mkBool false ''
|
|
|
|
Whether to bypass the prompt and use the specified default configuration options.
|
|
|
|
'';
|
|
|
|
|
|
|
|
bracketed_paste = helpers.defaultNullOpts.mkBool false ''
|
|
|
|
Sometimes REPL are too smart for their own good, e.g. autocompleting a bracket that should
|
|
|
|
not be autocompleted when pasting code from a file.
|
|
|
|
In this case it can be useful to rely on bracketed-paste
|
|
|
|
(https://cirw.in/blog/bracketed-paste).
|
|
|
|
Luckily, tmux knows how to handle that. See tmux's manual.
|
|
|
|
'';
|
|
|
|
};
|
2024-02-09 14:21:22 +01:00
|
|
|
|
2024-03-02 23:24:35 +01:00
|
|
|
settingsExample = {
|
|
|
|
target = "screen";
|
|
|
|
vimterminal_cmd = null;
|
|
|
|
no_mappings = false;
|
|
|
|
paste_file = "$HOME/.slime_paste";
|
|
|
|
preserve_curpos = true;
|
|
|
|
default_config = {
|
|
|
|
socket_name = "default";
|
|
|
|
target_pane = "{last}";
|
2024-02-09 14:21:22 +01:00
|
|
|
};
|
2024-03-02 23:24:35 +01:00
|
|
|
dont_ask_default = false;
|
|
|
|
bracketed_paste = false;
|
2024-02-09 14:21:22 +01:00
|
|
|
};
|
|
|
|
}
|