Hi Xavier, On 1/7/25 19:46, Xavier Maillard wrote: > Hello > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: quoted-printable > > I am a new fish user trying to figure out all the concepts and features. > > I browse many github repositories to get some inspiration. > > Many people seems to mixup abbreviations and functions. I mean, some functi= > ons could have been abbreviations. >
For me it is like this. For the simple stuff I use aliases. Here some examples ``` alias lsbig "ls -s size -l | tail -n 10" ... if command -sq dnf alias dnfs="dnf search" alias dnfi="sudo dnf install" alias dnfr="sudo dnf remove" alias dnfl="sudo dnf list" alias dnfu="sudo dnf upgrade" alias dnfli="sudo dnf list installed" alias dnfc="sudo dnf clean all" alias dnfgi="sudo dnf groupinstall" alias dnfgl="sudo dnf grouplist" alias dnfgr="sudo dnf groupremove" end ``` For more complex stuff I use functions Examples ``` function mkcd set -l newdir $argv[1] mkdir -p $newdir cd $newdir end ``` ``` # quick way to show number of files, dirs and symlinks # in a directory tree function filestat set -l start_dir $argv[1] if [ -z $start_dir ] set start_dir '.' end set -l numf (find $start_dir -type f | wc -l) set -l numd (find $start_dir -type d | wc -l) set -l numl (find $start_dir -type l | wc -l) echo "#dirs=$numd, #files=$numf, #links=$numl" end ``` I use abbreviations only for stuff like this ``` abbr --add --position anywhere G '| grep' ``` Here I can type, for example: `ls -l G` and a blank and it gets expanded to `ls -l | grep` But your mileage may vary. 😁 -- Manfred _______________________________________________ Fish-users mailing list Fish-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fish-users