diff --git a/org/config/fish.org b/org/config/fish.org index 2e287cf..a8cc6d7 100644 --- a/org/config/fish.org +++ b/org/config/fish.org @@ -89,7 +89,7 @@ set -l ruler (string repeat -n $ruler_length "=") set -l osname (cat /etc/os-release | grep -i pretty_name | sed 's/.*"\(.*\)".*/\1/') - set -l uptime (uptime | sed 's/up \(.*\)/\1/') + set -l uptime (uptime -p | sed 's/up //') set -l root (df -Ph | grep -E "/\$") set -l root_p (echo $root | awk '{print $5}' | tr -d '%') @@ -155,9 +155,11 @@ :END: Now, let’s declare our editor of choice, EmacsClient; not Emacs itself since it will most often be just quick edits, nothing too heavy, if it is called - from the =EDITOR= variable (from Git, for example). + from the ~EDITOR~ variable (from Git, for example), or from the ~VISUAL~ + variable. #+BEGIN_SRC fish set -gx EDITOR emacsclient -c + set -gx VISUAL emacsclient -c #+END_SRC We also need to set the path to the Dart SDK. @@ -344,30 +346,11 @@ <> #+END_SRC -*** Compilation - :PROPERTIES: - :CUSTOM_ID: Abbreviations-Development-Compilation-dd066050 - :END: - By default, I set =clang=, =clang++=, =gcc= and =g++= to the latest - standard and with the =-Wall= flag activated. - #+NAME: abbr-comp - | abbreviation | command | - |--------------+----------------------| - | clang | clang -Wall | - | clang++ | clang++ -Wall | - | g++ | g++ -Wall -std=c++20 | - | gcc | gcc -Wall -std=c18 | - - Here is the corresponding fish configuration: - #+BEGIN_SRC fish :tangle - <> - #+END_SRC - *** Docker :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-Docker-2d0a1288 :END: - And of course, when it comes to Docker Compose, I don’t have time to write + And of course, when it comes to Docker Compose, I don't have time to write the full command, so I use these instead. #+NAME: abbr-docker | abbreviation | command | @@ -388,50 +371,17 @@ <> #+END_SRC -*** Git - :PROPERTIES: - :CUSTOM_ID: Abbreviations-Development-Git-5e5055c1 - :END: - And let’s face it: we all at one point just wanted to commit our code - without thinking about the message, to just get over with it. Don’t worry, - I got you covered. - #+NAME: abbr-git - | abbreviation | command | - |--------------+-----------------------------------------------------| - | randcommit | git commit -m (curl -s whatthecommit.com/index.txt) | - - Here is the corresponding fish configuration: - #+BEGIN_SRC fish :tangle - <> - #+END_SRC - -*** Prolog - :PROPERTIES: - :CUSTOM_ID: Abbreviations-Development-Prolog-72c9d2ef - :END: - When I launch =swipl=, I prefer to have my terminal cleaned before and - after it runs, I find it more clean. - #+NAME: abbr-prolog - | abbreviation | command | - |--------------+----------------------------| - | swipl | clear && swipl -q && clear | - - Here is the corresponding fish configuration: - #+BEGIN_SRC fish - <> - #+END_SRC - *** Text editors :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-Text_editors-5a23df47 :END: I greatly prefer to use Emacsclient as my main text editor; Emacs has - basically all I need. So, it’s only normal I have an abbreviation to launch + basically all I need. So, it's only normal I have an abbreviation to launch a new instance of it. However, in a graphical environment, this will launch - a new graphical window of Emacs. To launch a terminal instance, I’ll use - =enw= (=nw= stands for the option “nowindow” =-nw= of Emacs). I also wish to - completely stop using other text editors, such as =vi=, =vim=, =nano= and - =ed=, so let’s all add their command as an abbreviation for Emacs. + a new graphical window of Emacs. To launch a terminal instance, I'll use + ~enw~ (~nw~ stands for the option “nowindow” ~-nw~ of Emacs). I also wish to + completely stop using other text editors, such as ~vi~, ~vim~, ~nano~ and + ~ed~, so let's all add their command as an abbreviation for Emacs. #+NAME: abbr-text-ed | abbreviation | command | @@ -448,15 +398,51 @@ <> #+END_SRC +*** Compilation + :PROPERTIES: + :CUSTOM_ID: Abbreviations-Development-Compilation-dd066050 + :END: + By default, I set ~clang~, ~clang++~, ~gcc~ and ~g++~ to the latest + standard and with the ~-Wall~ flag activated. + #+NAME: abbr-comp + | abbreviation | command | + |--------------+----------------------| + | clang | clang -Wall | + | clang++ | clang++ -Wall | + | g++ | g++ -Wall -std=c++20 | + | gcc | gcc -Wall -std=c18 | + + Here is the corresponding fish configuration: + #+BEGIN_SRC fish + <> + #+END_SRC + +*** Git + :PROPERTIES: + :CUSTOM_ID: Abbreviations-Development-Git-5e5055c1 + :END: + And let's face it: we all at one point just wanted to commit our code + without thinking about the message, to just get over with it. Don't worry, + I got you covered. + #+NAME: abbr-git + | abbreviation | command | + |--------------+-----------------------------------------------------| + | randcommit | git commit -m (curl -s whatthecommit.com/index.txt) | + + Here is the corresponding fish configuration: + #+BEGIN_SRC fish + <> + #+END_SRC + ** LaTeX :PROPERTIES: :CUSTOM_ID: Abbreviations-LaTeX-76865eb9 :END: Yes, although I use org-mode, I still have some use for LaTeX, especially when it comes to PDF exports of my org files. Hence why I use the LaTeX - package manager. It is recommended to use =tllocalmgr= instead of =tlmgr=, + package manager. It is recommended to use ~tllocalmgr~ instead of ~tlmgr~, but I can never remember the command, and the latter is faster to type, so - time for an abbreviation. Same goes for =texhash= which must be run as sudo. + time for an abbreviation. Same goes for ~texhash~ which must be run as sudo. #+NAME: latex-abbr | abbreviation | command | |--------------+--------------| @@ -504,18 +490,20 @@ :PROPERTIES: :CUSTOM_ID: Abbreviations-Typos-370bbb27 :END: - Let’s admit it, we all make typos from time to time in the shell, and some + Let's admit it, we all make typos from time to time in the shell, and some are recurrent enough we make abbreviations or aliases of the correct command. Well, I have some of my abbreviations which were make exactly because of - this. Sometimes for some reasons, my brain makes me write =clean= instead of - =clear=. So, let’s just replace the former by the latter. I’m also very bad - at typing =exit=. And sometimes I suck at typing =htop=. + this. Sometimes for some reasons, my brain makes me write ~clean~ instead of + ~clear~. So, let's just replace the former by the latter. I'm also very bad + at typing ~exit~. And sometimes I suck at typing ~htop~. ~q~ isn't a typo per + se, instead just a habit I have. #+NAME: typo-abbr | abbreviation | command | |--------------+---------| | clean | clear | | exi | exit | | exti | exit | + | q | exit | | hotp | htop | Here is the corresponding fish configuration: @@ -527,71 +515,20 @@ :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-c2631eb6 :END: - Finally, some miscellaneous abbreviations that don’t really fit into any of + Finally, some miscellaneous abbreviations that don't really fit into any of the above categories. -*** Sudo +*** Media :PROPERTIES: - :CUSTOM_ID: Abbreviations-Misc-Sudo-aef0214a + :CUSTOM_ID: Abbreviations-Misc-Media-e4b85d56 :END: - First, I make it so that =sudo= comes with the =-A= switch in order to call - my custom graphical script for getting my password (see - [[file:~/.local/bin/askpass][.local/bin/askpass]]). I also made it so =please= is an equivalent to =sudo - -A= as a joke. + Here you will find various commands related to media in general. the first + one is a command to play some chillhop from the [[https://www.youtube.com/user/Chillhopdotcom][Chillhop YouTube channel]]'s + livestream. #+BEGIN_SRC fish - abbr please 'sudo -A' + abbr chill 'mpv --force-window=no --no-video "https://www.youtube.com/user/Chillhopdotcom/live" &' #+END_SRC -*** Exit - :PROPERTIES: - :CUSTOM_ID: Abbreviations-Misc-Exit-e3482f5c - :END: - Sometimes I find it easier to just type =q= instead of =exit=. - #+BEGIN_SRC fish - abbr q exit - #+END_SRC - -*** History - :PROPERTIES: - :CUSTOM_ID: Abbreviations-Misc-History-a2124b23 - :END: - I also find it more intuitive and faster to just write =hist= instead of - =history=, so let’s declare that. - #+BEGIN_SRC fish - abbr hist history - #+END_SRC - -*** ~youtube-dl~ related commands - :PROPERTIES: - :CUSTOM_ID: Abbreviations-Misc-~youtube-dl~_related_commands-654caed1 - :END: -**** Song download from YouTube - :PROPERTIES: - :CUSTOM_ID: Abbreviations-Misc-~youtube-dl~_related_commands-Song_download_from_YouTube-ec2afa3c - :END: - When I want to download a song from YouTube, I’ll just use the command - =flac videoIdentifier= to get it through =youtube-dl=. - #+BEGIN_SRC fish - abbr flac 'youtube-dl -x --audio-format flac --audio-quality 0 -o "~/Music/%(uploader)s/%(title)s.%(ext)s"' - #+END_SRC - -**** Videos download from YouTube - :PROPERTIES: - :CUSTOM_ID: Abbreviations-Misc-~youtube-dl~_related_commands-Videos_download_from_YouTube-33910b0b - :END: - I download a LOT of videos from YouTube, generally educative videos that I - do not want to lose to YouTube one day who will decide that such channel is - unworthy of their platform, or if the original author decides to delete - their videos or whatever. So, I use the abbreviation ~ytdl~ to download - either one video, or a whole YouTube channel. - #+BEGIN_SRC fish - abbr ytdl 'youtube-dl -f best -ciw -o "~/Videos/YouTube/%(uploader)s/%(upload_date)s - %(title)s.%(ext)s"' - #+END_SRC - -*** MPV - :PROPERTIES: - :CUSTOM_ID: Abbreviations-Misc-MPV-f99dd400 - :END: When it comes to mpv, I do not want to force it to open a graphical window if for example I want to listen to an audio file. I also do not want any border on that window. So, I declared this abbreviation. @@ -599,14 +536,65 @@ abbr mpv 'mpv --no-border --force-window=no' #+END_SRC + When I want to download a song from YouTube, I'll just use the command ~flac + videoIdentifier~ to get it through ~youtube-dl~. + #+BEGIN_SRC fish + abbr flac 'youtube-dl -x --audio-format flac --audio-quality 0 -o "~/Music/%(uploader)s/%(title)s.%(ext)s"' + #+END_SRC + + I download a LOT of videos from YouTube, generally educative videos that I + do not want to lose to YouTube one day who will decide that such channel is + unworthy of their platform, or if the original author decides to delete + their videos or whatever. So, I use the abbreviation ~ytdl~ to download + either one video, or a whole YouTube channel. + #+BEGIN_SRC fish + abbr ytdl 'youtube-dl -f best -ciw -o "~/Videos/YouTube/%(uploader)s/%(upload_date)s - %(title)s.%(ext)s"' + #+END_SRC + + Some sane default options for ~sxiv~, a simple X image Viewer. This includes + playing GIFs and not displaying the filename below. Sxiv will also open in + fullscreen and will fit the displayed image to the frame. I also abbreviated + ~feh~ to sxiv, old habits die hard. + #+BEGIN_SRC fish + abbr sxiv 'sxiv -abfs f' + abbr feh 'sxiv -abfs f' + #+END_SRC + + Finally, let's declare the following abbreviation that will launch an mpv + instance displaying my webcam: + #+BEGIN_SRC fish + abbr webcam 'mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0' + #+END_SRC + +*** Sudo + :PROPERTIES: + :CUSTOM_ID: Abbreviations-Misc-Sudo-aef0214a + :END: + First, I make it so that ~sudo~ comes with the ~-A~ switch in order to call + my custom graphical script for getting my password (see [[file:bin.org::#Askpass-d0d7a8c0][askpass]]). I also + made it so ~please~ is an equivalent to ~sudo -A~ as a joke. + #+BEGIN_SRC fish + abbr please 'sudo -A' + #+END_SRC + +*** History + :PROPERTIES: + :CUSTOM_ID: Abbreviations-Misc-History-a2124b23 + :END: + I also find it more intuitive and faster to just write ~hist~ instead of + ~history~, so let's declare that. + #+BEGIN_SRC fish + abbr hist history + #+END_SRC + *** Compression :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-Compression-4fd4ffef :END: - It seems it’s just like many other people, but I cannot for the life of me - remember the syntax of =tar=. So, I made the following abbreviations, and - one day hopefully, after seeing the abbreviations’ expansion over and over - I’ll remember the command like I did for the abbreviation of =remove= (see + It seems it's just like many other people, but I cannot for the life of me + remember the syntax of ~tar~. So, I made the following abbreviations, and + one day hopefully, after seeing the abbreviations' expansion over and over + I'll remember the command like I did for the abbreviation of ~remove~ (see [[#Abbreviations-System_management_(packages_and_services)-Package_management-efbcdf0f][Package management]]). #+NAME: tar-abbr | abbreviation | command | @@ -618,19 +606,6 @@ <> #+END_SRC -*** Sxiv - :PROPERTIES: - :CUSTOM_ID: Abbreviations-Misc-Sxiv-1c0cf845 - :END: - Some sane default options for =sxiv=, a simple X image Viewer. This includes - playing GIFs and not displaying the filename below. Sxiv will also open in - fullscreen and will fit the displayed image to the frame. I also abbreviated - ~feh~ to sxiv, old habits die hard. - #+BEGIN_SRC fish - abbr sxiv 'sxiv -abfs f' - abbr feh 'sxiv -abfs f' - #+END_SRC - *** exa :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-exa-e1b528b9 @@ -680,19 +655,6 @@ <> #+END_SRC -*** Webcam - :PROPERTIES: - :CUSTOM_ID: Abbreviations-Misc-Webcam-34eedb5a - :END: - #+NAME: webcam-abbr - | abbreviation | command | - |--------------+------------------------------------------------------------------------------------------------------------------| - | webcam | mpv --no-border --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0 | - - #+BEGIN_SRC fish - <> - #+END_SRC - *** Wget :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-Wget-27f4bebf