Browse Source

[Org, Emacs] Do not add spaces in front of code in src blocks

By default, org-mode will add two spaces before code lines in the org
file itself. This does not change how code is edited when editing a
code block through `org-edit-special' but when copy/pasting code or
editing it directly from the org file, it can be troublesome.
Setting `org-src-preserve-indentation' to `t' prevents org from adding
these two spaces.
master
Lucien Cartier-Tilet 8 months ago
parent
commit
d4f11b612d
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
  1. 874
      org/config/awesome.org
  2. 955
      org/config/bin.org
  3. 360
      org/config/bootstrap.org
  4. 3693
      org/config/emacs.org
  5. 250
      org/config/fish.org
  6. 190
      org/config/index.org
  7. 106
      org/config/neofetch.org
  8. 204
      org/config/picom.org
  9. 34
      org/config/rustfmt.org
  10. 3844
      org/config/spacemacs.org
  11. 549
      org/config/stumpwm.org
  12. 221
      org/config/tmux.org

874
org/config/awesome.org

File diff suppressed because it is too large Load Diff

955
org/config/bin.org

File diff suppressed because it is too large Load Diff

360
org/config/bootstrap.org

@ -47,9 +47,9 @@ partition is 16GB large. @@ -47,9 +47,9 @@ partition is 16GB large.
:END:
When you boot into the live ISO, execute the following command:
#+BEGIN_SRC sh
pacman -Sy reflector
reflector -c FR -c DE -c BE -l 200 -p http -p https --sort rate \
--save /etc/pacman.d/mirrorlist --verbose
pacman -Sy reflector
reflector -c FR -c DE -c BE -l 200 -p http -p https --sort rate \
--save /etc/pacman.d/mirrorlist --verbose
#+END_SRC
This will update the packages from your live ISO, and you will get the best
@ -67,14 +67,14 @@ how the distro works, I just want to be able to install my distro quickly now. @@ -67,14 +67,14 @@ how the distro works, I just want to be able to install my distro quickly now.
I’ll need to download the script with ~wget~, but apparently it isn’t installed
by default on Arch ISOs anymore, so I’ll need to install it.
#+BEGIN_SRC sh
pacman -S wget
pacman -S wget
#+END_SRC
Now, let’s grab the script. You can check it on [[https://github.com/matmoul/archfi][Github]].
#+BEGIN_SRC sh
wget archfi.sf.net/archfi
# Or from matmoul.github.io/archfi if SourceForge is down
sh archfi
wget archfi.sf.net/archfi
# Or from matmoul.github.io/archfi if SourceForge is down
sh archfi
#+END_SRC
Then, follow the instructions and install Arch Linux. Take the opportunity to
@ -90,28 +90,32 @@ your computer. @@ -90,28 +90,32 @@ your computer.
:HEADER-ARGS:fish: :tangle ~/.config/yadm/bootstrap :shebang "#!/usr/bin/fish" :exports code :mkdirp yes
:CUSTOM_ID: Execute_bootstrap-e37054ef
:END:
The first thing I will do is add the [[https://github.com/archlinuxcn/repo][ArchLinuxCN]] repository so I can get access
to ~paru~.
The first thing I will do is add the [[https://aur.chaotic.cx/][Chaotic AUR]] repository so I can
get access to ~paru~ as well as some AUR packages without the need of an
AUR helper (ironic considering ~paru~ is one)..
#+BEGIN_SRC sh
printf '[archlinuxcn]\nServer = https://repo.archlinuxcn.org/$arch\n' | sudo tee -a /etc/pacman.conf
sudo pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com
sudo pacman-key --lsign-key 3056513887B78AEB
sudo pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'
printf '[chaotic-aur]\nServer = /etc/pacman.d/chaotic-mirrorlist\n' | sudo tee -a /etc/pacman.conf
#+END_SRC
I can now install ~fish~, ~git~, and ~paru~:
#+BEGIN_SRC sh
sudo pacman -S fish git paru
sudo pacman -S fish git paru
#+END_SRC
And now that ~paru~ is available, we can install ~yadm~:
#+BEGIN_SRC sh
paru -S yadm
paru -S yadm
#+END_SRC
~yadm~ comes with a very handy feature: its bootstrap script. It can be executed
automatically once the dotfiles are cloned with yadm:
#+BEGIN_SRC sh
yadm clone https://labs.phundrak.com/phundrak/dotfiles
# or if labs.phundrak.com is down or too slow for you
#yadm clone https://github.com/phundrak/dotfiles
yadm clone https://labs.phundrak.com/phundrak/dotfiles
# or if labs.phundrak.com is down or too slow for you
#yadm clone https://github.com/phundrak/dotfiles
#+END_SRC
Let’s take a look at what it does.
@ -123,11 +127,11 @@ Let’s take a look at what it does. @@ -123,11 +127,11 @@ Let’s take a look at what it does.
Some private files are stored encrypted in the repository of my yadm dotfiles. I
will need them later on during the bootstrap execution.
#+BEGIN_SRC fish
if test "$USER" = 'phundrak'
yadm decrypt
else
whiptail --yesno "Decrypt private files?" 8 40 && yadm decrypt
end
if test "$USER" = 'phundrak'
yadm decrypt
else
whiptail --yesno "Decrypt private files?" 8 40 && yadm decrypt
end
#+END_SRC
** Get a correct keyboard layout
@ -140,24 +144,24 @@ or the American QWERTY layout, so I make it so the Menu key switches for me my @@ -140,24 +144,24 @@ or the American QWERTY layout, so I make it so the Menu key switches for me my
layout between these three. This makes it so my xorg configuration of my
keyboard looks like this:
#+BEGIN_SRC fish
set keyboardconf \
'Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "fr"
Option "XkbModel" "pc104"
Option "XkbVariant" "bepo_afnor"
Option "XkbOptions" "caps:ctrl_modifier"
EndSection'
set keyboardconf \
'Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "fr"
Option "XkbModel" "pc104"
Option "XkbVariant" "bepo_afnor"
Option "XkbOptions" "caps:ctrl_modifier"
EndSection'
#+END_SRC
So, let’s ask the user if they want to set it as their keyboard configuration.
#+BEGIN_SRC fish
printf "\n# Set keyboard layout #########################################################\n\n"
whiptail --yesno "Would you like to set your keyboard layout to the bépo layout?" 8 55
if test $status -eq 0
echo $keyboardconf | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf
end
printf "\n# Set keyboard layout #########################################################\n\n"
whiptail --yesno "Would you like to set your keyboard layout to the bépo layout?" 8 55
if test $status -eq 0
echo $keyboardconf | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf
end
#+END_SRC
** Set our locale
@ -167,12 +171,12 @@ So, let’s ask the user if they want to set it as their keyboard configuration. @@ -167,12 +171,12 @@ So, let’s ask the user if they want to set it as their keyboard configuration.
I use two main locales, the French and US UTF-8 locales, and I like to keep the
Japanese locale activated just in case.
#+BEGIN_SRC fish
set mylocales "en_US.UTF-8 UTF-8" "fr_FR.UTF-8 UTF-8" "ja_JP.UTF-8 UTF-8"
set mylocales "en_US.UTF-8 UTF-8" "fr_FR.UTF-8 UTF-8" "ja_JP.UTF-8 UTF-8"
#+END_SRC
I’ll let the user accept them one by one.
#+BEGIN_SRC fish
printf "\n# Set locale ##################################################################\n\n"
printf "\n# Set locale ##################################################################\n\n"
for item in $mylocales
whiptail --yesno "Set the \"$item\" locale?" 8 40
@ -184,29 +188,29 @@ I’ll let the user accept them one by one. @@ -184,29 +188,29 @@ I’ll let the user accept them one by one.
This is my configuration I usually use when it comes to my locale.
#+BEGIN_SRC fish
set localeconf "LANG=en_DK.UTF-8
LC_COLLATE=C
LC_NAME=fr_FR.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_MONETARY=fr_FR.UTF-8
LC_PAPER=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8"
set localeconf "LANG=en_DK.UTF-8
LC_COLLATE=C
LC_NAME=fr_FR.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_MONETARY=fr_FR.UTF-8
LC_PAPER=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8"
#+END_SRC
Let’s set it as our system’s locale if the user whishes to.
#+BEGIN_SRC fish
whiptail --yesno "Do you agree to have the following locale set?\n\n $localeconf" 20 43
if test $status -eq 0
echo $localeconf | sudo tee /etc/locale.conf
end
whiptail --yesno "Do you agree to have the following locale set?\n\n $localeconf" 20 43
if test $status -eq 0
echo $localeconf | sudo tee /etc/locale.conf
end
#+END_SRC
Now we can generate our locale!
#+BEGIN_SRC fish
printf "\n# Generate locale #############################################################\n\n"
sudo locale-gen
printf "\n# Generate locale #############################################################\n\n"
sudo locale-gen
#+END_SRC
** Create some folders
@ -216,9 +220,9 @@ Now we can generate our locale! @@ -216,9 +220,9 @@ Now we can generate our locale!
Let’s create some folders we might need for mounting our drives, Android devices
and CDs.
#+BEGIN_SRC fish
printf "\n# Create directories for mounting #############################################\n\n"
sudo mkdir -p /mnt/{USB,CD,Android}
sudo chown $USER:(id -g $USER) /mnt/{USB,CD,Android}
printf "\n# Create directories for mounting #############################################\n\n"
sudo mkdir -p /mnt/{USB,CD,Android}
sudo chown $USER:(id -g $USER) /mnt/{USB,CD,Android}
#+END_SRC
** Set user’s shell to fish
@ -227,11 +231,11 @@ and CDs. @@ -227,11 +231,11 @@ and CDs.
:END:
First of all, the bootstrap shell will set the user’s shell to fish.
#+BEGIN_SRC fish
printf "\n# Set fish as the default shell ###############################################\n\n"
whiptail --yesno "Set the current user’s default shell to fish?" 8 50
if test $status -eq 0 -a ! "$SHELL" = '/usr/bin/fish'
chsh -s /usr/bin/fish
end
printf "\n# Set fish as the default shell ###############################################\n\n"
whiptail --yesno "Set the current user’s default shell to fish?" 8 50
if test $status -eq 0 -a ! "$SHELL" = '/usr/bin/fish'
chsh -s /usr/bin/fish
end
#+END_SRC
** Install basic packages
@ -240,49 +244,49 @@ First of all, the bootstrap shell will set the user’s shell to fish. @@ -240,49 +244,49 @@ First of all, the bootstrap shell will set the user’s shell to fish.
:END:
Let’s set in a custom varible what packages we’ll be needing.
#+BEGIN_SRC fish
set PACKAGES \
acpi acpilight adobe-source-han-sans-jp-fonts arc-gtk-theme asar ascii \
aspell-en aspell-fr awesome awesome-terminal-fonts awesome-freedesktop-git \
base-devel bashtop bat biber bitwarden-bin bluez-firmware bluez-utils bzip2 \
chicken chromium clisp corrupter-git cppcheck cppreference \
cppreference-devhelp cpupower discord-canary discount docker docker-compose \
dockerfile-language-server-bin doxygen emacs emacs-org-mode exa exfat-utils \
farbfeld fd ffmpegthumbnailer findutils firefox flake8 flat-remix-gtk freeglut \
fzf gcc-libs gdb gimp gnome-disk-utility gnome-epub-thumbnailer gnu-free-fonts \
gnuplot go go-tools golangci-lint-bin graphviz htop hugo i3lock-color \
inetutils isync inter-font javascript-typescript-langserver js-beautify \
jfsutils jmtpfs kitty lain-git libxft-bgra linux-headers lldb logrotate meson \
minted man-db man-pages mpc mpd mpd-rich-presence-discord-git mpv mupdf-tools \
nano ncdu ncmpcpp nemo-fileroller nemo-preview neofetch netctl \
network-manager-applet networkmanager networkmanager-openvpn \
nm-connection-editor nodejs-vmd nomacs nordic-theme-git nordvpn-bin \
noto-fonts-emoji npm ntfs-3g numlockx obs-studio openssh otf-fandol \
otf-ipafont p7zip pacman-contrib pandoc-bin pass pavucontrol pdfpc picom-git \
powerline-fonts prettier pulseaudio-bluetooth python-autoflake python-epc \
python-importmagic python-language-server python-nose python-pip python-poetry \
python-ptvsd python-pytest qt5-imageformats qemu r raw-thumbnailer reflector \
ripgrep rofi rsync rtv ruby-rb-fsevent ruby-sass rustup samba scrot sent \
shadow siji-git simplescreenrecorder sshfs sxiv texlive-bibtexextra \
texlive-fontsextra texlive-formatsextra texlive-humanities \
texlive-langjapanese texlive-pictures texlive-pstricks texlive-publishers \
texlive-science tldr tmux tree ttf-arphic-uming ttf-baekmuk ttf-charis-sil \
ttf-dejavu ttf-google-fonts-opinionated-git ttf-hanazono ttf-joypixels \
ttf-koruri ttf-liberation ttf-monapo ttf-sazanami ttf-tibetan-machine \
typescript typescript-language-server-bin unicode-emoji unrar usbutils \
valgrind vscode-css-languageserver-bin vscode-html-languageserver-bin w3m wget \
x11-ssh-askpass xclip xdg-user-dirs-gtk xfce-polkit xidlehook xfsprogs \
xorg-drivers xorg-server xorg-xinit xss-lock xvkbd xwallpaper \
yaml-language-server-bin zeal
set PACKAGES \
acpi acpilight adobe-source-han-sans-jp-fonts arc-gtk-theme asar ascii \
aspell-en aspell-fr awesome awesome-terminal-fonts awesome-freedesktop-git \
base-devel bashtop bat biber bitwarden-bin bluez-firmware bluez-utils bzip2 \
chicken chromium clisp corrupter-git cppcheck cppreference \
cppreference-devhelp cpupower discord-canary discount docker docker-compose \
dockerfile-language-server-bin doxygen emacs emacs-org-mode exa exfat-utils \
farbfeld fd ffmpegthumbnailer findutils firefox flake8 flat-remix-gtk freeglut \
fzf gcc-libs gdb gimp gnome-disk-utility gnome-epub-thumbnailer gnu-free-fonts \
gnuplot go go-tools golangci-lint-bin graphviz htop hugo i3lock-color \
inetutils isync inter-font javascript-typescript-langserver js-beautify \
jfsutils jmtpfs kitty lain-git libxft-bgra linux-headers lldb logrotate meson \
minted man-db man-pages mpc mpd mpd-rich-presence-discord-git mpv mupdf-tools \
nano ncdu ncmpcpp nemo-fileroller nemo-preview neofetch netctl \
network-manager-applet networkmanager networkmanager-openvpn \
nm-connection-editor nodejs-vmd nomacs nordic-theme-git nordvpn-bin \
noto-fonts-emoji npm ntfs-3g numlockx obs-studio openssh otf-fandol \
otf-ipafont p7zip pacman-contrib pandoc-bin pass pavucontrol pdfpc picom-git \
powerline-fonts prettier pulseaudio-bluetooth python-autoflake python-epc \
python-importmagic python-language-server python-nose python-pip python-poetry \
python-ptvsd python-pytest qt5-imageformats qemu r raw-thumbnailer reflector \
ripgrep rofi rsync rtv ruby-rb-fsevent ruby-sass rustup samba scrot sent \
shadow siji-git simplescreenrecorder sshfs sxiv texlive-bibtexextra \
texlive-fontsextra texlive-formatsextra texlive-humanities \
texlive-langjapanese texlive-pictures texlive-pstricks texlive-publishers \
texlive-science tldr tmux tree ttf-arphic-uming ttf-baekmuk ttf-charis-sil \
ttf-dejavu ttf-google-fonts-opinionated-git ttf-hanazono ttf-joypixels \
ttf-koruri ttf-liberation ttf-monapo ttf-sazanami ttf-tibetan-machine \
typescript typescript-language-server-bin unicode-emoji unrar usbutils \
valgrind vscode-css-languageserver-bin vscode-html-languageserver-bin w3m wget \
x11-ssh-askpass xclip xdg-user-dirs-gtk xfce-polkit xidlehook xfsprogs \
xorg-drivers xorg-server xorg-xinit xss-lock xvkbd xwallpaper \
yaml-language-server-bin zeal
#+END_SRC
These are the minimum I would have in my own installation. You can edit it
however you want. Let’s install those.
#+BEGIN_SRC fish
printf "\n# Installing needed packages ##################################################\n\n"
sudo pacman -Syu
for pkg in $PACKAGES
paru -S --needed $pkg
end
printf "\n# Installing needed packages ##################################################\n\n"
sudo pacman -Syu
for pkg in $PACKAGES
paru -S --needed $pkg
end
#+END_SRC
** Tangle configuration files from Org files
@ -308,9 +312,9 @@ need to create: @@ -308,9 +312,9 @@ need to create:
#+NAME: gen-dirs-tangle
#+BEGIN_SRC emacs-lisp :var dirs=dirs-tangled-files
(mapconcat (lambda (x) (format "mkdir -p %s" (car x)))
dirs
"\n")
(mapconcat (lambda (x) (format "mkdir -p %s" (car x)))
dirs
"\n")
#+END_SRC
#+RESULTS[a95e25a5f3ac91b1f884b39dde38e3b51366b188]: gen-dirs-tangle
@ -331,7 +335,7 @@ mkdir -p $HOME/org/capture @@ -331,7 +335,7 @@ mkdir -p $HOME/org/capture
Our code to generate such directories looks like this:
#+BEGIN_SRC fish :noweb yes
<<gen-dirs-tangle()>>
<<gen-dirs-tangle()>>
#+END_SRC
The next step is to tangle all the Org files. Here is the list of files that are
@ -350,13 +354,13 @@ to be tangled: @@ -350,13 +354,13 @@ to be tangled:
#+NAME: generate-tangle
#+BEGIN_SRC emacs-lisp :var files=tangled-files[,0]
(mapconcat (lambda (x) (concat
(format "printf '\\n\\n==== Tangling %s\\n\\n' && \\\n" x)
(concat "emacs -q --batch --eval '(require \\'ob-tangle)' \\\n"
"--eval '(setq org-confirm-babel-evaluate nil)' \\\n"
(format "--eval '(org-babel-tangle-file \"~/org/config/%s\")'\n" x))))
files
"\n")
(mapconcat (lambda (x) (concat
(format "printf '\\n\\n==== Tangling %s\\n\\n' && \\\n" x)
(concat "emacs -q --batch --eval '(require \\'ob-tangle)' \\\n"
"--eval '(setq org-confirm-babel-evaluate nil)' \\\n"
(format "--eval '(org-babel-tangle-file \"~/org/config/%s\")'\n" x))))
files
"\n")
#+END_SRC
#+RESULTS[87a25d6c524e8d1346452c54aa42ac3ac09d94cf]: generate-tangle
@ -403,8 +407,8 @@ emacs -q --batch --eval '(require \'ob-tangle)' \ @@ -403,8 +407,8 @@ emacs -q --batch --eval '(require \'ob-tangle)' \
#+end_example
#+BEGIN_SRC fish :noweb yes
printf "\n# Tangling org files ##########################################################\n\n"
<<generate-tangle()>>
printf "\n# Tangling org files ##########################################################\n\n"
<<generate-tangle()>>
#+END_SRC
** Setting up Emacs: Installing Spacemacs
@ -418,19 +422,19 @@ cloned within our =~/.config/emacs= directory, and git won’t let us clone @@ -418,19 +422,19 @@ cloned within our =~/.config/emacs= directory, and git won’t let us clone
Spacemacs in an already existing and non-empty directory. To make sure it isn’t
one, let’s delete any potentially existing =~/.config/emacs= directory:
#+BEGIN_SRC fish
printf "\n# Installing Spacemacs ########################################################\n\n"
rm -rf $HOME/.config/emacs $HOME/.emacs* .spacemacs
printf "\n# Installing Spacemacs ########################################################\n\n"
rm -rf $HOME/.config/emacs $HOME/.emacs* .spacemacs
#+END_SRC
Now we can clone Spacemacs:
#+BEGIN_SRC fish
git clone --branch develop https://github.com/syl20bnr/spacemacs ~/.config/emacs
git clone --branch develop https://github.com/syl20bnr/spacemacs ~/.config/emacs
#+END_SRC
And we can restore what might have been deleted in our =~/.emacs.d/private=
directory:
#+BEGIN_SRC fish
yadm checkout -- ~/.config/emacs/private/
yadm checkout -- ~/.config/emacs/private/
#+END_SRC
** Set up dotfiles’ git repository
@ -444,26 +448,26 @@ directory: @@ -444,26 +448,26 @@ directory:
This line in the bootstrap script will test if the current user is using my
username. If yes, it’s probably me.
#+BEGIN_SRC fish
if test "$USER" = 'phundrak'
if test "$USER" = 'phundrak'
#+END_SRC
If it is me installing and using these dotfiles, I want the remotes of my
dotfiles to be set to ssh remotes using my ssh keys.
#+BEGIN_SRC fish
printf "\n# Update yadm’s remotes #######################################################\n\n"
yadm remote set-url origin git@labs.phundrak.com:phundrak/dotfiles.git
yadm remote add github git@github.com:phundrak/dotfiles.git
printf "\n# Update yadm’s remotes #######################################################\n\n"
yadm remote set-url origin git@labs.phundrak.com:phundrak/dotfiles.git
yadm remote add github git@github.com:phundrak/dotfiles.git
#+END_SRC
I will also want to decrypt my encrypted files, such as said ssh keys.
#+BEGIN_SRC fish
printf "\n# Decrypt encrypted dotfiles ##################################################\n\n"
yadm decrypt
printf "\n# Decrypt encrypted dotfiles ##################################################\n\n"
yadm decrypt
#+END_SRC
Finally, let’s close this ~if~ statement.
#+BEGIN_SRC fish
end
end
#+END_SRC
*** Update our submodules
@ -473,8 +477,8 @@ Finally, let’s close this ~if~ statement. @@ -473,8 +477,8 @@ Finally, let’s close this ~if~ statement.
Now we can download the various dependencies of our dotfiles. To do so, let’s
run the following command:
#+BEGIN_SRC fish
printf "\n# Getting yadm susbmodules ####################################################\n\n"
yadm submodule update --init --recursive
printf "\n# Getting yadm susbmodules ####################################################\n\n"
yadm submodule update --init --recursive
#+END_SRC
** Enable some services
@ -491,14 +495,14 @@ them. @@ -491,14 +495,14 @@ them.
This service enables time syncing with the NTP protocol, so I can be sure my
computer’s time is correct. The service first needs to be enabled:
#+BEGIN_SRC fish
printf "\n# Enabling timesync ###########################################################\n\n"
sudo systemctl enable --now systemd-timesyncd
printf "\n# Enabling timesync ###########################################################\n\n"
sudo systemctl enable --now systemd-timesyncd
#+END_SRC
Now, let systemd know I want to use the NTP protocol to keep my computer’s time
synced.
#+BEGIN_SRC fish
sudo timedatectl set-ntp true
sudo timedatectl set-ntp true
#+END_SRC
*** Docker
@ -507,17 +511,17 @@ synced. @@ -507,17 +511,17 @@ synced.
:END:
First, let’s activate Docker on startup.
#+BEGIN_SRC fish
printf "\n# Enabling and starting Docker ################################################\n\n"
sudo systemctl enable --now docker
printf "\n# Enabling and starting Docker ################################################\n\n"
sudo systemctl enable --now docker
#+END_SRC
Now, if we wish it, we can be added to the =docker= group so we won’t have to
type =sudo= each time we call Docker or Docker Compose.
#+BEGIN_SRC fish
read --prompt "echo 'Do you wish to be added to the `docker` group? (Y/n): ' " -l adddockergroup
if test $adddockergroup = 'y' || test $adddockergroup = "Y" || test $adddockergroup = ''
sudo usermod -aG docker $USER
end
read --prompt "echo 'Do you wish to be added to the `docker` group? (Y/n): ' " -l adddockergroup
if test $adddockergroup = 'y' || test $adddockergroup = "Y" || test $adddockergroup = ''
sudo usermod -aG docker $USER
end
#+END_SRC
*** Emacs
@ -529,8 +533,8 @@ in. However, the service won’t be started immediately, I personally prefer to @@ -529,8 +533,8 @@ in. However, the service won’t be started immediately, I personally prefer to
start a standalone instance in which installing and compiling the Emacs packages
will happen, and then once that is done I will start the service.
#+BEGIN_SRC fish
printf "\n# Enabling Emacs as user service ##############################################\n\n"
systemctl --user enable emacs
printf "\n# Enabling Emacs as user service ##############################################\n\n"
systemctl --user enable emacs
#+END_SRC
*** Mpd
@ -540,9 +544,9 @@ will happen, and then once that is done I will start the service. @@ -540,9 +544,9 @@ will happen, and then once that is done I will start the service.
Mpd will also use as a user service in order to get rid of some lines of code in
my configuration.
#+BEGIN_SRC fish
printf "\n# Enabling Mpd as a user service ##############################################\n\n"
mkdir -p ~/.config/mpd/playlists
systemctl --user enable --now mpd
printf "\n# Enabling Mpd as a user service ##############################################\n\n"
mkdir -p ~/.config/mpd/playlists
systemctl --user enable --now mpd
#+END_SRC
*** SSH server
@ -552,11 +556,11 @@ my configuration. @@ -552,11 +556,11 @@ my configuration.
Maybe we want to activate an SSH server on our machine. If so, we can enable it.
Let’s ask the question.
#+BEGIN_SRC fish
whiptail --yesno 'Do you want to activate the ssh server?' 8 50
if test $status -eq 0
printf "\n# Enabling ssh server #########################################################\n\n"
sudo systemctl enable --now sshd
end
whiptail --yesno 'Do you want to activate the ssh server?' 8 50
if test $status -eq 0
printf "\n# Enabling ssh server #########################################################\n\n"
sudo systemctl enable --now sshd
end
#+END_SRC
*** Acpilight
@ -568,7 +572,7 @@ actually no service to enable here, but we must ensure the user is part of the @@ -568,7 +572,7 @@ actually no service to enable here, but we must ensure the user is part of the
~video~ group so we can modify the brightness of our screen without using
~sudo~.
#+BEGIN_SRC fish
sudo usermod -aG video $USER
sudo usermod -aG video $USER
#+END_SRC
*** NordVPN
@ -579,7 +583,7 @@ Thanks to the AUR package ~nordvpn-bin~, I no longer have to manually maintain @@ -579,7 +583,7 @@ Thanks to the AUR package ~nordvpn-bin~, I no longer have to manually maintain
my VPN connections with OpenVPN. However, it requires a service that we should
activate:
#+BEGIN_SRC fish
sudo systemctl enable --now nordvpnd
sudo systemctl enable --now nordvpnd
#+END_SRC
Let’s also set its default protocol to UDP. This will allow me to use any port
@ -587,7 +591,7 @@ while connected to any WiFi as long as the 443 port is available. Because yes, I @@ -587,7 +591,7 @@ while connected to any WiFi as long as the 443 port is available. Because yes, I
do connect to a WiFi that blocks some important ports, such as the IMAP and SMTP
ports. Thanks University of Paris 8 for being SO paranoid.
#+BEGIN_SRC fish
nordvpn s protocol tcp
nordvpn s protocol tcp
#+END_SRC
** Symlink some system config files
@ -596,16 +600,16 @@ ports. Thanks University of Paris 8 for being SO paranoid. @@ -596,16 +600,16 @@ ports. Thanks University of Paris 8 for being SO paranoid.
:END:
We have some files in [[file:ect/][etc/]] that are to be symlinked to =/etc=.
#+BEGIN_SRC fish
for f in (find ~/.etc -type f)
set dest (echo $f | sed -n 's|^.*etc\(.*\)$|/etc\1|p')
sudo ln -s $f $dest
end
for f in (find ~/.etc -type f)
set dest (echo $f | sed -n 's|^.*etc\(.*\)$|/etc\1|p')
sudo ln -s $f $dest
end
#+END_SRC
Let’s also symlink the ~plock~ script ([[file:bin.org::#Lock-635fcb38][source here]]) to ~/usr/bin~ so ~xss-lock~
can find it.
#+BEGIN_SRC fish
sudo ln -s (which plock) /usr/bin/plock
sudo ln -s (which plock) /usr/bin/plock
#+END_SRC
** Install packages from git
@ -614,7 +618,7 @@ can find it. @@ -614,7 +618,7 @@ can find it.
:END:
Now, let’s install some packages from git directly.
#+BEGIN_SRC fish
mkdir -p ~/fromGIT
mkdir -p ~/fromGIT
#+END_SRC
*** Reveal.JS
@ -624,9 +628,9 @@ Now, let’s install some packages from git directly. @@ -624,9 +628,9 @@ Now, let’s install some packages from git directly.
I sometimes use Reveal.JS to make presentations, and I set its location in my
[[file:.spacemacs][dotspacemacs]] file to be in =~/fromGIT=, so let’s clone it there.
#+BEGIN_SRC fish
printf "\n# Install Reveal.JS ###########################################################\n\n"
cd ~/fromGIT
git clone https://github.com/hakimel/reveal.js.git
printf "\n# Install Reveal.JS ###########################################################\n\n"
cd ~/fromGIT
git clone https://github.com/hakimel/reveal.js.git
#+END_SRC
** Install Rust
@ -641,14 +645,14 @@ When using Rust, I bounce between two toolchains, the ~stable~ toolchain and the @@ -641,14 +645,14 @@ When using Rust, I bounce between two toolchains, the ~stable~ toolchain and the
~nightly~ toolchain, although I try to stick with Rust Stable. To install them,
I will use ~rustup~ which has already been installed previously.
#+BEGIN_SRC fish
printf "\n# Install the rust toolchains, nightly is the default one #####################\n\n"
rustup default stable
printf "\n# Install the rust toolchains, nightly is the default one #####################\n\n"
rustup default stable
#+END_SRC
This will both download the stable toolchain and set it as the default one. Now
to install the nightly toolchain, let’s run this:
#+BEGIN_SRC fish
rustup toolchain install nightly
rustup toolchain install nightly
#+END_SRC
*** Install some utilities
@ -658,8 +662,8 @@ to install the nightly toolchain, let’s run this: @@ -658,8 +662,8 @@ to install the nightly toolchain, let’s run this:
We’ll need some utilities when developing Rust from Emacs, namely ~rustfmt~ and
~racer~. Let’s install them with ~cargo~.
#+BEGIN_SRC fish
printf "\n# Add rust utilities ##########################################################\n\n"
cargo install rustfmt racer
printf "\n# Add rust utilities ##########################################################\n\n"
cargo install rustfmt racer
#+END_SRC
We will also need some components for development purposes.
@ -672,9 +676,9 @@ We will also need some components for development purposes. @@ -672,9 +676,9 @@ We will also need some components for development purposes.
#+NAME: rust-components-gen
#+BEGIN_SRC emacs-lisp :var components=rust-components-table[,0]
(mapconcat (lambda (x) (format "rustup component add %s" x))
components
"\n")
(mapconcat (lambda (x) (format "rustup component add %s" x))
components
"\n")
#+END_SRC
#+RESULTS[b3935b1c09d86fe506b43670f52960306a1e9809]:
@ -684,7 +688,7 @@ We will also need some components for development purposes. @@ -684,7 +688,7 @@ We will also need some components for development purposes.
Here is the code to do so:
#+BEGIN_SRC fish :noweb yes
<<rust-components-gen()>>
<<rust-components-gen()>>
#+END_SRC
** Install some python packages
@ -703,8 +707,8 @@ working. @@ -703,8 +707,8 @@ working.
#+NAME: python-packages-gen
#+BEGIN_SRC emacs-lisp :var packages=python-packages-table[,0]
(format "pip install --user %s"
(string-join packages " "))
(format "pip install --user %s"
(string-join packages " "))
#+END_SRC
#+RESULTS[29652be1076ffac01e34189067efa8fe9abda9d9]: python-packages-gen
@ -712,8 +716,8 @@ working. @@ -712,8 +716,8 @@ working.
Let’s install them locally for our user.
#+BEGIN_SRC fish :noweb yes
printf "\n# Installing Python packages ##################################################\n\n"
<<python-packages-gen()>>
printf "\n# Installing Python packages ##################################################\n\n"
<<python-packages-gen()>>
#+END_SRC
** Set up Chicken (Scheme interpreter/compiler)
@ -723,14 +727,14 @@ Let’s install them locally for our user. @@ -723,14 +727,14 @@ Let’s install them locally for our user.
Chicken needs to be set up before being used. First, we need to install its
documentation.
#+BEGIN_SRC fish
printf "\n# Setting up Chicken ##########################################################\n\n"
chicken-install -s apropos chicken-doc
printf "\n# Setting up Chicken ##########################################################\n\n"
chicken-install -s apropos chicken-doc
#+END_SRC
Then, we’ll complete the documentation like so:
#+BEGIN_SRC fish
cd (chicken-csi -b -e "(import (chicken platform))" -p "(chicken-home)")
curl https://3e8.org/pub/chicken-doc/chicken-doc-repo.tgz | sudo tar zx
cd (chicken-csi -b -e "(import (chicken platform))" -p "(chicken-home)")
curl https://3e8.org/pub/chicken-doc/chicken-doc-repo.tgz | sudo tar zx
#+END_SRC
** Set up our fish shell
@ -746,8 +750,8 @@ order to improve the user experience. @@ -746,8 +750,8 @@ order to improve the user experience.
:END:
We will be using ~fisher~ as our extensions manager for Fish. Let’s install it.
#+BEGIN_SRC fish
printf "\n# Installing fisher ###########################################################\n\n"
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish
printf "\n# Installing fisher ###########################################################\n\n"
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish
#+END_SRC
*** Install our extensions
@ -770,9 +774,9 @@ I generally use the following extensions in my Fish shell. @@ -770,9 +774,9 @@ I generally use the following extensions in my Fish shell.
#+NAME: fish-extensions-gen
#+BEGIN_SRC emacs-lisp :var extensions=fish-extensions-table[,0]
(mapconcat (lambda (x) (format "fisher add %s" x))
extensions
"\n")
(mapconcat (lambda (x) (format "fisher add %s" x))
extensions
"\n")
#+END_SRC
#+RESULTS[a88b321ba9148acc8c28c7fb1aaf924c23b6b072]: fish-extensions-gen
@ -786,6 +790,6 @@ I generally use the following extensions in my Fish shell. @@ -786,6 +790,6 @@ I generally use the following extensions in my Fish shell.
: fisher add oh-my-fish/theme-bobthefish
#+BEGIN_SRC fish :noweb yes
printf "\n# Installing Fisher Extensions ################################################\n\n"
<<fish-extensions-gen()>>
printf "\n# Installing Fisher Extensions ################################################\n\n"
<<fish-extensions-gen()>>
#+END_SRC

3693
org/config/emacs.org

File diff suppressed because it is too large Load Diff

250
org/config/fish.org

@ -18,9 +18,9 @@ abbreviations. @@ -18,9 +18,9 @@ abbreviations.
Just in case, we might need sometimes to declare the fish function =fish_title=
as =true=, so let’s do so.
#+BEGIN_SRC fish
function fish_title
true
end
function fish_title
true
end
#+END_SRC
* Fish from within Emacs
@ -30,9 +30,9 @@ as =true=, so let’s do so. @@ -30,9 +30,9 @@ as =true=, so let’s do so.
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
if test -n "$EMACS"
set -x TERM eterm-color
end
#+END_SRC
* Tramp remote access
@ -44,14 +44,14 @@ precise shell appearance: a simple =$= followed by a space after which to put @@ -44,14 +44,14 @@ 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
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
@ -63,88 +63,88 @@ when I’m the one using it: the ~fish_greeting~ function. I use it to give me a @@ -63,88 +63,88 @@ when I’m the one using it: the ~fish_greeting~ function. I use it to give me a
overview of my computer’s 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'
set NC '\033[0m'
function display_slider # used total
set -l slider_length 38
set -l used $argv[1]
set -l total $argv[2]
set -l used_slider (math -s0 "($used * $slider_length) / $total")
set -l unused_slider (math -s0 "$slider_length - $used_slider")
echo -en "["
echo -en $RED
echo -en (string repeat -n $used_slider '=')
echo -en $GREEN
echo -en (string repeat -n $unused_slider '=')
echo -en $NC
echo -en "]"
end
function fish_greeting
set -l ruler_length 79
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 -p | sed 's/up //')
set -l root (df -Ph | grep -E "/\$")
set -l root_p (echo $root | awk '{print $5}' | tr -d '%')
set -l root_used (echo $root | awk '{print $3}')
set -l root_total (echo $root | awk '{print $2}')
set -l ram (free -tm | grep Mem)
set -l ram_total (echo $ram | awk '{print $2}')
set -l ram_used (echo $ram | awk '{print $3}')
set -l ram_p (math -s0 "$ram_used / $ram_total * 100")
set -l swap (free -tm | grep Swap)
set -l swap_total (echo $swap | awk '{print $2}')
set -l swap_used (echo $swap | awk '{print $3}')
set -l swap_p (math -s0 "$swap_used / $swap_total * 100")
set -l connections (nmcli c s | grep -E "wifi|ethernet" | grep -v '\-\-')
set -l wifi (echo $connections | grep "wifi" | awk '{print $1}')
set -l ethernet (test "$connections" = "*ethernet*" && echo -e $GREEN"UP"$NC || echo -e $RED"DOWN"$NC)
set -l wifi (test -n wifi && echo -e $GREEN$wifi$NC || echo - $RED"DOWN"$NC)
echo $ruler
printf "OS......: %-30sKernel: %s %s\n" $osname (uname -s) (uname -r)
printf "Hostname: %-30sUptime: %s\n" (hostname) $uptime
printf "Ethernet: %-41sWifi..: %s\n" $ethernet $wifi
printf "Disks...: %-6s %s %6s / %6s (%2d%%)\n" "/" (display_slider $root_p 100) $root_used $root_total $root_p
# loop other mountpoints
for mp in (df -Ph 2> /dev/null | egrep "sd|tank|nvme" | egrep -v "boot|/\$")
set -l mp_p (echo $mp | awk '{print $5}' | tr -d '%')
set -l mp_used (echo $mp | awk '{print $3}')
set -l mp_total (echo $mp | awk '{print $2}')
set -l mp_name (echo $mp | awk '{print $6}')
printf " %-6s %s %6s / %6s (%2d%%)\n" $mp_name (display_slider $mp_p 100) $mp_used $mp_total $mp_p
end
printf "Ram.....: %s %5dM / %5dM (%2d%%)\n" (display_slider $ram_used $ram_total) $ram_used $ram_total $ram_p
printf "Swap....: %s %5dM / %5dM (%2d%%)\n" (display_slider $swap_used $swap_total) $swap_used $swap_total $swap_p
echo $ruler
end
set RED '\033[0;31m'
set GREEN '\033[0;32m'
set NC '\033[0m'
function display_slider # used total
set -l slider_length 38
set -l used $argv[1]
set -l total $argv[2]
set -l used_slider (math -s0 "($used * $slider_length) / $total")
set -l unused_slider (math -s0 "$slider_length - $used_slider")
echo -en "["
echo -en $RED
echo -en (string repeat -n $used_slider '=')
echo -en $GREEN
echo -en (string repeat -n $unused_slider '=')
echo -en $NC
echo -en "]"
end
function fish_greeting
set -l ruler_length 79
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 -p | sed 's/up //')
set -l root (df -Ph | grep -E "/\$")
set -l root_p (echo $root | awk '{print $5}' | tr -d '%')
set -l root_used (echo $root | awk '{print $3}')
set -l root_total (echo $root | awk '{print $2}')
set -l ram (free -tm | grep Mem)
set -l ram_total (echo $ram | awk '{print $2}')
set -l ram_used (echo $ram | awk '{print $3}')
set -l ram_p (math -s0 "$ram_used / $ram_total * 100")
set -l swap (free -tm | grep Swap)
set -l swap_total (echo $swap | awk '{print $2}')
set -l swap_used (echo $swap | awk '{print $3}')
set -l swap_p (math -s0 "$swap_used / $swap_total * 100")
set -l connections (nmcli c s | grep -E "wifi|ethernet" | grep -v '\-\-')
set -l wifi (echo $connections | grep "wifi" | awk '{print $1}')
set -l ethernet (test "$connections" = "*ethernet*" && echo -e $GREEN"UP"$NC || echo -e $RED"DOWN"$NC)
set -l wifi (test -n wifi && echo -e $GREEN$wifi$NC || echo - $RED"DOWN"$NC)
echo $ruler
printf "OS......: %-30sKernel: %s %s\n" $osname (uname -s) (uname -r)
printf "Hostname: %-30sUptime: %s\n" (hostname) $uptime
printf "Ethernet: %-41sWifi..: %s\n" $ethernet $wifi
printf "Disks...: %-6s %s %6s / %6s (%2d%%)\n" "/" (display_slider $root_p 100) $root_used $root_total $root_p
# loop other mountpoints
for mp in (df -Ph 2> /dev/null | egrep "sd|tank|nvme" | egrep -v "boot|/\$")
set -l mp_p (echo $mp | awk '{print $5}' | tr -d '%')
set -l mp_used (echo $mp | awk '{print $3}')
set -l mp_total (echo $mp | awk '{print $2}')
set -l mp_name (echo $mp | awk '{print $6}')
printf " %-6s %s %6s / %6s (%2d%%)\n" $mp_name (display_slider $mp_p 100) $mp_used $mp_total $mp_p
end
printf "Ram.....: %s %5dM / %5dM (%2d%%)\n" (display_slider $ram_used $ram_total) $ram_used $ram_total $ram_p
printf "Swap....: %s %5dM / %5dM (%2d%%)\n" (display_slider $swap_used $swap_total) $swap_used $swap_total $swap_p
echo $ruler
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)~.
#+BEGIN_SRC fish
set -g theme_date_format "+%g-%m-%d %H:%M:%S"
set -g theme_date_format "+%g-%m-%d %H:%M:%S"
#+END_SRC
I also wish to have a kinda different newline prompt, so let’s set it:
#+BEGIN_SRC fish
set -g theme_newline_prompt 'λ '
set -g theme_newline_prompt 'λ '
#+END_SRC
Finally, let’s set our prompt’s theme to the Nord theme.
#+BEGIN_SRC fish
set -g theme_color_scheme nord
set -g theme_color_scheme nord
#+END_SRC
* Global variables
@ -154,24 +154,24 @@ Finally, let’s set our prompt’s theme to the Nord theme. @@ -154,24 +154,24 @@ Finally, let’s set our prompt’s theme to the Nord theme.
In order to keep some other code clean, I set the ~$BROWSER~ variable so I don’t
have to call my web browser directly but rather with this variable.
#+BEGIN_SRC fish
set -gx BROWSER firefox
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, let’s declare it.
#+BEGIN_SRC fish
set -gx SUDO_ASKPASS ~/.local/bin/askpass
set -gx SUDO_ASKPASS ~/.local/bin/askpass
#+END_SRC
In general, I prefer using ~bat~ to ~less~, although the former relies on the
latter, but ~bat~ provides nice wrapping around ~less~, including syntax
highlighting. Let’s set the manpager to bat then:
#+BEGIN_SRC fish
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
#+END_SRC
#+begin_src fish
set -x XMODIFIERS
set -x XMODIFIERS
#+end_src
** Development
@ -182,8 +182,8 @@ Now, let’s declare our editor of choice, EmacsClient; not Emacs itself since i @@ -182,8 +182,8 @@ Now, let’s declare our editor of choice, EmacsClient; not Emacs itself since i
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
set -gx EDITOR emacsclient -c
set -gx VISUAL emacsclient -c
#+END_SRC
We also need to set the path to the Dart SDK.
@ -198,21 +198,21 @@ set -gx ANDROID_HOME $HOME/Android/Sdk @@ -198,21 +198,21 @@ set -gx ANDROID_HOME $HOME/Android/Sdk
Still related to Dart and Flutter development,
#+BEGIN_SRC fish
set -gx CHROME_EXECUTABLE /usr/bin/chromium
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).
#+BEGIN_SRC fish
set -gx DENO_DIR $HOME/.config/deno
set -gx DENO_INSTALL_ROOT $HOME/.local/bin/deno
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
let’s do so.
#+BEGIN_SRC fish
set -gx PKG_CONFIG_PATH /usr/local/lib/pkgconfig/ $PKG_CONFIG_PATH
set -gx PKG_CONFIG_PATH /usr/local/lib/pkgconfig/ $PKG_CONFIG_PATH
#+END_SRC
** ~$PATH~
@ -237,8 +237,8 @@ my own executables, and some more. @@ -237,8 +237,8 @@ my own executables, and some more.
#+NAME: generate-extra-paths
#+BEGIN_SRC emacs-lisp :var paths=extra-paths[,0] :exports none :cache yes
(mapconcat #'identity
paths " \\\n")
(mapconcat #'identity
paths " \\\n")
#+END_SRC
#+RESULTS[3fd24377f29513d4c7edcd9621d0462665efb403]: generate-extra-paths
@ -251,8 +251,8 @@ my own executables, and some more. @@ -251,8 +251,8 @@ my own executables, and some more.
So, let’s set our user paths:
#+BEGIN_SRC fish :noweb yes
set -g fish_user_paths \
<<generate-extra-paths()>>
set -g fish_user_paths \
<<generate-extra-paths()>>
#+END_SRC
* Abbreviations
@ -261,12 +261,12 @@ So, let’s set our user paths: @@ -261,12 +261,12 @@ So, let’s set our user paths:
:END:
#+NAME: generate-abbr
#+BEGIN_SRC emacs-lisp :var table=[] :exports none :tangle no
(replace-regexp-in-string "\\\\vert[{}]*"
"|"
(mapconcat (lambda (x) (format "abbr %s '%s'" (car x) (cadr x)))
table
"\n")
t t)
(replace-regexp-in-string "\\\\vert[{}]*"
"|"
(mapconcat (lambda (x) (format "abbr %s '%s'" (car x) (cadr x)))
table
"\n")
t t)
#+END_SRC
Abbreviations are a great way to keep correctly track of which commands are run
@ -306,7 +306,7 @@ running right now, and =pscpu10= limits that to the top 10 threads. Similarly, @@ -306,7 +306,7 @@ running right now, and =pscpu10= limits that to the top 10 threads. Similarly,
| psmem10 | ps auxf \vert sort -nr -k 4 \vert head -10 |
#+begin_SRC fish
<<generate-abbr(table=mgmt-abbr)>>
<<generate-abbr(table=mgmt-abbr)>>
#+END_SRC
** System management (packages and services)
@ -332,7 +332,7 @@ can type =search=. Otherwise, if I want to include AUR results, I’ll use =paru @@ -332,7 +332,7 @@ can type =search=. Otherwise, if I want to include AUR results, I’ll use =paru
| purge | paru -Sc |
#+BEGIN_SRC fish
<<generate-abbr(table=pm-abbr)>>
<<generate-abbr(table=pm-abbr)>>
#+END_SRC
*** Service management
@ -349,7 +349,7 @@ system services, I can instead type a simple capital =S=. @@ -349,7 +349,7 @@ system services, I can instead type a simple capital =S=.
| suser | systemctl --user |
#+BEGIN_SRC fish
<<generate-abbr(table=service-abbr)>>
<<generate-abbr(table=service-abbr)>>
#+END_SRC
** Development
@ -373,7 +373,7 @@ configuration for debug or release profiles. @@ -373,7 +373,7 @@ configuration for debug or release profiles.
Here is the corresponding fish configuration:
#+BEGIN_SRC fish
<<generate-abbr(table=abbr-cmake)>>
<<generate-abbr(table=abbr-cmake)>>
#+END_SRC
*** Docker
@ -398,7 +398,7 @@ full command, so I use these instead. @@ -398,7 +398,7 @@ full command, so I use these instead.
Here is the corresponding fish configuration:
#+BEGIN_SRC fish
<<generate-abbr(table=abbr-docker)>>
<<generate-abbr(table=abbr-docker)>>
#+END_SRC
*** Text editors
@ -419,7 +419,7 @@ In case we want to launch Emacs in GUI mode anyways, ~egui~ is available too. @@ -419,7 +419,7 @@ In case we want to launch Emacs in GUI mode anyways, ~egui~ is available too.
Here is the corresponding fish configuration:
#+BEGIN_SRC fish :noweb yes
<<generate-abbr(table=abbr-text-ed)>>
<<generate-abbr(table=abbr-text-ed)>>
#+END_SRC
*** Compilation
@ -438,7 +438,7 @@ with the ~-Wall~ flag activated. @@ -438,7 +438,7 @@ with the ~-Wall~ flag activated.
Here is the corresponding fish configuration:
#+BEGIN_SRC fish
<<generate-abbr(table=abbr-comp)>>
<<generate-abbr(table=abbr-comp)>>
#+END_SRC
*** Git
@ -455,7 +455,7 @@ covered. @@ -455,7 +455,7 @@ covered.
Here is the corresponding fish configuration:
#+BEGIN_SRC fish
<<generate-abbr(table=abbr-git)>>
<<generate-abbr(table=abbr-git)>>
#+END_SRC
** LaTeX
@ -475,7 +475,7 @@ abbreviation. Same goes for ~texhash~ which must be run as sudo. @@ -475,7 +475,7 @@ abbreviation. Same goes for ~texhash~ which must be run as sudo.
Here is the corresponding fish configuration:
#+BEGIN_SRC fish
<<generate-abbr(table=latex-abbr)>>
<<generate-abbr(table=latex-abbr)>>
#+END_SRC
** Some security measures
@ -507,7 +507,7 @@ accidentally removing the root folder. I added the same option to =chgrp=, @@ -507,7 +507,7 @@ accidentally removing the root folder. I added the same option to =chgrp=,
Here is the corresponding fish configuration:
#+BEGIN_SRC fish
<<generate-abbr(table=sec-abbr)>>
<<generate-abbr(table=sec-abbr)>>
#+END_SRC
** Typos
@ -530,7 +530,7 @@ So, let's just replace the former by the latter. I'm also very bad at typing @@ -530,7 +530,7 @@ So, let's just replace the former by the latter. I'm also very bad at typing
Here is the corresponding fish configuration:
#+BEGIN_SRC fish
<<generate-abbr(table=typo-abbr)>>
<<generate-abbr(table=typo-abbr)>>
#+END_SRC
** Misc
@ -548,33 +548,33 @@ Here you will find various commands related to media in general. the first one @@ -548,33 +548,33 @@ 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" &'
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.
#+BEGIN_SRC fish
abbr mpv 'mpv --no-border --force-window=no'
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"'
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.
#+BEGIN_SRC fish
abbr sxiv '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:
#+BEGIN_SRC fish
abbr webcam 'devour mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0'
abbr webcam 'devour mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0'
#+END_SRC
*** Sudo
@ -585,7 +585,7 @@ First, I make it so that ~sudo~ comes with the ~-A~ switch in order to call my @@ -585,7 +585,7 @@ 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'
abbr please 'sudo -A'
#+END_SRC
*** History
@ -595,7 +595,7 @@ custom graphical script for getting my password (see [[file:bin.org::#Askpass-d0 @@ -595,7 +595,7 @@ custom graphical script for getting my password (see [[file:bin.org::#Askpass-d0
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
abbr hist history
#+END_SRC
*** Compression
@ -614,7 +614,7 @@ management]]). @@ -614,7 +614,7 @@ management]]).
| untar | tar -xvzf |
#+BEGIN_SRC fish
<<generate-abbr(table=tar-abbr)>>
<<generate-abbr(table=tar-abbr)>>
#+END_SRC
*** exa
@ -628,7 +628,7 @@ management]]). @@ -628,7 +628,7 @@ management]]).
| lsl | exa -halg@ --group-directories-first --git |
#+BEGIN_SRC fish
<<generate-abbr(table=exa-abbr)>>
<<generate-abbr(table=exa-abbr)>>
#+END_SRC
*** Network Management
@ -638,7 +638,7 @@ management]]). @@ -638,7 +638,7 @@ management]]).
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'
abbr nmcli 'nmcli -p -c auto'
#+END_SRC
*** NordVPN
@ -662,7 +662,7 @@ the US. @@ -662,7 +662,7 @@ the US.
| ncu | nordvpn c United_States |
#+BEGIN_SRC fish
<<generate-abbr(table=nordvpn-abbr)>>
<<generate-abbr(table=nordvpn-abbr)>>
#+END_SRC
*** Wget
@ -671,7 +671,7 @@ the US. @@ -671,7 +671,7 @@ the US.
:END:
By default, continue a download that was interupted.
#+BEGIN_SRC fish
abbr wget 'wget -c'
abbr wget 'wget -c'
#+END_SRC
* Last thing before we’re done

190
org/config/index.org

@ -126,23 +126,23 @@ This file is tangled at ~$HOME/.gtkrc-2.0~. This is an equivalent for the GTK3 @@ -126,23 +126,23 @@ This file is tangled at ~$HOME/.gtkrc-2.0~. This is an equivalent for the GTK3
configuration file you will see below, and it shares most of its settings.
First, let’s select the Nordic theme for GTK2. Let’s also set the icon theme.
#+BEGIN_SRC conf-unix
# -*- mode: unix-config -*-
gtk-theme-name="Nordic"
gtk-icon-theme-name="Flat-Remix-Dark"
# -*- mode: unix-config -*-
gtk-theme-name="Nordic"
gtk-icon-theme-name="Flat-Remix-Dark"
#+END_SRC
#+BEGIN_SRC conf-unix
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintslight"
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintslight"
#+END_SRC
This changes the shortcuts in menu, let’s also make the menus snappier.
#+BEGIN_SRC conf-unix
gtk-can-change-accels=1
gtk-menu-bar-popup-delay=0
gtk-menu-popdown-delay=0
gtk-menu-popup-delay=0
gtk-can-change-accels=1
gtk-menu-bar-popup-delay=0
gtk-menu-popdown-delay=0
gtk-menu-popup-delay=0
#+END_SRC
***** Filechooser
@ -151,60 +151,60 @@ This changes the shortcuts in menu, let’s also make the menus snappier. @@ -151,60 +151,60 @@ This changes the shortcuts in menu, let’s also make the menus snappier.
:CUSTOM_ID: Features-Graphical_tweaks-GTK_Settings-GTK2-Filechooser-389f040d
:END:
#+BEGIN_SRC conf-unix
[Filechooser Settings]
[Filechooser Settings]
#+END_SRC
The first option alows me to open the file chooser in the current working
directory:
#+BEGIN_SRC conf-unix
StartupMode=cwd
StartupMode=cwd
#+END_SRC
Next, setting the location mode to ~path-bar~ will show the path as buttons that
can be clicked rather than the full path.
#+BEGIN_SRC conf-unix
LocationMode=path-bar
LocationMode=path-bar
#+END_SRC
With this configuration, by default we won’t see hidden files.
#+BEGIN_SRC conf-unix
ShowHidden=true
ShowHidden=true
#+END_SRC
And we'll also see the size of the visible files.
#+BEGIN_SRC conf-unix
ShowSizeColumn=true
ShowSizeColumn=true
#+END_SRC
Now, let’s choose the geometry of our file picker. These two first lines set
where the file picker appears:
#+BEGIN_SRC conf-unix
GeometryX=566
GeometryY=202
GeometryX=566
GeometryY=202
#+END_SRC
And these two describe the size of the window:
#+BEGIN_SRC conf-unix
GeometryWidth=800
GeometryHeight=400
GeometryWidth=800
GeometryHeight=400
#+END_SRC
With these two lines, we set how our files are sorted: by name, and in the
ascending order.
#+BEGIN_SRC conf-unix
SortColumn=name
SortOrder=ascending
SortColumn=name
SortOrder=ascending
#+END_SRC
Our default view mode is a list of files:
#+BEGIN_SRC conf-unix
ViewMode=list-view
ViewMode=list-view
#+END_SRC
And finally, setting our icon view scale to ~-1~ sets the icon view to the max
size.
#+BEGIN_SRC conf-unix
IconViewScale=-1
IconViewScale=-1
#+END_SRC
**** GTK3
@ -215,44 +215,44 @@ size. @@ -215,44 +215,44 @@ size.
The following file helps me choosing the aspect of various GTK+ 3 software,
including their theme and icons. First, let’s declare the header:
#+BEGIN_SRC conf-unix
[Settings]
[Settings]
#+END_SRC
Now, let’s hint to GTK that I prefer dark themes. This can have an influence
also on some websites that can detect this preference and therefore set their
own theme to dark by themselves.
#+BEGIN_SRC conf-unix
gtk-application-prefer-dark-theme = true
gtk-application-prefer-dark-theme = true
#+END_SRC
Next, the icon theme is the Flat Remix Dark icon theme:
#+BEGIN_SRC conf-unix
gtk-icon-theme-name = Flat-Remix-Dark
gtk-icon-theme-name = Flat-Remix-Dark
#+END_SRC
Now, the general theme for GTK3 is Nordic.
#+BEGIN_SRC conf-unix
gtk-theme-name = Nordic
gtk-theme-name = Nordic
#+END_SRC
#+BEGIN_SRC conf-unix
gtk-can-change-accels=1
gtk-menu-bar-popup-delay=0
gtk-menu-popdown-delay=0
gtk-menu-popup-delay=0
gtk-can-change-accels=1
gtk-menu-bar-popup-delay=0
gtk-menu-popdown-delay=0
gtk-menu-popup-delay=0
#+END_SRC
#+BEGIN_SRC conf-unix
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintslight
# gtk-xft-rgba=rgb
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintslight
# gtk-xft-rgba=rgb
#+END_SRC
Since window decorations are handled by my WMs, I will leave this variable
empty.
#+BEGIN_SRC conf-unix
gtk-decoration-layout=
gtk-decoration-layout=
#+END_SRC
*** Picom (Compton)
@ -271,45 +271,45 @@ You can find my Picom configuration [[file:picom.org][here]]. @@ -271,45 +271,45 @@ You can find my Picom configuration [[file:picom.org][here]].
The main body in my Xresources declaration is the declaration of my
color theme. It is based on the [[https://www.nordtheme.com/][Nord]] theme, from their [[https://github.com/arcticicestudio/nord-xresources/][Git repository]].
#+BEGIN_SRC conf
#define nord0 #2E3440
#define nord1 #3B4252
#define nord2 #434C5E
#define nord3 #4C566A
#define nord4 #D8DEE9
#define nord5 #E5E9F0
#define nord6 #ECEFF4
#define nord7 #8FBCBB
#define nord8 #88C0D0
#define nord9 #81A1C1
#define nord10 #5E81AC
#define nord11 #BF616A
#define nord12 #D08770
#define nord13 #EBCB8B
#define nord14 #A3BE8C
#define nord15 #B48EAD
,*.foreground: nord4
,*.background: nord0
,*.cursorColor: nord4
,*fading: 35
,*fadeColor: nord3
,*.color0: nord1
,*.color1: nord11
,*.color2: nord14
,*.color3: nord13
,*.color4: nord9
,*.color5: nord15
,*.color6: nord8
,*.color7: nord5
,*.color8: nord3
,*.color9: nord11
,*.color10: nord14
,*.color11: nord13
,*.color12: nord9
,*.color13: nord15
,*.color14: nord7
,*.color15: nord6
#define nord0 #2E3440
#define nord1 #3B4252
#define nord2 #434C5E
#define nord3 #4C566A
#define nord4 #D8DEE9
#define nord5 #E5E9F0
#define nord6 #ECEFF4
#define nord7 #8FBCBB
#define nord8 #88C0D0
#define nord9 #81A1C1
#define nord10 #5E81AC
#define nord11 #BF616A
#define nord12 #D08770
#define nord13 #EBCB8B
#define nord14 #A3BE8C
#define nord15 #B48EAD
,*.foreground: nord4
,*.background: nord0
,*.cursorColor: nord4
,*fading: 35
,*fadeColor: nord3
,*.color0: nord1
,*.color1: nord11
,*.color2: nord14
,*.color3: nord13
,*.color4: nord9
,*.color5: nord15
,*.color6: nord8
,*.color7: nord5
,*.color8: nord3
,*.color9: nord11
,*.color10: nord14
,*.color11: nord13
,*.color12: nord9
,*.color13: nord15
,*.color14: nord7
,*.color15: nord6
#+END_SRC
** Text and source code editing