zsh: Refactor functions

Combine functions{Pre,Post}.zsh into functions.zsh. There is no reason
or sense in splitting the functions like that and differentiating
between functions that should be loaded before and after sourcing the
aliases.

Rename the functions from funcPre, making their aliases superfluous.
This commit is contained in:
2020-09-25 01:26:17 +02:00
parent 11ec8b93fb
commit d7fc680abe
4 changed files with 20 additions and 27 deletions

View File

@@ -130,9 +130,8 @@ if [ -e "$ZSH_CONF/stderred/build/libstderred.so" ]; then
export STDERRED_ESC_CODE="$(tput bold && tput setaf 1)" export STDERRED_ESC_CODE="$(tput bold && tput setaf 1)"
export STDERRED_BLACKLIST="^(git|curl|wget|swipl)$" export STDERRED_BLACKLIST="^(git|curl|wget|swipl)$"
fi fi
comp-source "$ZSH_CONF/functionsPre.zsh"
comp-source "$ZSH_CONF/alias.zsh" comp-source "$ZSH_CONF/alias.zsh"
comp-source "$ZSH_CONF/functionsPost.zsh" comp-source "$ZSH_CONF/functions.zsh"
comp-source "$ZSH_CONF/transfer.zsh" comp-source "$ZSH_CONF/transfer.zsh"
comp-source "$ZSH_CONF/zsh-autosuggestions/zsh-autosuggestions.zsh" comp-source "$ZSH_CONF/zsh-autosuggestions/zsh-autosuggestions.zsh"
comp-source "$ZSH_CONF/completion.zsh" comp-source "$ZSH_CONF/completion.zsh"

View File

@@ -52,10 +52,6 @@ alias feh='feh -.'
# 'Temporary' shell in alternate mode that does not mess with the scrollback history # 'Temporary' shell in alternate mode that does not mess with the scrollback history
alias tmpshell='tput smcup && zsh && tput rmcup' alias tmpshell='tput smcup && zsh && tput rmcup'
## functions
alias trash=_trash_list_default
alias nemo=_nemo_wd_default
## git ## git
alias gs='git status --short' # overrides ghostscript alias gs='git status --short' # overrides ghostscript
alias gits='gs' alias gits='gs'

View File

@@ -1,5 +1,5 @@
## Author: druckdev ## Author: druckdev
## Created: 2019-10-27 (originally 2019-08-28 as functions.zsh) ## Created: 2019-08-28
## change into dir and print accordingly ## change into dir and print accordingly
function cl() { function cl() {
@@ -328,3 +328,21 @@ safe-remove() {
fi fi
udisksctl power-off -b "/dev/$(lsblk -no pkname "$1")" udisksctl power-off -b "/dev/$(lsblk -no pkname "$1")"
} }
## List items in trash if no argument is specified
function trash() {
if (( ! $# )); then
command trash-list
else
command trash "$@"
fi
}
## Open nemo in current directory if no argument is specified
function nemo() {
if (( ! $# )); then
command nemo .
else
command nemo "$@"
fi
}

View File

@@ -1,20 +0,0 @@
## Author: druckdev
## Created: 2019-10-27 (originally 2019-08-28 as functions.zsh)
## List items in trash if no argument is specified
function _trash_list_default() {
if [ $# -eq 0 ]; then
command trash-list
else
command trash "$@"
fi
}
## Open nemo in current directory if no argument is specified
function _nemo_wd_default() {
if [ $# -eq 0 ]; then
command nemo ./
else
command nemo "$@"
fi
}