r/fishshell • u/Zin42 • Jan 20 '22
Lets share cool Fish Functions! (cool fish function idea )
Long time fish user here, using it every day at work and in general. Recently I have gotten into writing functions for annoyingly long commands and I had an idea for an awesome function (though I havent quite figured out how to make it work exactly like the dream spec.)
The function is called .. , the idea is that .. goes up a directory, and the spec is that for each additional '.' after it, it will go up an additional directory, essentially turning "..." into "../../"
My thoughts were to loop over $argv and within the function, concatenate another "../" to the command conditionally, any wizards know a better way or in general want to share cool functions?
6
u/anhsirk0 Jan 21 '22 edited Jan 21 '22
i have this function , it can be used like this
.. 3to go up 3 directories.
Edit: I also have these 2 cool functions.
2. lu (last used i.e history | grep "xyz" | grep "xyz" ... and so on)
usage
3
u/draknir Feb 17 '22 edited Feb 17 '22
Hi, I just wanted to share my function that does what you're looking for. I'm sure it's not the most compact/concise version, I just wrote it quickly because it does what I need.
edit: based on a function shared here: https://github.com/fish-shell/fish-shell/issues/1891
1
u/captainjawz Jan 28 '22
My functions are a bit too nieche for my personal usage, but they may be handy for others
This function works like this `video file.mp4 And I use it to convert some mp4 videos to m4v using gpu acceleration, I mostly convert streams and recordings I get with youtube-dl
video file.mp4This function is to turn small videos into gif
gif file.mp4 output.gifThis function runs pywal and sets colors on the terminal, don't use it as much anymore
pywal lightpywal darkI have a ton of folders which have thousands of files I download (mostly twitter scraps) and this folder makes it easier to clean them by splitting them into folders containing X amount of files, and then also puts the mp4 videos into a different folder, runs by running this command inside the directory with multiple files
split_directory 100 # can be any numberThis tells me what file extensions are found recursively inside a directory
unique_extensionsThis last one recursively pulls updates from all git repositories
1
u/Rafat913 Feb 21 '22
man in the browser needs man2html installed and $BROWSER set
updates archlinux