I have a directory which has a really long path. However, I use this directory constantly and I cannot move it (WSL Windows directory). I generally use z to jump around to it quickly which is useful, but I would like to have an abbreviation when I need to specify a path in command-line. For example, the Fish shell that I use has an inbuilt "abbr" feature which auto expands text after you press spacebar after typing it. However, this only works if the abbreviation is the first text in the line. If I want to copy something from my home directory I would type
cp filename.txt /c/mnt/Users/%name%/program/directory/subdirectory
But I would like to have something that works like this
cp filename.txt udir
where it expands udir to the path I want.
cp2 filename.txt
that automatically adds the second path.cp
that interprets the command if the right pattern is found.. otherwise, calls the original copy in/bin/cp
.. you just need to have your script at the front of the path so it catches thecp
call and not the original one.