|
| 1 | +#!/usr/bin/env fish |
| 2 | + |
| 3 | +abbr --add fish-reload-config 'source ~/.config/fish/**/*.fish' |
| 4 | +abbr --add g_commit_and_push --set-cursor 'git commit -am "%" && git push' |
| 5 | +abbr --add starwars 'telnet towel.blinkenlights.nl' |
| 6 | +abbr --add agi 'aqua g -g -i' |
| 7 | + |
| 8 | + |
| 9 | +abbr --position anywhere --add p0 "&> /dev/null" # Pipe everything to /dev/null |
| 10 | + |
| 11 | +# Function to set abbreviation if command exists |
| 12 | +function set_abbr_if_cmd_exists |
| 13 | + set -l cmd $argv[1] |
| 14 | + set -l abbr_name $argv[2] |
| 15 | + set -l abbr_value $argv[3] |
| 16 | + if command -v $cmd >/dev/null |
| 17 | + abbr -a $abbr_name $abbr_value |
| 18 | + end |
| 19 | +end |
| 20 | + |
| 21 | +# Function to set environment variable if command exists |
| 22 | +function set_env_if_cmd_exists |
| 23 | + set -l cmd $argv[1] |
| 24 | + set -l var_name $argv[2] |
| 25 | + set -l var_value $argv[3] |
| 26 | + if command -v $cmd >/dev/null |
| 27 | + set -gx $var_name $var_value |
| 28 | + end |
| 29 | +end |
| 30 | + |
| 31 | +# Aqua installed tools |
| 32 | +set_abbr_if_cmd_exists eza ls eza |
| 33 | +set_abbr_if_cmd_exists eza ll "eza -al" |
| 34 | +set_abbr_if_cmd_exists bat cat bat |
| 35 | +set_abbr_if_cmd_exists gping ping gping |
| 36 | +set_abbr_if_cmd_exists hwatch watch hwatch |
| 37 | +set_abbr_if_cmd_exists lazydocker lzd lazydocker |
| 38 | +set_abbr_if_cmd_exists lazygit lzg lazygit |
| 39 | + |
| 40 | +# Mise installed tools |
| 41 | +set_env_if_cmd_exists moar PAGER "moar -no-clear-on-exit" |
| 42 | +set_abbr_if_cmd_exists pgcli psql pgcli |
0 commit comments