mirror of
https://github.com/nix-community/home-manager
synced 2024-11-24 20:19:45 +01:00
8b797c8eea
Commit 8cedd6 `fish: support flexible abbreviations` removed shell escaping for fish shell abbr values. This was a dangerous breaking change offered little value and made writing abbr expansions more difficult. This commit restores automatic shell escaping of fish abbr values.
72 lines
2.1 KiB
Nix
72 lines
2.1 KiB
Nix
{ 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 = "!";
|
|
expansion = ''
|
|
for dir in */
|
|
cd $dir
|
|
!
|
|
cd ..
|
|
end
|
|
'';
|
|
};
|
|
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 \
|
|
"abbr --add -- l less"
|
|
assertFileContains home-files/.config/fish/config.fish \
|
|
"abbr --add -- gco 'git checkout'"
|
|
assertFileContains home-files/.config/fish/config.fish \
|
|
"abbr --add --position anywhere -- -C --color"
|
|
assertFileContains home-files/.config/fish/config.fish \
|
|
"abbr --add --position anywhere --set-cursor -- L '% | less'"
|
|
assertFileContains home-files/.config/fish/config.fish \
|
|
"abbr --add --function last_history_item --position anywhere -- !!"
|
|
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 \
|
|
"abbr --add '--set-cursor=!' -- 4DIRS 'for dir in */
|
|
cd \$dir
|
|
!
|
|
cd ..
|
|
end
|
|
'"
|
|
assertFileContains home-files/.config/fish/config.fish \
|
|
"abbr --add --function multicd --regex '^\.\.+$' -- dotdot"
|
|
'';
|
|
};
|
|
};
|
|
}
|