Update templates from os to distro_id

This commit is contained in:
Marko Korhonen 2022-09-20 18:04:16 +03:00
parent f616bcb60e
commit b61e35da16
Signed by: FunctionalHacker
GPG key ID: A7F78BCB859CD890
3 changed files with 14 additions and 14 deletions

View file

@ -61,12 +61,12 @@ export MANPAGER="$EDITOR +\"lua require 'pager'\" +Man!"
export SYSTEMD_EDITOR=$EDITOR export SYSTEMD_EDITOR=$EDITOR
export SYSTEMD_PAGER=less 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 if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi fi
gpgconf --launch gpg-agent gpgconf --launch gpg-agent
{%@@ elif os == "termux" @@%} {%@@ elif distro_id == "termux" @@%}
eval $(okc-ssh-agent) eval $(okc-ssh-agent)
{%@@ endif @@%} {%@@ endif @@%}

View file

@ -39,10 +39,10 @@ zinit ice lucid atinit'zpcompinit'
zinit light zdharma-continuum/fast-syntax-highlighting zinit light zdharma-continuum/fast-syntax-highlighting
# use fzf with zsh # use fzf with zsh
{%@@ if os == "arch" @@%} {%@@ if distro_id == "arch" @@%}
source /usr/share/fzf/key-bindings.zsh source /usr/share/fzf/key-bindings.zsh
source /usr/share/fzf/completion.zsh source /usr/share/fzf/completion.zsh
{%@@ elif os == "ubuntu" @@%} {%@@ elif distro_id == "ubuntu" @@%}
# Source from home directory since ubuntu has # Source from home directory since ubuntu has
# old version of FZF in it's repositories # old version of FZF in it's repositories
source ~/Software/fzf/shell/key-bindings.zsh source ~/Software/fzf/shell/key-bindings.zsh

View file

@ -13,19 +13,19 @@ forgit_revert_commit=fgrc
alias ls='exa' alias ls='exa'
# Enable command not found handler # Enable command not found handler
{%@@ if os == "arch" @@%} {%@@ if distro_id == "arch" @@%}
source /usr/share/doc/pkgfile/command-not-found.zsh source /usr/share/doc/pkgfile/command-not-found.zsh
{%@@ elif os == "ubuntu" @@%} {%@@ elif distro_id == "ubuntu" @@%}
source /etc/zsh_command_not_found source /etc/zsh_command_not_found
{%@@ elif os == "termux" @@%} {%@@ elif distro_id == "termux" @@%}
function command_not_found_handler { function command_not_found_handler {
$PREFIX/libexec/termux/command-not-found $1 $PREFIX/libexec/termux/command-not-found $1
} }
{%@@ endif @@%} {%@@ endif @@%}
{%@@ if os == "arch" @@%} {%@@ if distro_id == "arch" @@%}
# search and install/remove packages with fzf # search and install/remove packages with fzf
pi() { pi() {
SELECTED_PKGS="$(paru -Slq | fzf --header='Install packages' -m --preview 'paru -Si {1}')" SELECTED_PKGS="$(paru -Slq | fzf --header='Install packages' -m --preview 'paru -Si {1}')"
if [ -n "$SELECTED_PKGS" ]; then if [ -n "$SELECTED_PKGS" ]; then
# Append the expanded command to history # Append the expanded command to history
@ -33,7 +33,7 @@ pi() {
paru -S $(echo $SELECTED_PKGS) paru -S $(echo $SELECTED_PKGS)
fi fi
} }
pr() { pr() {
SELECTED_PKGS="$(paru -Qsq | fzf --header='Remove packages' -m --preview 'paru -Si {1}')" SELECTED_PKGS="$(paru -Qsq | fzf --header='Remove packages' -m --preview 'paru -Si {1}')"
if [ -n "$SELECTED_PKGS" ]; then if [ -n "$SELECTED_PKGS" ]; then
# Append the expanded command to history # Append the expanded command to history
@ -43,7 +43,7 @@ pr() {
} }
{%@@ endif @@%} {%@@ endif @@%}
{%@@ if os == "termux" @@%} {%@@ if distro_id == "termux" @@%}
alias gp='okc-gpg' alias gp='okc-gpg'
{%@@ endif @@%} {%@@ endif @@%}
@ -126,11 +126,11 @@ update() {
} }
packages() { packages() {
{%@@ if os == "arch" @@%} {%@@ if distro_id == "arch" @@%}
paru paru
{%@@ elif os == "ubuntu" @@%} {%@@ elif distro_id == "ubuntu" @@%}
sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y && sudo apt autoclean -y 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 pkg update
{%@@ endif @@%} {%@@ endif @@%}
} }