config.phundrak.com/org/config/fish.org

647 lines
23 KiB
Org Mode
Raw Normal View History

# -*- org-confirm-babel-evaluate: nil -*-
#+TITLE: Phundraks fish config
2020-01-30 00:52:02 +00:00
#+INCLUDE: headers.org
#+OPTIONS: auto-id:t
2019-10-23 11:02:59 +00:00
#+HTML_HEAD_EXTRA: <meta name="description" content="Phundrak's fish config" />
#+HTML_HEAD_EXTRA: <meta property="og:title" content="Phundrak's fish config" />
#+HTML_HEAD_EXTRA: <meta property="og:description" content="Description of the fish config file of Phundrak" />
#+PROPERTY: header-args:fish :tangle ~/.config/fish/config.fish :exports code :noweb yes
#+PROPERTY: header-args :exports code :tangle no
2019-10-23 11:02:59 +00:00
2020-01-25 01:27:21 +00:00
* Table of Contents :TOC:noexport:
2019-10-23 11:02:59 +00:00
:PROPERTIES:
:CUSTOM_ID: h-c7ab05d0-4c5f-4a4c-8603-4c79e264141c
:END:
- [[#presentation][Presentation]]
2019-10-23 13:25:35 +00:00
- [[#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]]
- [[#theme-customization][Theme customization]]
2019-10-23 13:25:35 +00:00
- [[#abbreviations][Abbreviations]]
- [[#system-monitoring][System monitoring]]
- [[#system-management-packages-and-services][System management (packages and services)]]
- [[#package-management][Package management]]
2019-10-23 13:25:35 +00:00
- [[#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]]
- [[#youtube-dl-related-commands][~youtube-dl~ related commands]]
- [[#song-download-from-youtube][Song download from YouTube]]
- [[#videos-download-from-youtube][Videos download from YouTube]]
2019-10-23 13:25:35 +00:00
- [[#mpv][MPV]]
- [[#compression][Compression]]
- [[#feh][Feh]]
- [[#network-management][Network Management]]
- [[#nordvpn][NordVPN]]
2019-10-23 13:25:35 +00:00
- [[#wget][Wget]]
2019-10-23 11:02:59 +00:00
* Presentation
:PROPERTIES:
:CUSTOM_ID: h-c2560b46-7f97-472f-b898-5ab483832228
:END:
The file present in =~/.config/fish/config.fish= is the configuration file for
the [[https://fishshell.com/][fish shell]]. It contains custom functions, environment variables and
abbreviations.
Just in case, we might need sometimes to declare the fish function
=fish_title= as =true=, so lets do so.
#+BEGIN_SRC fish
function fish_title
true
end
#+END_SRC
2019-10-23 13:25:35 +00:00
* Fish from within Emacs
:PROPERTIES:
:CUSTOM_ID: h-97d738f4-1ea0-4f64-a31d-19643486a951
: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
: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, lets
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
:END:
Now, there is only one function I modify when it comes to the appearance of
fish when Im 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
: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 Rusts Cargos
binaries, Gos binaries and my own executables. And of course, dont forget
to add the already existing =PATH=.
#+NAME: extra-paths
| additional path | what it leads to |
|---------------------------+--------------------------------------|
| $HOME/.pub-cache/bin | Dart binaries and executables |
| $HOME/.local/bin | Custom executables, see [[file:bin.org]] |
| $HOME/go/bin | Go binaries and executables |
| $HOME/.cargo/bin | Rust binaries and executables |
| $HOME/.gem/ruby/2.6.0/bin | Ruby binaries and executables |
#+NAME: generate-extra-paths
#+BEGIN_SRC python :var paths=extra-paths :exports none :cache yes
results = ''
for path in paths:
results += "{0} ".format(path[0])
return results.strip()
#+END_SRC
#+RESULTS[36e9cabf867423f29b621d8dac765fad154bd2b1]: generate-extra-paths
: $HOME/.pub-cache/bin $HOME/.local/bin $HOME/go/bin $HOME/.cargo/bin $HOME/.gem/ruby/2.6.0/bin
#+BEGIN_SRC fish :noweb yes
set -gx PATH <<generate-extra-paths()>> $PATH
2019-10-23 13:25:35 +00:00
#+END_SRC
Sometimes, software will rely on =SUDO_ASKPASS= to get a GUI from which it
can get the sudo password. So, lets declare it.
#+BEGIN_SRC fish
set -gx SUDO_ASKPASS ~/.local/bin/askpass
#+END_SRC
Now, lets 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).
2019-10-23 13:25:35 +00:00
#+BEGIN_SRC fish
set -gx EDITOR emacsclient -c
2019-10-23 13:25:35 +00:00
#+END_SRC
2019-10-23 11:02:59 +00:00
We also need to set the path to the Dart SDK.
#+BEGIN_SRC fish
set -gx DART_SDK /opt/dart-sdk/bin
#+END_SRC
And we also need to specify where the Android SDK it located.
#+BEGIN_SRC fish
set -gx ANDROID_HOME $HOME/Android/Sdk
#+END_SRC
2019-10-23 13:25:35 +00:00
Finally, some development packages require the =PKG_CONFIG_PATH= to be set,
so lets do so.
#+BEGIN_SRC fish
set -gx PKG_CONFIG_PATH /usr/local/lib/pkgconfig/ $PKG_CONFIG_PATH
#+END_SRC
* Theme customization
:PROPERTIES:
:CUSTOM_ID: h-e9dccb31-8350-459d-b688-b5b7cbeab272
:END:
The theme I use is =bobthefish=. Although its default configuration is quite
alright, it allows some customization. The first thing I want to enable is the
support for =nerd-fonts=:
#+BEGIN_SRC fish
set -g theme_nerd_fonts_support yes
#+END_SRC
Next, I want the name of the current process to be shown in the terminal
title.
#+BEGIN_SRC fish
set -g theme_title_display_process yes
#+END_SRC
I also wish to display the current host in the prompt, but only when I am
connected through an SSH session.
#+BEGIN_SRC fish
set -g theme_display_hostname ssh
#+END_SRC
I also want the sudo username to be displayed, as a warning that I am indeed
running a session as root.
#+BEGIN_SRC fish
set -g theme_display_sudo_user yes
#+END_SRC
The exit status can be sometimes really useful, hence why I want it activated.
#+BEGIN_SRC fish
set -g theme_show_exit_status yes
#+END_SRC
I also want to have proper git worktree support.
#+BEGIN_SRC fish
set -g theme_git_worktree_support yes
#+END_SRC
2019-10-23 13:25:35 +00:00
* Abbreviations
:PROPERTIES:
:CUSTOM_ID: h-740bd904-3e32-4c09-b0a4-bde16ae2e116
:END:
#+NAME: generate-abbr
#+BEGIN_SRC python :var table=[] :exports none
result = ''
for abbr in table:
2020-02-24 20:44:38 +00:00
result += "abbr {0} '{1}'\n".format(abbr[0], abbr[1])
return result.replace("\\vert{}", "|").replace("\\vert", "|")
#+END_SRC
2019-10-23 13:25:35 +00:00
** System monitoring
2019-10-23 11:02:59 +00:00
:PROPERTIES:
2019-10-23 13:25:35 +00:00
:CUSTOM_ID: h-ec910a8c-9154-48a4-b4cd-df28cb4e54d9
2019-10-23 11:02:59 +00:00
: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. =meminfo= is a
call to =free= with sane defaults, and similar to =meminfo=, we also have
=gpumeminfo= so we can get a quick look at the memory-related logs of our X
session. I also declared =cpuinfo= an alias of =lscpu= in order to keep
consistent with =meminfo=. =pscpu= gives us information on what the CPU is
running right now, and =pscpu10= limits that to the top 10 threads.
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.
#+NAME: mgmt-abbr
| abbreviation | command |
|--------------+---------------------------------------------------|
| df | df -H |
| diskspace | sudo df -h \vert grep -E "sd\vert{}lv\vert{}Size" |
| meminfo | free -m -l -t |
| gpumeminfo | grep -i --color memory /var/log/Xorg.0.log |
| cpuinfo | lscpu |
| pscpu | ps auxf \vert sort -nr -k 3 |
| pscpu10 | ps auxf \vert sort -nr -k 3 \vert head -10 |
| psmem | ps auxf \vert sort -nr -k 4 |
| psmem10 | ps auxf \vert sort -nr -k 4 \vert head -10 |
#+begin_SRC fish
<<generate-abbr(table=mgmt-abbr)>>
2019-10-23 11:02:59 +00:00
#+END_SRC
2019-10-23 13:25:35 +00:00
** System management (packages and services)
2019-10-23 11:02:59 +00:00
:PROPERTIES:
2019-10-23 13:25:35 +00:00
:CUSTOM_ID: h-78ac23f0-960d-4f56-9cba-64413fd61885
2019-10-23 11:02:59 +00:00
:END:
2019-10-23 13:25:35 +00:00
I added some of these abbreviations due to how often I have to write the
whole thing.
*** Package management
2019-10-23 11:02:59 +00:00
:PROPERTIES:
2019-10-23 13:25:35 +00:00
:CUSTOM_ID: h-281a59aa-4ea0-47ab-a4cc-33fff8d38165
2019-10-23 11:02:59 +00:00
:END:
The first command is =remove= which removes a package from my system, as
well as its dependencies no longer needed. =p=. =pacman='s or =yay='s. This
is why I simply type =purge=. And if I want to simply seach among the
=pacman= repos, I can type =search=. Otherwise, if I want to include AUR
results, Ill use =yay=.
#+NAME: pm-abbr
| abbreviation | command |
|--------------+--------------------|
| remove | sudo pacman -Rscnd |
| p | sudo pacman |
| purge | yay -Sc |
| search | yay -Ss |
2019-10-23 11:02:59 +00:00
#+BEGIN_SRC fish
<<generate-abbr(table=pm-abbr)>>
2019-10-23 13:25:35 +00:00
#+END_SRC
*** Service management
:PROPERTIES:
:CUSTOM_ID: h-3a734119-ccee-4cdf-b04c-d55a37dea571
:END:
I dont have the muscle memory of =systemctl=. So instead, I simply type
=c= when I want to do something user service related.
And if I want to manipulate system services, I can instead type a simple
capital =S=.
#+NAME: service-abbr
| abbreviation | command |
|--------------+------------------|
| s | systemctl --user |
| S | sudo systemctl |
2019-10-23 13:25:35 +00:00
#+BEGIN_SRC fish
<<generate-abbr(table=service-abbr)>>
2019-10-23 13:25:35 +00:00
#+END_SRC
** Development
:PROPERTIES:
:CUSTOM_ID: h-32ae38a2-41ad-438e-b619-220a63166115
:END:
A good amount of these commands are development related, especially when it
comes to compilation or Docker.
*** 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.
#+NAME: abbr-cmake
| abbreviation | command |
|--------------+----------------------------------|
| cdebug | cmake -DCMAKE_BUILD_TYPE=Debug |
| crelease | cmake -DCMAKE_BUILD_TYPE=Release |
Here is the corresponding fish configuration:
2019-10-23 11:02:59 +00:00
#+BEGIN_SRC fish
<<generate-abbr(table=abbr-cmake)>>
2019-10-23 11:02:59 +00:00
#+END_SRC
2019-10-23 13:25:35 +00:00
*** 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.
#+NAME: abbr-comp
| abbreviation | command |
|--------------+----------------------|
| clang | clang -Wall |
| clang++ | clang++ -Wall |
| g++ | g++ -Wall -std=c++17 |
| gcc | gcc -Wall -std=c18 |
Here is the corresponding fish configuration:
2019-10-23 13:25:35 +00:00
#+BEGIN_SRC fish :tangle
<<generate-abbr(table=abbr-comp)>>
2019-10-23 13:25:35 +00:00
#+END_SRC
*** Docker
:PROPERTIES:
:CUSTOM_ID: h-91c7ff90-7b43-4802-be69-5d102281c6d3
:END:
And of course, when it comes to Docker Compose, I dont have time to write
the full command, so I use these instead.
#+NAME: abbr-docker
| abbreviation | command |
|--------------+---------------------------|
| dc | docker-compose |
| dcd | docker-compose down |
| dcr | docker-compose run --rm |
| dcu | docker-compose up |
| dcub | docker-compose up --build |
Here is the corresponding fish configuration:
2019-10-23 11:02:59 +00:00
#+BEGIN_SRC fish
<<generate-abbr(table=abbr-docker)>>
2019-10-23 11:02:59 +00:00
#+END_SRC
2019-10-23 13:25:35 +00:00
*** Git
:PROPERTIES:
:CUSTOM_ID: h-e72347d4-590e-448c-bc33-0a70fa8ab35b
:END:
And lets face it: we all at one point just wanted to commit our code
without thinking about the message, to just get over with it. Dont 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:
2019-10-23 13:25:35 +00:00
#+BEGIN_SRC fish :tangle
<<generate-abbr(table=abbr-git)>>
2019-10-23 13:25:35 +00:00
#+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.
#+NAME: abbr-prolog
| abbreviation | command |
|--------------+----------------------------|
| swipl | clear && swipl -q && clear |
Here is the corresponding fish configuration:
2019-10-23 11:02:59 +00:00
#+BEGIN_SRC fish
<<generate-abbr(table=abbr-prolog)>>
2019-10-23 11:02:59 +00:00
#+END_SRC
2019-10-23 13:25:35 +00:00
*** Text editors
2019-10-23 11:02:59 +00:00
:PROPERTIES:
2019-10-23 13:25:35 +00:00
:CUSTOM_ID: h-51155e06-872d-4a12-9bf7-ae5eabc256ad
2019-10-23 11:02:59 +00:00
:END:
I greatly prefer to use Emacsclient as my main text editor; Emacs has
basically all I need. So, its 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, Ill 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 lets all add their command as an abbreviation for Emacs.
#+NAME: abbr-text-ed
| abbreviation | command |
|--------------+--------------------|
| e | emacsclient -c |
| enw | emacsclient -c -nw |
| vi | emacsclient -c |
| vim | emacsclient -c |
| nano | emacsclient -c |
| ed | emacsclient -c |
Here is the corresponding fish configuration:
#+BEGIN_SRC fish :noweb yes
<<generate-abbr(table=abbr-text-ed)>>
2019-10-23 13:25:35 +00:00
#+END_SRC
** LaTeX
:PROPERTIES:
:CUSTOM_ID: h-a8f8a707-90d7-4784-982d-d959b183148e
: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. Same goes for =texhash= which must be run as sudo.
#+NAME: latex-abbr
| abbreviation | command |
|--------------+--------------|
| tlmgr | tllocalmgr |
| texhash | sudo texhash |
Here is the corresponding fish configuration:
2019-10-23 13:25:35 +00:00
#+BEGIN_SRC fish
<<generate-abbr(table=latex-abbr)>>
2019-10-23 13:25:35 +00:00
#+END_SRC
** Some security measures
:PROPERTIES:
:CUSTOM_ID: h-dd97ea71-c43f-4b79-8bb7-1f857284b1b4
: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.
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=.
#+NAME: sec-abbr
| abbreviation | command |
|--------------+--------------------------|
| cp | cp -i |
| ln | ln -i |
| lns | ln -si |
| mv | mv -i |
| rm | rm -Iv |
| rmd | rm --preserve-root -Irv |
| rmdf | rm --preserve-root -Irfv |
| rmf | rm --preserve-root -Ifv |
| chgrp | chgrp --preserve-root -v |
| chmod | chmod --preserve-root -v |
| chown | chown --preserve-root -v |
Here is the corresponding fish configuration:
2019-10-23 13:25:35 +00:00
#+BEGIN_SRC fish
<<generate-abbr(table=sec-abbr)>>
2019-10-23 13:25:35 +00:00
#+END_SRC
** Typos
:PROPERTIES:
:CUSTOM_ID: h-4c5a03cd-20a8-437e-87b7-af990780084e
:END:
Lets 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, lets just replace the former by the latter. Im also very bad
at typing =exit=. And sometimes I suck at typing =htop=.
#+NAME: typo-abbr
| abbreviation | command |
|--------------+---------|
| clean | clear |
| exi | exit |
| exti | exit |
| hotp | htop |
Here is the corresponding fish configuration:
2019-10-23 13:25:35 +00:00
#+BEGIN_SRC fish
<<generate-abbr(table=typo-abbr)>>
2019-10-23 13:25:35 +00:00
#+END_SRC
** Misc
:PROPERTIES:
:CUSTOM_ID: h-3a237ec0-c535-42c7-9c60-3d083745b643
:END:
Finally, some miscellaneous abbreviations that dont really fit into any of
the above categories.
*** Sudo
2019-10-23 11:02:59 +00:00
:PROPERTIES:
2019-10-23 13:25:35 +00:00
:CUSTOM_ID: h-0955e2fc-ec25-41b6-814a-929fa3718dda
2019-10-23 11:02:59 +00:00
:END:
2019-10-23 13:25:35 +00:00
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 please 'sudo -A'
#+END_SRC
*** Exit
2019-10-23 11:02:59 +00:00
:PROPERTIES:
2019-10-23 13:25:35 +00:00
:CUSTOM_ID: h-8cf0e895-b919-41a8-ad3d-c5294dc507fd
2019-10-23 11:02:59 +00:00
:END:
2019-10-23 13:25:35 +00:00
Sometimes I find it easier to just type =q= instead of =exit=.
2019-10-23 11:02:59 +00:00
#+BEGIN_SRC fish
2019-10-23 13:25:35 +00:00
abbr q exit
2019-10-23 11:02:59 +00:00
#+END_SRC
2019-10-23 13:25:35 +00:00
*** 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 lets declare that.
2019-10-23 11:02:59 +00:00
#+BEGIN_SRC fish
2019-10-23 13:25:35 +00:00
abbr hist history
2019-10-23 11:02:59 +00:00
#+END_SRC
*** ~youtube-dl~ related commands
2019-10-23 11:02:59 +00:00
:PROPERTIES:
:CUSTOM_ID: h-177d56dc-39a6-4f4c-a7ba-179dd5c6cac8
2019-10-23 11:02:59 +00:00
:END:
**** Song download from YouTube
:PROPERTIES:
:CUSTOM_ID: h-4bc663a9-b609-4c86-9a4d-a220013c67f9
:END:
When I want to download a song from YouTube, Ill 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: h-e6e45b59-7620-4d17-ba32-67a33f39cc4b
: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
2019-10-23 13:25:35 +00:00
*** 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.
2019-10-23 11:02:59 +00:00
#+BEGIN_SRC fish
2019-10-23 13:25:35 +00:00
abbr mpv 'mpv --no-border --force-window=no'
2019-10-23 11:02:59 +00:00
#+END_SRC
2019-10-23 13:25:35 +00:00
*** Compression
2019-10-23 11:02:59 +00:00
:PROPERTIES:
2019-10-23 13:25:35 +00:00
:CUSTOM_ID: h-05919be3-360a-45c6-8c89-76836375d55b
2019-10-23 11:02:59 +00:00
:END:
2019-10-23 13:25:35 +00:00
It seems its 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
Ill remember the command like I did for the abbreviation of =remove= (see
[[#h-281a59aa-4ea0-47ab-a4cc-33fff8d38165][Package management]]).
#+NAME: tar-abbr
| abbreviation | command |
|--------------+-----------|
| compress | tar -czf |
| untar | tar -xvzf |
2019-10-23 13:25:35 +00:00
#+BEGIN_SRC fish
<<generate-abbr(table=tar-abbr)>>
2019-10-23 13:25:35 +00:00
#+END_SRC
2019-10-23 11:02:59 +00:00
2019-10-23 13:25:35 +00:00
*** 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.
2019-10-23 11:02:59 +00:00
#+BEGIN_SRC fish
2019-10-23 13:25:35 +00:00
abbr feh 'feh -Zx.'
2019-10-23 11:02:59 +00:00
#+END_SRC
*** Network Management
2019-10-23 13:25:35 +00:00
:PROPERTIES:
:CUSTOM_ID: h-5f9d4866-3086-4ed9-9ff3-d80a0af36593
:END:
First, we have just =nmcli= with sane default options, that is a pretty output
2019-10-23 13:25:35 +00:00
with colors.
2019-10-23 11:02:59 +00:00
#+BEGIN_SRC fish
2019-10-23 13:25:35 +00:00
abbr nmcli 'nmcli -p -c auto'
2019-10-23 11:02:59 +00:00
#+END_SRC
*** NordVPN
:PROPERTIES:
:CUSTOM_ID: h-f35e00a2-ec5b-416d-821f-56040ad1d6b4
:END:
Next, we have some NordVPN-related shortcuts. The first one is a simple
abbreviation to =nordvpn=. The second one is a shortcut to connect to a
server, and to disconnect from the current server. I also have a couple of
shortcuts to quickly connect to some preselected countries, mainly France,
Germany, Japan and the US.
#+NAME: nordvpn-abbr
| abbreviation | command |
|--------------+-------------------------|
| n | nordvpn |
| nc | nordvpn c |
| nd | nordvpn d |
| ncf | nordvpn c France |
| ncg | nordvpn c Germany |
| ncj | nordvpn c Japan |
| ncu | nordvpn c United_States |
#+BEGIN_SRC fish
<<generate-abbr(table=nordvpn-abbr)>>
#+END_SRC
2019-10-23 13:25:35 +00:00
*** Wget
2019-10-23 11:02:59 +00:00
:PROPERTIES:
2019-10-23 13:25:35 +00:00
:CUSTOM_ID: h-74f84f1c-433d-488a-88a7-89915c1a3bd5
2019-10-23 11:02:59 +00:00
:END:
2019-10-23 13:25:35 +00:00
By default, continue a download that was interupted.
#+BEGIN_SRC fish
abbr wget 'wget -c'
#+END_SRC