feat: new abbreviations
This commit is contained in:
parent
271cbb359b
commit
ef0ec4693c
2 changed files with 35 additions and 1 deletions
|
@ -105,6 +105,8 @@ in
|
||||||
abbreviations = {
|
abbreviations = {
|
||||||
us = "systemctl --user";
|
us = "systemctl --user";
|
||||||
rs = "sudo systemctl";
|
rs = "sudo systemctl";
|
||||||
|
uj = "journalctl --user";
|
||||||
|
rj = "sudo journalctl";
|
||||||
};
|
};
|
||||||
aliases = {
|
aliases = {
|
||||||
ls = "exa -lh --icons --git";
|
ls = "exa -lh --icons --git";
|
||||||
|
|
|
@ -46,14 +46,46 @@ in
|
||||||
# visual mode, but due to fish_cursor_default, is redundant here
|
# visual mode, but due to fish_cursor_default, is redundant here
|
||||||
set fish_cursor_visual block
|
set fish_cursor_visual block
|
||||||
|
|
||||||
|
# Complex abbreviations
|
||||||
|
function last_history_item
|
||||||
|
echo $history[1]
|
||||||
|
end
|
||||||
|
abbr -a !! --position anywhere --function last_history_item
|
||||||
|
|
||||||
|
function sed_history_item
|
||||||
|
echo $history[1] | perl -p -e (string trim -l --chars=! $argv)
|
||||||
|
end
|
||||||
|
abbr -a sed_history --position command --regex '^!s/.+/.*/g?' --function sed_history_item
|
||||||
|
|
||||||
|
function multicd
|
||||||
|
echo cd (string repeat -n (math (string length -- $argv[1]) - 1) ../)
|
||||||
|
end
|
||||||
|
abbr --add dotdot --regex '^\.\.+$' --function multicd
|
||||||
|
|
||||||
|
abbr -a P --position anywhere --set-cursor "% | $PAGER"
|
||||||
|
|
||||||
|
function editor_edit
|
||||||
|
echo $EDITOR $argv
|
||||||
|
end
|
||||||
|
abbr -a editor_edit_files --position command --regex ".+\.(txt|md|org)" --function editor_edit
|
||||||
|
|
||||||
|
function editor
|
||||||
|
echo $EDITOR
|
||||||
|
end
|
||||||
|
abbr -a e --function editor
|
||||||
|
|
||||||
# Completions
|
# Completions
|
||||||
complete -c c -kfa '(zoxide query -l | sed "s|$HOME|~|")'
|
complete -c c -kfa '(zoxide query -l | sed "s|$HOME|~|")'
|
||||||
${optionalString config.virtualisation.podman.dockerCompat /* fish */ "complete -c docker -w podman"}
|
${optionalString config.virtualisation.podman.dockerCompat /* fish */ "complete -c docker -w podman"}
|
||||||
|
complete -c nom -fn "not __fish_seen_subcommand_from build shell develop" -a "build shell develop"
|
||||||
|
|
||||||
|
complete -c nom -fn "__fish_seen_subcommand_from build" -w "nix build"
|
||||||
|
complete -c nom -fn "__fish_seen_subcommand_from shell" -w "nix shell"
|
||||||
|
complete -c nom -fn "__fish_seen_subcommand_from develop" -w "nix develop"
|
||||||
|
|
||||||
complete -c timers \
|
complete -c timers \
|
||||||
-n "__fish_seen_subcommand_from toggle" \
|
-n "__fish_seen_subcommand_from toggle" \
|
||||||
-fa '(timers --json l | ${getExe pkgs.jq} -r .[][].name)'
|
-fa '(timers --json l | ${getExe pkgs.jq} -r .[][].name)'
|
||||||
|
|
||||||
complete -c timers \
|
complete -c timers \
|
||||||
-n "__fish_seen_subcommand_from remove" \
|
-n "__fish_seen_subcommand_from remove" \
|
||||||
-fa '(timers --json l | ${getExe pkgs.jq} -r .[][].name)'
|
-fa '(timers --json l | ${getExe pkgs.jq} -r .[][].name)'
|
||||||
|
|
Loading…
Reference in a new issue