2023-11-24 18:44:25 +01:00
|
|
|
{ config, ... }: {
|
|
|
|
config = {
|
|
|
|
programs.fish = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
shellAbbrs = {
|
|
|
|
l = "less";
|
|
|
|
gco = "git checkout";
|
|
|
|
"-C" = {
|
|
|
|
position = "anywhere";
|
|
|
|
expansion = "--color";
|
|
|
|
};
|
|
|
|
L = {
|
|
|
|
position = "anywhere";
|
|
|
|
setCursor = true;
|
|
|
|
expansion = "% | less";
|
|
|
|
};
|
|
|
|
"!!" = {
|
|
|
|
position = "anywhere";
|
|
|
|
function = "last_history_item";
|
|
|
|
};
|
|
|
|
vim_edit_texts = {
|
|
|
|
position = "command";
|
|
|
|
regex = ".+\\.txt";
|
|
|
|
function = "vim_edit";
|
|
|
|
};
|
|
|
|
"4DIRS" = {
|
|
|
|
setCursor = "!";
|
2023-12-21 09:10:04 +01:00
|
|
|
expansion = ''
|
|
|
|
for dir in */
|
|
|
|
cd $dir
|
|
|
|
!
|
|
|
|
cd ..
|
|
|
|
end
|
|
|
|
'';
|
2023-11-24 18:44:25 +01:00
|
|
|
};
|
|
|
|
dotdot = {
|
|
|
|
regex = "^\\.\\.+$";
|
|
|
|
function = "multicd";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
nmt = {
|
|
|
|
description =
|
|
|
|
"if fish.shellAbbrs is set, check fish.config contains valid abbreviations";
|
|
|
|
script = ''
|
|
|
|
assertFileContains home-files/.config/fish/config.fish \
|
2023-12-21 09:10:04 +01:00
|
|
|
"abbr --add -- l less"
|
2023-11-24 18:44:25 +01:00
|
|
|
assertFileContains home-files/.config/fish/config.fish \
|
2023-12-21 09:10:04 +01:00
|
|
|
"abbr --add -- gco 'git checkout'"
|
2023-11-24 18:44:25 +01:00
|
|
|
assertFileContains home-files/.config/fish/config.fish \
|
2023-12-21 09:10:04 +01:00
|
|
|
"abbr --add --position anywhere -- -C --color"
|
2023-11-24 18:44:25 +01:00
|
|
|
assertFileContains home-files/.config/fish/config.fish \
|
2023-12-21 09:10:04 +01:00
|
|
|
"abbr --add --position anywhere --set-cursor -- L '% | less'"
|
2023-11-24 18:44:25 +01:00
|
|
|
assertFileContains home-files/.config/fish/config.fish \
|
2023-12-21 09:10:04 +01:00
|
|
|
"abbr --add --function last_history_item --position anywhere -- !!"
|
2023-11-24 18:44:25 +01:00
|
|
|
assertFileContains home-files/.config/fish/config.fish \
|
|
|
|
"abbr --add --function vim_edit --position command --regex '.+\.txt' -- vim_edit_texts"
|
|
|
|
assertFileContains home-files/.config/fish/config.fish \
|
2023-12-21 09:10:04 +01:00
|
|
|
"abbr --add '--set-cursor=!' -- 4DIRS 'for dir in */
|
|
|
|
cd \$dir
|
|
|
|
!
|
|
|
|
cd ..
|
|
|
|
end
|
|
|
|
'"
|
2023-11-24 18:44:25 +01:00
|
|
|
assertFileContains home-files/.config/fish/config.fish \
|
|
|
|
"abbr --add --function multicd --regex '^\.\.+$' -- dotdot"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|