[Org, meta] Change formatting of org files

This commit is contained in:
2021-02-04 14:43:09 +01:00
parent 58b5b82531
commit 527380e5ff
9 changed files with 2233 additions and 833 deletions

View File

@@ -11,9 +11,12 @@
:PROPERTIES:
:CUSTOM_ID: Presentation-340195eb
: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.
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.
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
@@ -24,7 +27,8 @@ Just in case, we might need sometimes to declare the fish function =fish_title=
:PROPERTIES:
:CUSTOM_ID: Fish_from_within_Emacs-360c0a74
: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=.
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
@@ -35,7 +39,10 @@ I sometimes call fish from within emacs, with =M-x ansi-term=. In this case, the
:PROPERTIES:
:CUSTOM_ID: Tramp_remote_access-72aedec2
: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.
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
@@ -51,7 +58,10 @@ When accessing from a remote machine our computer from Emacs, tramp needs a prec
:PROPERTIES:
:CUSTOM_ID: Regular_fish_shell_appearance-c3e532e1
:END:
Now, there is only one function I modify when it comes to the appearance of fish when Im the one using it: the ~fish_greeting~ function. I use it to give me an overview of my computers status, including its hostname, uptime, disks usage, ram usage, swap usage, and networking.
Now, there is only one function I modify when it comes to the appearance of fish
when Im the one using it: the ~fish_greeting~ function. I use it to give me an
overview of my computers status, including its hostname, uptime, disks usage,
ram usage, swap usage, and networking.
#+BEGIN_SRC fish
set RED '\033[0;31m'
set GREEN '\033[0;32m'
@@ -120,7 +130,9 @@ Now, there is only one function I modify when it comes to the appearance of fish
end
#+END_SRC
The theme I use for fish is [[https://github.com/oh-my-fish/theme-bobthefish][bobthefish]], which by default puts a really long timestamp to the right of the prompt. I want something shorter, so here is the variable to set, using the format specified in ~date(1)~.
The theme I use for fish is [[https://github.com/oh-my-fish/theme-bobthefish][bobthefish]], which by default puts a really long
timestamp to the right of the prompt. I want something shorter, so here is the
variable to set, using the format specified in ~date(1)~.
#+BEGIN_SRC fish
set -g theme_date_format "+%g-%m-%d %H:%M:%S"
#+END_SRC
@@ -139,12 +151,14 @@ Finally, lets set our prompts theme to the Nord theme.
:PROPERTIES:
:CUSTOM_ID: Global_variables-1c84df8b
:END:
In order to keep some other code clean, I set the ~$BROWSER~ variable so I dont have to call my web browser directly but rather with this variable.
In order to keep some other code clean, I set the ~$BROWSER~ variable so I dont
have to call my web browser directly but rather with this variable.
#+BEGIN_SRC fish
set -gx BROWSER firefox
#+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.
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
@@ -153,7 +167,9 @@ Sometimes, software will rely on =SUDO_ASKPASS= to get a GUI from which it can g
:PROPERTIES:
:CUSTOM_ID: Global_variables-Development-76b3ff13
:END:
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), or from the ~VISUAL~ variable.
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), or from the ~VISUAL~ variable.
#+BEGIN_SRC fish
set -gx EDITOR emacsclient -c
set -gx VISUAL emacsclient -c
@@ -174,13 +190,16 @@ Still related to Dart and Flutter development,
set -gx CHROME_EXECUTABLE /usr/bin/chromium
#+END_SRC
Next, we have two variables from Deno, the Node.js destroyer. Its base directory will be set in my XDG config directory, and its binaries will be located in my local binaries directory (see below).
Next, we have two variables from Deno, the Node.js destroyer. Its base directory
will be set in my XDG config directory, and its binaries will be located in my
local binaries directory (see below).
#+BEGIN_SRC fish
set -gx DENO_DIR $HOME/.config/deno
set -gx DENO_INSTALL_ROOT $HOME/.local/bin/deno
#+END_SRC
Finally, some development packages require the =PKG_CONFIG_PATH= to be set, so lets do so.
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
@@ -189,7 +208,11 @@ Finally, some development packages require the =PKG_CONFIG_PATH= to be set, so l
:PROPERTIES:
:CUSTOM_ID: Global_variables-$PATH-e1320303
:END:
A variable available with the fish shell is ~fish_user_paths~ which lists custom paths to binaries specified by the user. Using this variable ensures they are included in the ~$PATH~ variable only once without the need to set it directly. For instance, my ~PATH~ variable needs Rusts Cargos binaries, Gos binaries, my own executables, and some more.
A variable available with the fish shell is ~fish_user_paths~ which lists custom
paths to binaries specified by the user. Using this variable ensures they are
included in the ~$PATH~ variable only once without the need to set it directly.
For instance, my ~PATH~ variable needs Rusts Cargos binaries, Gos binaries,
my own executables, and some more.
#+NAME: extra-paths
| additional path | what it leads to |
@@ -247,7 +270,16 @@ the terminal window will come back.
:PROPERTIES:
:CUSTOM_ID: Abbreviations-System_monitoring-bd909755
: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.
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 |
|--------------+--------------------------------------------|
@@ -270,13 +302,17 @@ Here I have some abbreviations which are quite useful when performing some syste
:PROPERTIES:
:CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-7249fbb7
:END:
I added some of these abbreviations due to how often I have to write the whole thing.
I added some of these abbreviations due to how often I have to write the whole
thing.
*** Package management
:PROPERTIES:
:CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-Package_management-efbcdf0f
: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 =paru='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 =paru=.
The first command is =remove= which removes a package from my system, as well as
its dependencies no longer needed. =p=. =pacman='s or =paru='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 =paru=.
#+NAME: pm-abbr
| abbreviation | command |
@@ -292,7 +328,9 @@ The first command is =remove= which removes a package from my system, as well as
:PROPERTIES:
:CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-Service_management-8c5ae482
: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=.
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 |
|--------------+------------------|
@@ -307,13 +345,15 @@ I dont have the muscle memory of =systemctl=. So instead, I simply type =c= w
:PROPERTIES:
:CUSTOM_ID: Abbreviations-Development-d6050ca4
:END:
A good amount of these commands are development related, especially when it comes to compilation or Docker.
A good amount of these commands are development related, especially when it
comes to compilation or Docker.
*** CMake
:PROPERTIES:
:CUSTOM_ID: Abbreviations-Development-CMake-f2951675
:END:
I have the following abbreviations so I can quickly run CMake and create a configuration for debug or release profiles.
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 |
|--------------+----------------------------------|
@@ -329,7 +369,8 @@ Here is the corresponding fish configuration:
:PROPERTIES:
:CUSTOM_ID: Abbreviations-Development-Docker-2d0a1288
: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.
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 |
|--------------+------------------------------|
@@ -353,7 +394,13 @@ Here is the corresponding fish configuration:
: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 a new instance of it. If launched in the terminal, Ill usually want Emacs to be displayed in CLI mode and not in GUI mode, otherwise I would invoke it with my WMs shortcut. 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. In case we want to launch Emacs in GUI mode anyways, ~egui~ is available too.
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. If launched in the terminal, Ill usually want Emacs to be displayed in
CLI mode and not in GUI mode, otherwise I would invoke it with my WMs shortcut.
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. In
case we want to launch Emacs in GUI mode anyways, ~egui~ is available too.
#+NAME: abbr-text-ed
| abbreviation | command |
@@ -374,7 +421,8 @@ Here is the corresponding fish configuration:
: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.
By default, I set ~clang~, ~clang++~, ~gcc~ and ~g++~ to the latest standard and
with the ~-Wall~ flag activated.
#+NAME: abbr-comp
| abbreviation | command |
|--------------+----------------------|
@@ -392,7 +440,9 @@ Here is the corresponding fish configuration:
: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.
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 |
|--------------+-----------------------------------------------------|
@@ -407,7 +457,11 @@ Here is the corresponding fish configuration:
: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~, 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.
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 |
|--------------+--------------|
@@ -423,7 +477,14 @@ Here is the corresponding fish configuration:
:PROPERTIES:
:CUSTOM_ID: Abbreviations-Some_security_measures-489cb521
: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=.
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 |
|--------------+--------------------------|
@@ -448,7 +509,12 @@ Here is the corresponding fish configuration:
:PROPERTIES:
:CUSTOM_ID: Abbreviations-Typos-370bbb27
: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. I'm also very bad at typing ~exit~. And sometimes I suck at typing ~htop~.
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~.
#+NAME: typo-abbr
| abbreviation | command |
|--------------+---------|
@@ -466,33 +532,42 @@ Here is the corresponding fish configuration:
:PROPERTIES:
:CUSTOM_ID: Abbreviations-Misc-c2631eb6
:END:
Finally, some miscellaneous abbreviations that don't really fit into any of the above categories.
Finally, some miscellaneous abbreviations that don't really fit into any of the
above categories.
*** Media
:PROPERTIES:
:CUSTOM_ID: Abbreviations-Misc-Media-e4b85d56
:END:
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.
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 chill 'mpv --force-window=no --no-video "https://www.youtube.com/user/Chillhopdotcom/live" &'
#+END_SRC
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.
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 'devour 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~.
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
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.
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.
#+BEGIN_SRC fish
abbr sxiv 'devour sxiv -abfs f'
abbr sxiv 'sxiv -abfs f'
#+END_SRC
Finally, let's declare the following abbreviation that will launch an mpv instance displaying my webcam:
Finally, let's declare the following abbreviation that will launch an mpv
instance displaying my webcam:
#+BEGIN_SRC fish
abbr webcam 'devour mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0'
#+END_SRC
@@ -501,7 +576,9 @@ Finally, let's declare the following abbreviation that will launch an mpv instan
: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.
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
@@ -510,7 +587,8 @@ First, I make it so that ~sudo~ comes with the ~-A~ switch in order to call my c
: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.
I 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
@@ -519,7 +597,11 @@ I also find it more intuitive and faster to just write ~hist~ instead of ~histor
: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 [[#Abbreviations-System_management_(packages_and_services)-Package_management-efbcdf0f][Package management]]).
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 |
|--------------+-----------|
@@ -548,7 +630,8 @@ It seems it's just like many other people, but I cannot for the life of me remem
:PROPERTIES:
:CUSTOM_ID: Abbreviations-Misc-Network_Management-0b7fc91d
:END:
First, we have just =nmcli= with sane default options, that is a pretty output with colors.
First, we have just =nmcli= with sane default options, that is a pretty output
with colors.
#+BEGIN_SRC fish
abbr nmcli 'nmcli -p -c auto'
#+END_SRC
@@ -557,7 +640,11 @@ First, we have just =nmcli= with sane default options, that is a pretty output w
:PROPERTIES:
:CUSTOM_ID: Abbreviations-Misc-NordVPN-09438638
: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.
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 |
|--------------+-------------------------|