From 8ea39786805a99500ca3b702920c972eb8bf7e4f Mon Sep 17 00:00:00 2001 From: Phuntsok Drak-pa Date: Wed, 23 Oct 2019 15:25:35 +0200 Subject: [PATCH] nicer readme --- .config/fish/README.org | 877 ++++++++++++++++++++-------------------- 1 file changed, 441 insertions(+), 436 deletions(-) diff --git a/.config/fish/README.org b/.config/fish/README.org index 28e06e9..49e9ad2 100644 --- a/.config/fish/README.org +++ b/.config/fish/README.org @@ -42,36 +42,36 @@ :CUSTOM_ID: h-c7ab05d0-4c5f-4a4c-8603-4c79e264141c :END: - [[#presentation][Presentation]] - - [[#fish-from-within-emacs][Fish from within Emacs]] - - [[#tramp-remote-access][Tramp remote access]] - - [[#regular-fish-shell-appearance][Regular fish shell appearance]] - - [[#global-variables][Global variables]] - - [[#abbreviations][Abbreviations]] - - [[#system-monitoring][System monitoring]] - - [[#system-management-packages-and-services][System management (packages and services)]] - - [[#package-mangaement][Package mangaement]] - - [[#service-management][Service management]] - - [[#development][Development]] - - [[#cmake][CMake]] - - [[#compilation][Compilation]] - - [[#docker][Docker]] - - [[#git][Git]] - - [[#prolog][Prolog]] - - [[#text-editors][Text editors]] - - [[#latex][LaTeX]] - - [[#some-security-measures][Some security measures]] - - [[#typos][Typos]] - - [[#misc][Misc]] - - [[#sudo][Sudo]] - - [[#exit][Exit]] - - [[#history][History]] - - [[#song-download-from-youtube][Song download from YouTube]] - - [[#mpv][MPV]] - - [[#compression][Compression]] - - [[#feh][Feh]] - - [[#ls][ls]] - - [[#networkmanager][NetworkManager]] - - [[#wget][Wget]] +- [[#fish-from-within-emacs][Fish from within Emacs]] +- [[#tramp-remote-access][Tramp remote access]] +- [[#regular-fish-shell-appearance][Regular fish shell appearance]] +- [[#global-variables][Global variables]] +- [[#abbreviations][Abbreviations]] + - [[#system-monitoring][System monitoring]] + - [[#system-management-packages-and-services][System management (packages and services)]] + - [[#package-mangaement][Package mangaement]] + - [[#service-management][Service management]] + - [[#development][Development]] + - [[#cmake][CMake]] + - [[#compilation][Compilation]] + - [[#docker][Docker]] + - [[#git][Git]] + - [[#prolog][Prolog]] + - [[#text-editors][Text editors]] + - [[#latex][LaTeX]] + - [[#some-security-measures][Some security measures]] + - [[#typos][Typos]] + - [[#misc][Misc]] + - [[#sudo][Sudo]] + - [[#exit][Exit]] + - [[#history][History]] + - [[#song-download-from-youtube][Song download from YouTube]] + - [[#mpv][MPV]] + - [[#compression][Compression]] + - [[#feh][Feh]] + - [[#ls][ls]] + - [[#networkmanager][NetworkManager]] + - [[#wget][Wget]] * Presentation :PROPERTIES: @@ -90,461 +90,466 @@ end #+END_SRC -** Fish from within Emacs +* Fish from within Emacs + :PROPERTIES: + :CUSTOM_ID: h-97d738f4-1ea0-4f64-a31d-19643486a951 + :HEADER-ARGS: :tangle config.fish :exports code + :END: + I sometimes call fish from within emacs, with =M-x ansi-term=. In this case, + the variable =TERM= needs to have the value =eterm-color=. + #+BEGIN_SRC fish + if test -n "$EMACS" + set -x TERM eterm-color + end + #+END_SRC + +* Tramp remote access + :PROPERTIES: + :CUSTOM_ID: h-6cad2cc9-aef6-4df4-90f9-97053e82072a + :HEADER-ARGS: :tangle config.fish :exports code + :END: + When accessing from a remote machine our computer from Emacs, tramp needs a + precise shell appearance: a simple =$= followed by a space after which to put + the commands it needs to execute, and nothing else. Due to this, let’s + deactivate and redefine some of the functions defining the appearance of + fish. + #+BEGIN_SRC fish + if test "$TERM" = "dumb" + function fish_prompt + echo "\$ " + end + function fish_right_prompt; end + function fish_greeting; end + function fish_title; end + end + #+END_SRC + +* Regular fish shell appearance + :PROPERTIES: + :CUSTOM_ID: h-a8434b29-c146-4141-b8f8-1b446c791907 + :HEADER-ARGS: :tangle config.fish :exports code + :END: + Now, there is only one function I modify when it comes to the appearance of + fish when I’m the one using it: I simply “delete” the =fish_greeting= + function. + #+BEGIN_SRC fish + function fish_greeting; end + #+END_SRC + +* Global variables + :PROPERTIES: + :CUSTOM_ID: h-0eff37da-af9f-4546-8ad3-201961a2200f + :HEADER-ARGS: :tangle config.fish :exports code + :END: + Some global variables might sometimes be needed and need to be modified. This + is for example the case with my =PATH= variable in which I add Rust’s Cargo’s + binaries, Go’s binaries and my own executables. And of course, don’t forget + to add the already existing =PATH=. + #+BEGIN_SRC fish + set -gx PATH $HOME/.local/bin $HOME/go/bin $HOME/.cargo/bin $PATH + #+END_SRC + + Sometimes, software will rely on =SUDO_ASKPASS= to get a GUI from which it + can get the sudo password. So, let’s declare it. + #+BEGIN_SRC fish + set -gx SUDO_ASKPASS ~/.local/bin/askpass + #+END_SRC + + Now, let’s declare our editor of choice, EmacsClient. Now, we want it to run + in the terminal, since it will most often be just quick edits, nothing too + heavy, if it is called from the =EDITOR= variable (from Git, for example). + #+BEGIN_SRC fish + set -gx EDITOR emacsclient -c -nw + #+END_SRC + + Finally, some development packages require the =PKG_CONFIG_PATH= to be set, + so let’s do so. + #+BEGIN_SRC fish + set -gx PKG_CONFIG_PATH /usr/local/lib/pkgconfig/ $PKG_CONFIG_PATH + #+END_SRC + +* Abbreviations + :PROPERTIES: + :CUSTOM_ID: h-740bd904-3e32-4c09-b0a4-bde16ae2e116 + :HEADER-ARGS: :tangle config.fish :exports code + :END: +** System monitoring :PROPERTIES: - :CUSTOM_ID: h-97d738f4-1ea0-4f64-a31d-19643486a951 + :CUSTOM_ID: h-ec910a8c-9154-48a4-b4cd-df28cb4e54d9 :END: - I sometimes call fish from within emacs, with =M-x ansi-term=. In this case, - the variable =TERM= needs to have the value =eterm-color=. + Here I have some abbreviations which are quite useful when performing some + system monitoring. With =df=, we can get an overview of our filesystem + usage, while with =diskspace= we get some more precise information. #+BEGIN_SRC fish - if test -n "$EMACS" - set -x TERM eterm-color - end + abbr df 'df -H' + abbr diskspace 'sudo df -h | grep -E "sd|lv|Size"' #+END_SRC -** Tramp remote access + =meminfo= is a call to =free= with sane defaults. + #+BEGIN_SRC fish + abbr meminfo 'free -m -l -t' + #+END_SRC + + Similar to =meminfo=, we also have =gpumeminfo= so we can get a quick look + at the memory-related logs of our X session. + #+BEGIN_SRC fish + abbr gpumeminfo 'grep -i --color memory /var/log/Xorg.0.log' + #+END_SRC + + I also declared =cpuinfo= an alias of =lscpu= in order to keep consistent + with =meminfo=. + #+BEGIN_SRC fish + abbr cpuinfo lscpu + #+END_SRC + + =pscpu= gives us information on what the CPU is running right now, and + =pscpu10= limits that to the top 10 threads. + #+BEGIN_SRC fish + abbr pscpu 'ps auxf | sort -nr -k 3' + abbr pscpu10 'ps auxf | sort -nr -k 3 | head -10' + #+END_SRC + + Similarly, =psmem= gives us information on the memory usage of the current + threads, and =psmem10= only the ten most important threads in terms of + memory usage. + #+BEGIN_SRC fish + abbr psmem 'ps auxf | sort -nr -k 4' + abbr psmem10 'ps auxf | sort -nr -k 4 | head -10' + #+END_SRC + +** System management (packages and services) :PROPERTIES: - :CUSTOM_ID: h-6cad2cc9-aef6-4df4-90f9-97053e82072a + :CUSTOM_ID: h-78ac23f0-960d-4f56-9cba-64413fd61885 :END: - When accessing from a remote machine our computer from Emacs, tramp needs a - precise shell appearance: a simple =$= followed by a space after which to put - the commands it needs to execute, and nothing else. Due to this, let’s - deactivate and redefine some of the functions defining the appearance of - fish. - #+BEGIN_SRC fish - if test "$TERM" = "dumb" - function fish_prompt - echo "\$ " - end - function fish_right_prompt; end - function fish_greeting; end - function fish_title; end - end - #+END_SRC + I added some of these abbreviations due to how often I have to write the + whole thing. -** Regular fish shell appearance +*** Package mangaement + :PROPERTIES: + :CUSTOM_ID: h-281a59aa-4ea0-47ab-a4cc-33fff8d38165 + :END: + The first command is =remove= which removes a package from my system, as + well as its dependencies no longer needed. + #+BEGIN_SRC fish + abbr remove 'sudo pacman -Rscnd' + #+END_SRC + + And if I want to install something, I just have to type =install=. + #+BEGIN_SRC fish + abbr install 'sudo pacman -Sy' + #+END_SRC + + But if I just want to run =pacman= as sudo, then I could always just type + =p=. + #+BEGIN_SRC fish + abbr p 'sudo -A pacman' + #+END_SRC + + Sometimes, I just want to purge my package manager’s cache, be it + =pacman='s or =yay='s. This is why I simply type =purge=. + #+BEGIN_SRC fish + abbr purge 'yay -Sc' + #+END_SRC + + And if I want to simply seach among the =pacman= repos, I can type + =search=. Otherwise, if I want to include AUR results, I’ll use =yay=. + #+BEGIN_SRC fish + abbr search 'pacman -Ss' + #+END_SRC + + To update everything from the official repos, I’ll sometimes type =update= + instead of the full command. + #+BEGIN_SRC fish + abbr update 'sudo pacman -Syu' + #+END_SRC + +*** Service management + :PROPERTIES: + :CUSTOM_ID: h-3a734119-ccee-4cdf-b04c-d55a37dea571 + :END: + I don’t have the muscle memory of =systemctl=. So instead, I simply type + =c= when I want to do something user service related. + #+BEGIN_SRC fish + abbr s 'systemctl --user' + #+END_SRC + + And if I want to manipulate system services, I can instead type a simple + capital =S=. + #+BEGIN_SRC fish + abbr S 'sudo systemctl' + #+END_SRC + +** Development :PROPERTIES: - :CUSTOM_ID: h-a8434b29-c146-4141-b8f8-1b446c791907 + :CUSTOM_ID: h-32ae38a2-41ad-438e-b619-220a63166115 :END: - Now, there is only one function I modify when it comes to the appearance of - fish when I’m the one using it: I simply “delete” the =fish_greeting= - function. - #+BEGIN_SRC fish - function fish_greeting; end - #+END_SRC + A good amount of these commands are development related, especially when it + comes to compilation or Docker. -** Global variables +*** CMake + :PROPERTIES: + :CUSTOM_ID: h-887c87aa-b100-4b27-9006-778fd7e3329c + :END: + I have the following abbreviations so I can quickly run CMake and create a + configuration for debug or release profiles. + #+BEGIN_SRC fish + abbr cdebug 'cmake -DCMAKE_BUILD_TYPE=Debug' + abbr crelease 'cmake -DCMAKE_BUILD_TYPE=Release' + #+END_SRC + +*** Compilation + :PROPERTIES: + :CUSTOM_ID: h-0beb47e5-d76a-4037-8f58-e8de141e3761 + :END: + By default, I set =clang=, =clang++=, =gcc= and =g++= to the latest + standard and with the =-Wall= flag activated. + #+BEGIN_SRC fish :tangle + abbr clang 'clang -Wall' + abbr clang++ 'clang++ -Wall' + abbr g++ 'g++ -Wall -std=c++17' + abbr gcc 'gcc -Wall -std=c18' + #+END_SRC + +*** Docker + :PROPERTIES: + :CUSTOM_ID: h-91c7ff90-7b43-4802-be69-5d102281c6d3 + :END: + And of course, when it comes to Docker Compose, I don’t have time to write + the full command, so I use these instead. + #+BEGIN_SRC fish + abbr dc docker-compose + abbr dcd 'docker-compose down' + abbr dcr 'docker-compose run --rm' + abbr dcu 'docker-compose up' + abbr dcub 'docker-compose up --build' + #+END_SRC + +*** Git + :PROPERTIES: + :CUSTOM_ID: h-e72347d4-590e-448c-bc33-0a70fa8ab35b + :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. + #+BEGIN_SRC fish :tangle + abbr randcommit 'git commit -m (curl -s whatthecommit.com/index.txt)' + #+END_SRC + +*** Prolog + :PROPERTIES: + :CUSTOM_ID: h-cbb6c31e-faaa-48c3-a83a-d1f143fdcb8d + :END: + When I launch =swipl=, I prefer to have my terminal cleaned before and + after it runs, I find it more clean. + #+BEGIN_SRC fish + abbr swipl 'clear && swipl -q && clear' + #+END_SRC + +*** Text editors + :PROPERTIES: + :CUSTOM_ID: h-51155e06-872d-4a12-9bf7-ae5eabc256ad + :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 + a new instance of it. + #+BEGIN_SRC fish + abbr e 'emacsclient -c' + #+END_SRC + 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). + #+BEGIN_SRC fish + abbr enw 'emacsclient -c -nw' + #+END_SRC + + I also have the abbreviation =vi= which refers to =vim=. I really should + learn =vi=, but I also really don’t feel like it. + #+BEGIN_SRC fish + abbr vi vim + #+END_SRC + +** LaTeX :PROPERTIES: - :CUSTOM_ID: h-0eff37da-af9f-4546-8ad3-201961a2200f + :CUSTOM_ID: h-a8f8a707-90d7-4784-982d-d959b183148e :END: - Some global variables might sometimes be needed and need to be modified. This - is for example the case with my =PATH= variable in which I add Rust’s Cargo’s - binaries, Go’s binaries and my own executables. And of course, don’t forget - to add the already existing =PATH=. + 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=, + but I can never remember the command, and the latter is faster to type, so + time for an abbreviation. #+BEGIN_SRC fish - set -gx PATH $HOME/.local/bin $HOME/go/bin $HOME/.cargo/bin $PATH + abbr tlmgr tllocalmgr #+END_SRC - Sometimes, software will rely on =SUDO_ASKPASS= to get a GUI from which it - can get the sudo password. So, let’s declare it. #+BEGIN_SRC fish - set -gx SUDO_ASKPASS ~/.local/bin/askpass + abbr texhash 'sudo texhash' #+END_SRC - Now, let’s declare our editor of choice, EmacsClient. Now, we want it to run - in the terminal, since it will most often be just quick edits, nothing too - heavy, if it is called from the =EDITOR= variable (from Git, for example). - #+BEGIN_SRC fish - set -gx EDITOR emacsclient -c -nw - #+END_SRC - - Finally, some development packages require the =PKG_CONFIG_PATH= to be set, - so let’s do so. - #+BEGIN_SRC fish - set -gx PKG_CONFIG_PATH /usr/local/lib/pkgconfig/ $PKG_CONFIG_PATH - #+END_SRC - -** Abbreviations +** Some security measures :PROPERTIES: - :CUSTOM_ID: h-740bd904-3e32-4c09-b0a4-bde16ae2e116 + :CUSTOM_ID: h-dd97ea71-c43f-4b79-8bb7-1f857284b1b4 :END: -*** System monitoring + Some commands can be quite dangerous when not used properly, which is why I + added default flags and options so I can get warnings before things get + ugly. + #+BEGIN_SRC fish + abbr cp 'cp -i' + abbr ln 'ln -i' + abbr lns 'ln -si' + abbr mv 'mv -i' + abbr rm 'rm -I' + abbr rmd 'rm --preserve-root -Ir' + abbr rmdf 'rm --preserve-root -Irf' + abbr rmf 'rm --preserve-root -If' + #+END_SRC + The =-i= and =-I= add prompts in case we might not want to do what we asked + the shell to do. Notice =lns= which creates symlinks, =rmd= which removes + directories, =rmf= which forces deletion, and =rmdf= which forces the + delition of a directory. Notice also the =--preserve-root= which will + prevent me from accidentally removing the root folder. I added the same + option to =chgrp=, =chmod=, and =chown=. + #+BEGIN_SRC fish + abbr chgrp 'chgrp --preserve-root' + abbr chmod 'chmod --preserve-root' + abbr chown 'chown --preserve-root' + #+END_SRC + +** Typos + :PROPERTIES: + :CUSTOM_ID: h-4c5a03cd-20a8-437e-87b7-af990780084e + :END: + 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. + #+BEGIN_SRC fish + abbr clean clear + #+END_SRC + + I’m also very bad at typing =exit=. + #+BEGIN_SRC fish + abbr exi exit + abbr exti exit + #+END_SRC + + And sometimes I suck at typing =htop=. + #+BEGIN_SRC fish + abbr hotp htop + #+END_SRC + +** Misc + :PROPERTIES: + :CUSTOM_ID: h-3a237ec0-c535-42c7-9c60-3d083745b643 + :END: + Finally, some miscellaneous abbreviations that don’t really fit into any of + the above categories. + +*** Sudo :PROPERTIES: - :CUSTOM_ID: h-ec910a8c-9154-48a4-b4cd-df28cb4e54d9 + :CUSTOM_ID: h-0955e2fc-ec25-41b6-814a-929fa3718dda :END: - Here I have some abbreviations which are quite useful when performing some - system monitoring. With =df=, we can get an overview of our filesystem - usage, while with =diskspace= we get some more precise information. + 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. #+BEGIN_SRC fish - abbr df 'df -H' - abbr diskspace 'sudo df -h | grep -E "sd|lv|Size"' + abbr sudo 'sudo -A' + abbr please 'sudo -A' #+END_SRC - =meminfo= is a call to =free= with sane defaults. - #+BEGIN_SRC fish - abbr meminfo 'free -m -l -t' - #+END_SRC - - Similar to =meminfo=, we also have =gpumeminfo= so we can get a quick look - at the memory-related logs of our X session. - #+BEGIN_SRC fish - abbr gpumeminfo 'grep -i --color memory /var/log/Xorg.0.log' - #+END_SRC - - I also declared =cpuinfo= an alias of =lscpu= in order to keep consistent - with =meminfo=. - #+BEGIN_SRC fish - abbr cpuinfo lscpu - #+END_SRC - - =pscpu= gives us information on what the CPU is running right now, and - =pscpu10= limits that to the top 10 threads. - #+BEGIN_SRC fish - abbr pscpu 'ps auxf | sort -nr -k 3' - abbr pscpu10 'ps auxf | sort -nr -k 3 | head -10' - #+END_SRC - - Similarly, =psmem= gives us information on the memory usage of the current - threads, and =psmem10= only the ten most important threads in terms of - memory usage. - #+BEGIN_SRC fish - abbr psmem 'ps auxf | sort -nr -k 4' - abbr psmem10 'ps auxf | sort -nr -k 4 | head -10' - #+END_SRC - -*** System management (packages and services) +*** Exit :PROPERTIES: - :CUSTOM_ID: h-78ac23f0-960d-4f56-9cba-64413fd61885 + :CUSTOM_ID: h-8cf0e895-b919-41a8-ad3d-c5294dc507fd :END: - I added some of these abbreviations due to how often I have to write the - whole thing. + Sometimes I find it easier to just type =q= instead of =exit=. + #+BEGIN_SRC fish + abbr q exit + #+END_SRC -**** Package mangaement - :PROPERTIES: - :CUSTOM_ID: h-281a59aa-4ea0-47ab-a4cc-33fff8d38165 - :END: - The first command is =remove= which removes a package from my system, as - well as its dependencies no longer needed. - #+BEGIN_SRC fish - abbr remove 'sudo pacman -Rscnd' - #+END_SRC - - And if I want to install something, I just have to type =install=. - #+BEGIN_SRC fish - abbr install 'sudo pacman -Sy' - #+END_SRC - - But if I just want to run =pacman= as sudo, then I could always just type - =p=. - #+BEGIN_SRC fish - abbr p 'sudo -A pacman' - #+END_SRC - - Sometimes, I just want to purge my package manager’s cache, be it - =pacman='s or =yay='s. This is why I simply type =purge=. - #+BEGIN_SRC fish - abbr purge 'yay -Sc' - #+END_SRC - - And if I want to simply seach among the =pacman= repos, I can type - =search=. Otherwise, if I want to include AUR results, I’ll use =yay=. - #+BEGIN_SRC fish - abbr search 'pacman -Ss' - #+END_SRC - - To update everything from the official repos, I’ll sometimes type =update= - instead of the full command. - #+BEGIN_SRC fish - abbr update 'sudo pacman -Syu' - #+END_SRC - -**** Service management - :PROPERTIES: - :CUSTOM_ID: h-3a734119-ccee-4cdf-b04c-d55a37dea571 - :END: - I don’t have the muscle memory of =systemctl=. So instead, I simply type - =c= when I want to do something user service related. - #+BEGIN_SRC fish - abbr s 'systemctl --user' - #+END_SRC - - And if I want to manipulate system services, I can instead type a simple - capital =S=. - #+BEGIN_SRC fish - abbr S 'sudo systemctl' - #+END_SRC - -*** Development +*** History :PROPERTIES: - :CUSTOM_ID: h-32ae38a2-41ad-438e-b619-220a63166115 + :CUSTOM_ID: h-162052c5-63c4-435a-b973-422346522c69 :END: - A good amount of these commands are development related, especially when it - comes to compilation or Docker. + 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 -**** CMake - :PROPERTIES: - :CUSTOM_ID: h-887c87aa-b100-4b27-9006-778fd7e3329c - :END: - I have the following abbreviations so I can quickly run CMake and create a - configuration for debug or release profiles. - #+BEGIN_SRC fish - abbr cdebug 'cmake -DCMAKE_BUILD_TYPE=Debug' - abbr crelease 'cmake -DCMAKE_BUILD_TYPE=Release' - #+END_SRC - -**** Compilation - :PROPERTIES: - :CUSTOM_ID: h-0beb47e5-d76a-4037-8f58-e8de141e3761 - :END: - By default, I set =clang=, =clang++=, =gcc= and =g++= to the latest - standard and with the =-Wall= flag activated. - #+BEGIN_SRC fish :tangle - abbr clang 'clang -Wall' - abbr clang++ 'clang++ -Wall' - abbr g++ 'g++ -Wall -std=c++17' - abbr gcc 'gcc -Wall -std=c18' - #+END_SRC - -**** Docker - :PROPERTIES: - :CUSTOM_ID: h-91c7ff90-7b43-4802-be69-5d102281c6d3 - :END: - And of course, when it comes to Docker Compose, I don’t have time to write - the full command, so I use these instead. - #+BEGIN_SRC fish - abbr dc docker-compose - abbr dcd 'docker-compose down' - abbr dcr 'docker-compose run --rm' - abbr dcu 'docker-compose up' - abbr dcub 'docker-compose up --build' - #+END_SRC - -**** Git - :PROPERTIES: - :CUSTOM_ID: h-e72347d4-590e-448c-bc33-0a70fa8ab35b - :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. - #+BEGIN_SRC fish :tangle - abbr randcommit 'git commit -m (curl -s whatthecommit.com/index.txt)' - #+END_SRC - -**** Prolog - :PROPERTIES: - :CUSTOM_ID: h-cbb6c31e-faaa-48c3-a83a-d1f143fdcb8d - :END: - When I launch =swipl=, I prefer to have my terminal cleaned before and - after it runs, I find it more clean. - #+BEGIN_SRC fish - abbr swipl 'clear && swipl -q && clear' - #+END_SRC - -**** Text editors - :PROPERTIES: - :CUSTOM_ID: h-51155e06-872d-4a12-9bf7-ae5eabc256ad - :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 - a new instance of it. - #+BEGIN_SRC fish - abbr e 'emacsclient -c' - #+END_SRC - 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). - #+BEGIN_SRC fish - abbr enw 'emacsclient -c -nw' - #+END_SRC - - I also have the abbreviation =vi= which refers to =vim=. I really should - learn =vi=, but I also really don’t feel like it. - #+BEGIN_SRC fish - abbr vi vim - #+END_SRC - -*** LaTeX +*** Song download from YouTube :PROPERTIES: - :CUSTOM_ID: h-a8f8a707-90d7-4784-982d-d959b183148e + :CUSTOM_ID: h-4bc663a9-b609-4c86-9a4d-a220013c67f9 :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=, - but I can never remember the command, and the latter is faster to type, so - time for an abbreviation. + 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 tlmgr tllocalmgr + abbr flac 'youtube-dl -x --audio-format flac --audio-quality 0' #+END_SRC - #+BEGIN_SRC fish - abbr texhash 'sudo texhash' - #+END_SRC - -*** Some security measures +*** MPV :PROPERTIES: - :CUSTOM_ID: h-dd97ea71-c43f-4b79-8bb7-1f857284b1b4 + :CUSTOM_ID: h-3fd5a7eb-4ed4-4b0b-87ca-28f36fb22793 :END: - Some commands can be quite dangerous when not used properly, which is why I - added default flags and options so I can get warnings before things get - ugly. + 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. #+BEGIN_SRC fish - abbr cp 'cp -i' - abbr ln 'ln -i' - abbr lns 'ln -si' - abbr mv 'mv -i' - abbr rm 'rm -I' - abbr rmd 'rm --preserve-root -Ir' - abbr rmdf 'rm --preserve-root -Irf' - abbr rmf 'rm --preserve-root -If' - #+END_SRC - The =-i= and =-I= add prompts in case we might not want to do what we asked - the shell to do. Notice =lns= which creates symlinks, =rmd= which removes - directories, =rmf= which forces deletion, and =rmdf= which forces the - delition of a directory. Notice also the =--preserve-root= which will - prevent me from accidentally removing the root folder. I added the same - option to =chgrp=, =chmod=, and =chown=. - #+BEGIN_SRC fish - abbr chgrp 'chgrp --preserve-root' - abbr chmod 'chmod --preserve-root' - abbr chown 'chown --preserve-root' + abbr mpv 'mpv --no-border --force-window=no' #+END_SRC -*** Typos +*** Compression :PROPERTIES: - :CUSTOM_ID: h-4c5a03cd-20a8-437e-87b7-af990780084e + :CUSTOM_ID: h-05919be3-360a-45c6-8c89-76836375d55b :END: - 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. + 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 + [[#h-281a59aa-4ea0-47ab-a4cc-33fff8d38165][Package management]]). #+BEGIN_SRC fish - abbr clean clear + abbr compress 'tar -czf' + abbr untar 'tar -xvzf' #+END_SRC - I’m also very bad at typing =exit=. - #+BEGIN_SRC fish - abbr exi exit - abbr exti exit - #+END_SRC - - And sometimes I suck at typing =htop=. - #+BEGIN_SRC fish - abbr hotp htop - #+END_SRC - -*** Misc +*** Feh :PROPERTIES: - :CUSTOM_ID: h-3a237ec0-c535-42c7-9c60-3d083745b643 + :CUSTOM_ID: h-41cfc583-14ba-4f15-9578-bc37b432a3ce :END: - Finally, some miscellaneous abbreviations that don’t really fit into any of - the above categories. + Some sane default options for =feh=, including auto-zoom to fit the picture + to the window, a borderless window, and again scale the image to fit the + window geometry. + #+BEGIN_SRC fish + abbr feh 'feh -Zx.' + #+END_SRC -**** Sudo - :PROPERTIES: - :CUSTOM_ID: h-0955e2fc-ec25-41b6-814a-929fa3718dda - :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. - #+BEGIN_SRC fish - abbr sudo 'sudo -A' - abbr please 'sudo -A' - #+END_SRC +*** ls + :PROPERTIES: + :CUSTOM_ID: h-9980009d-3fc4-4e2e-861b-1af007212f8d + :END: + Yep, an abbreviation of =ls= called =lsl=. It allows me to view all the + files in a directory as a list with detailed, human-readable information. + #+BEGIN_SRC fish + abbr lsl 'ls -ahl' + #+END_SRC -**** Exit - :PROPERTIES: - :CUSTOM_ID: h-8cf0e895-b919-41a8-ad3d-c5294dc507fd - :END: - Sometimes I find it easier to just type =q= instead of =exit=. - #+BEGIN_SRC fish - abbr q exit - #+END_SRC +*** NetworkManager + :PROPERTIES: + :CUSTOM_ID: h-5f9d4866-3086-4ed9-9ff3-d80a0af36593 + :END: + This is just =nmcli= with sane default options, that is a pretty output + with colors. + #+BEGIN_SRC fish + abbr nmcli 'nmcli -p -c auto' + #+END_SRC -**** History - :PROPERTIES: - :CUSTOM_ID: h-162052c5-63c4-435a-b973-422346522c69 - :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 - -**** Song download from YouTube - :PROPERTIES: - :CUSTOM_ID: h-4bc663a9-b609-4c86-9a4d-a220013c67f9 - :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' - #+END_SRC - -**** MPV - :PROPERTIES: - :CUSTOM_ID: h-3fd5a7eb-4ed4-4b0b-87ca-28f36fb22793 - :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. - #+BEGIN_SRC fish - abbr mpv 'mpv --no-border --force-window=no' - #+END_SRC - -**** Compression - :PROPERTIES: - :CUSTOM_ID: h-05919be3-360a-45c6-8c89-76836375d55b - :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 - [[#h-281a59aa-4ea0-47ab-a4cc-33fff8d38165][Package management]]). - #+BEGIN_SRC fish - abbr compress 'tar -czf' - abbr untar 'tar -xvzf' - #+END_SRC - -**** Feh - :PROPERTIES: - :CUSTOM_ID: h-41cfc583-14ba-4f15-9578-bc37b432a3ce - :END: - Some sane default options for =feh=, including auto-zoom to fit the picture - to the window, a borderless window, and again scale the image to fit the - window geometry. - #+BEGIN_SRC fish - abbr feh 'feh -Zx.' - #+END_SRC - -**** ls - :PROPERTIES: - :CUSTOM_ID: h-9980009d-3fc4-4e2e-861b-1af007212f8d - :END: - Yep, an abbreviation of =ls= called =lsl=. It allows me to view all the - files in a directory as a list with detailed, human-readable information. - #+BEGIN_SRC fish - abbr lsl 'ls -ahl' - #+END_SRC - -**** NetworkManager - :PROPERTIES: - :CUSTOM_ID: h-5f9d4866-3086-4ed9-9ff3-d80a0af36593 - :END: - This is just =nmcli= with sane default options, that is a pretty output - with colors. - #+BEGIN_SRC fish - abbr nmcli 'nmcli -p -c auto' - #+END_SRC - -**** Wget - :PROPERTIES: - :CUSTOM_ID: h-74f84f1c-433d-488a-88a7-89915c1a3bd5 - :END: - By default, continue a download that was interupted. - #+BEGIN_SRC fish - abbr wget 'wget -c' - #+END_SRC +*** Wget + :PROPERTIES: + :CUSTOM_ID: h-74f84f1c-433d-488a-88a7-89915c1a3bd5 + :END: + By default, continue a download that was interupted. + #+BEGIN_SRC fish + abbr wget 'wget -c' + #+END_SRC