From b61e35da169ea2cf694c709c1643e7dc9844776c Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Tue, 20 Sep 2022 18:04:16 +0300 Subject: [PATCH] Update templates from os to distro_id --- home/.config/zsh/02-env.zsh | 4 ++-- home/.config/zsh/03-plugins.zsh | 4 ++-- home/.config/zsh/04-aliases.zsh | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/home/.config/zsh/02-env.zsh b/home/.config/zsh/02-env.zsh index f60d3c3..5ed9d88 100644 --- a/home/.config/zsh/02-env.zsh +++ b/home/.config/zsh/02-env.zsh @@ -61,12 +61,12 @@ export MANPAGER="$EDITOR +\"lua require 'pager'\" +Man!" export SYSTEMD_EDITOR=$EDITOR export SYSTEMD_PAGER=less -{%@@ if os == "arch" or os == "ubuntu" @@%} +{%@@ if distro_id == "arch" or distro_id == "ubuntu" @@%} if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" fi gpgconf --launch gpg-agent -{%@@ elif os == "termux" @@%} +{%@@ elif distro_id == "termux" @@%} eval $(okc-ssh-agent) {%@@ endif @@%} diff --git a/home/.config/zsh/03-plugins.zsh b/home/.config/zsh/03-plugins.zsh index 259fdb9..ed76062 100644 --- a/home/.config/zsh/03-plugins.zsh +++ b/home/.config/zsh/03-plugins.zsh @@ -39,10 +39,10 @@ zinit ice lucid atinit'zpcompinit' zinit light zdharma-continuum/fast-syntax-highlighting # use fzf with zsh -{%@@ if os == "arch" @@%} +{%@@ if distro_id == "arch" @@%} source /usr/share/fzf/key-bindings.zsh source /usr/share/fzf/completion.zsh -{%@@ elif os == "ubuntu" @@%} +{%@@ elif distro_id == "ubuntu" @@%} # Source from home directory since ubuntu has # old version of FZF in it's repositories source ~/Software/fzf/shell/key-bindings.zsh diff --git a/home/.config/zsh/04-aliases.zsh b/home/.config/zsh/04-aliases.zsh index 1b9b79c..e226602 100644 --- a/home/.config/zsh/04-aliases.zsh +++ b/home/.config/zsh/04-aliases.zsh @@ -13,19 +13,19 @@ forgit_revert_commit=fgrc alias ls='exa' # Enable command not found handler -{%@@ if os == "arch" @@%} +{%@@ if distro_id == "arch" @@%} source /usr/share/doc/pkgfile/command-not-found.zsh -{%@@ elif os == "ubuntu" @@%} +{%@@ elif distro_id == "ubuntu" @@%} source /etc/zsh_command_not_found -{%@@ elif os == "termux" @@%} +{%@@ elif distro_id == "termux" @@%} function command_not_found_handler { $PREFIX/libexec/termux/command-not-found $1 } {%@@ endif @@%} -{%@@ if os == "arch" @@%} +{%@@ if distro_id == "arch" @@%} # search and install/remove packages with fzf -pi() { +pi() { SELECTED_PKGS="$(paru -Slq | fzf --header='Install packages' -m --preview 'paru -Si {1}')" if [ -n "$SELECTED_PKGS" ]; then # Append the expanded command to history @@ -33,7 +33,7 @@ pi() { paru -S $(echo $SELECTED_PKGS) fi } -pr() { +pr() { SELECTED_PKGS="$(paru -Qsq | fzf --header='Remove packages' -m --preview 'paru -Si {1}')" if [ -n "$SELECTED_PKGS" ]; then # Append the expanded command to history @@ -43,7 +43,7 @@ pr() { } {%@@ endif @@%} -{%@@ if os == "termux" @@%} +{%@@ if distro_id == "termux" @@%} alias gp='okc-gpg' {%@@ endif @@%} @@ -126,11 +126,11 @@ update() { } packages() { - {%@@ if os == "arch" @@%} + {%@@ if distro_id == "arch" @@%} paru - {%@@ elif os == "ubuntu" @@%} + {%@@ elif distro_id == "ubuntu" @@%} sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y && sudo apt autoclean -y - {%@@ elif os == "termux" @@%} + {%@@ elif distro_id == "termux" @@%} pkg update {%@@ endif @@%} }