From 8475773ea6ba707c4f66b359795e9c62d88b5069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Sch=C3=A4ferdiek?= Date: Fri, 26 Jul 2019 17:04:50 +0200 Subject: [PATCH] Clean up zshrc from custom systemd and archlinux specific commands and outsource them into custom files --- etc/skel/.zsh_archlinux | 32 ++++++++++++++ etc/skel/.zsh_systemd | 37 ++++++++++++++++ etc/skel/.zshrc | 93 ++++++++--------------------------------- 3 files changed, 86 insertions(+), 76 deletions(-) create mode 100644 etc/skel/.zsh_archlinux create mode 100644 etc/skel/.zsh_systemd diff --git a/etc/skel/.zsh_archlinux b/etc/skel/.zsh_archlinux new file mode 100644 index 0000000..e8fd3c9 --- /dev/null +++ b/etc/skel/.zsh_archlinux @@ -0,0 +1,32 @@ +#!/usr/bin/env zsh + +alias pkgfile-update="sudo pkgfile --update" +alias pac="yay" +alias pkg-upgrade="yay && pacman-orphans && sudo paccache -rk 2 && sync" +alias pkg-upgrade-full="yay -Syyu --devel && pacman-orphans && sudo paccache -rk 2 && sync" +alias pacdiff-merge='sudo DIFFPROG=meld DIFFSEARCHPATH="/boot /etc /usr" pacdiff' +alias font-cache-update='sudo fc-cache -vf' +alias mkinitcpio-linux='sudo mkinitcpio -p linux' + +pacman-orphans() { + if [[ ! -n $(pacman -Qdt) ]]; then + echo "No orphans to remove." + else + sudo pacman -Rns $(pacman -Qdtq) + fi +} + +pacman-unneeded() { + ignoregrp="base base-devel" + ignorepkg="" + + comm -23 <(pacman -Qqt | sort) <(echo $ignorepkg | tr ' ' '\n' | cat <(pacman -Sqg $ignoregrp) - | sort -u) +} + +pacman-modified() { + pacman -Qii | awk '/^MODIFIED/ {print $2}' +} + +pacman-disowned() { + sudo lostfiles +} \ No newline at end of file diff --git a/etc/skel/.zsh_systemd b/etc/skel/.zsh_systemd new file mode 100644 index 0000000..d31f8ed --- /dev/null +++ b/etc/skel/.zsh_systemd @@ -0,0 +1,37 @@ +#!/usr/bin/env zsh + +alias systemctl-list-running-services="sudo systemctl --type=service" +alias systemctl-list-units='sudo systemctl list-units' +alias systemctl-list-unit-files='sudo systemctl list-unit-files' +alias systemctl-failed='sudo systemctl --failed' +alias systemctl-daemon-reload='sudo systemctl daemon-reload' +alias journalctl-error='sudo journalctl -b --priority 0..3' +alias journalctl-user='journalctl -b' + +shutdown-timer() { + bash -c 'echo "System is going to shutdown in $1 minute(s)..." + sleep $1m + systemctl poweroff' -- $1 +} + +hibernate-timer() { + bash -c 'echo "System is going to hibernate in $1 minute(s)..." + sleep $1m + systemctl hibernate' -- $1 +} + +shutdown() { + systemctl poweroff +} + +hibernate() { + systemctl hibernate +} + +standby() { + systemctl suspend +} + +restart() { + systemctl reboot +} \ No newline at end of file diff --git a/etc/skel/.zshrc b/etc/skel/.zshrc index 6ddb17a..361621a 100644 --- a/etc/skel/.zshrc +++ b/etc/skel/.zshrc @@ -1,3 +1,7 @@ +# This configuration makes use of zsh-syntax-highlighting. +# Some alias will call pre-defined applications. +# Ensure to install them if a command is not working. +# # SETTINGS autoload -U compinit promptinit autoload -U colors && colors @@ -14,10 +18,13 @@ LS_COLORS='rs=0:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;3 # HISTORY HISTFILE=~/.zsh_history -HISTSIZE=2000 -SAVEHIST=2000 +HISTSIZE=10000 +SAVEHIST=10000 -# ALIAS +# EXPORTS +export LS_COLORS + +# ALIAS & FUNCTIONS alias ls="ls --color -F" alias ll="ls --color -lh -a" alias ll-octal-dir='stat -c "%a %n" *' @@ -32,54 +39,6 @@ alias fd='fd -H' alias e='$EDITOR' alias edit='$EDITOR' -alias pac="yay" -alias pkg-upgrade="yay && pacman-orphans && sudo paccache -rk 2 && sync" -alias pkg-upgrade-full="yay -Syyu --devel && pacman-orphans && sudo paccache -rk 2 && sync" -alias pacdiff-merge='sudo DIFFPROG=vimdiff DIFFSEARCHPATH="/boot /etc /usr" pacdiff' -alias font-cache-update='sudo fc-cache -vf' -alias mkinitcpio-linux='sudo mkinitcpio -p linux' -alias systemctl-list-running-services="sudo systemctl --type=service" -alias systemctl-list-units='sudo systemctl list-units' -alias systemctl-list-unit-files='sudo systemctl list-unit-files' -alias systemctl-failed='sudo systemctl --failed' -alias systemctl-daemon-reload='sudo systemctl daemon-reload' -alias journalctl-error='sudo journalctl -b --priority 0..3' -alias journalctl-user='journalctl -b' - -# EXPORTS -export LS_COLORS - -# FUNCTIONS -# systemd -shutdown-timer() { - bash -c 'echo "System is going to shutdown in $1 minute(s)..." - sleep $1m - systemctl poweroff' -- $1 -} - -hibernate-timer() { - bash -c 'echo "System is going to hibernate in $1 minute(s)..." - sleep $1m - systemctl hibernate' -- $1 -} - -shutdown() { - systemctl poweroff -} - -hibernate() { - systemctl hibernate -} - -standby() { - systemctl suspend -} - -restart() { - systemctl reboot -} - -# misc function chpwd() { ll } @@ -100,34 +59,16 @@ man() { man "$@" } -# pacman -pacman-orphans() { - if [[ ! -n $(pacman -Qdt) ]]; then - echo "No orphans to remove." - else - sudo pacman -Rns $(pacman -Qdtq) - fi -} - -pacman-unneeded() { - ignoregrp="base base-devel" - ignorepkg="" - - comm -23 <(pacman -Qqt | sort) <(echo $ignorepkg | tr ' ' '\n' | cat <(pacman -Sqg $ignoregrp) - | sort -u) -} - -pacman-modified() { - pacman -Qii | awk '/^MODIFIED/ {print $2}' -} - -pacman-disowned() { - sudo lostfiles -} - -# SOURCE CUSTOM IMPORTS +# SOURCE CUSTOM USER-SPECIFIC if [ -f ~/.zsh_custom ]; then source ~/.zsh_custom fi +if [ -f ~/.zsh_systemd ]; then + source ~/.zsh_systemd +fi +if [ -f ~/.zsh_archlinux ]; then + source ~/.zsh_archlinux +fi # KEYBINDINGS typeset -A key