improve shell config

This commit is contained in:
eneller
2023-03-01 09:28:19 +01:00
parent 8efa82da1d
commit 701377dad1
4 changed files with 36 additions and 37 deletions

View File

@@ -1,13 +1,13 @@
alias ls='ls -hN --group-directories-first --color=auto' # make output more readable and show directories first alias ls='exa' # make output more readable and show directories first
alias ll='ls -l' alias ll='ls -l'
alias la='ls --almost-all' alias la='ls --all'
alias grep='grep --color=auto' # colorize grep output, set GREP_COLORS alias grep='rg' # colorize grep output, set GREP_COLORS
alias cp="cp -i" # Confirm before overwriting something alias cp="cp -i" # Confirm before overwriting something
alias df='df -h' # Human-readable sizes alias df='df -h' # Human-readable sizes
alias free='free -m'
alias vi='nvim' # Show sizes in MB alias vi='nvim' # Show sizes in MB
alias r='R' alias r='R'
alias xar="xarchiver"
# Add an "alert" alias for long running commands. Use like so: 'sleep 10; alert' # Add an "alert" alias for long running commands. Use like so: 'sleep 10; alert'
alias notify='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' alias notify='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
@@ -50,32 +50,8 @@ title()
echo -e "\e]2;$1\007"; echo -e "\e]2;$1\007";
} }
#
# # ex - archive extractor
# # usage: ex <file>
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
pwd() pwd()
{ {
echo "$PWD/$1" echo "$PWD/$1"
} }

View File

@@ -1,5 +1,5 @@
tmux_config_dir="~/.config/tmux" tmux_config_dir="~/.config/tmux"
mod="C-a" mod="C-b"
#CONFIGURATION #CONFIGURATION
#if-shell '[[ -n "$SSH_CLIENT"]]' { #if-shell '[[ -n "$SSH_CLIENT"]]' {
# source-file $tmux_config_dir/tmux_remote.conf # use alternative config for tmux inside ssh session # source-file $tmux_config_dir/tmux_remote.conf # use alternative config for tmux inside ssh session

View File

@@ -1,5 +1,3 @@
#OPTIONS SECTION #OPTIONS SECTION
#unsetopt beep # try disabling annoying beep sounds #unsetopt beep # try disabling annoying beep sounds
@@ -107,7 +105,8 @@ source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zs
#ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=009 #ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=009
#ZSH_HIGHLIGHT_STYLES[assign]=none #ZSH_HIGHLIGHT_STYLES[assign]=none
[[ ! -f "$ZDOTDIR/p10k.zsh" ]] || source "$ZDOTDIR/p10k.zsh" # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ ! -f "$ZDOTDIR/p10k.zsh" ]] || source "$ZDOTDIR/p10k.zsh" # To customize prompt, run `p10k configure` or edit ~/.config/zsh/p10k.zsh
#eval "$(starship init zsh)" # starship.rs prompt to replace p10k
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh # load fish-completion, needs to be sourced after syntax highlighting source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh # load fish-completion, needs to be sourced after syntax highlighting
@@ -134,7 +133,30 @@ source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh # l
#elif [[ -f /etc/DIR_COLORS ]] ; then #elif [[ -f /etc/DIR_COLORS ]] ; then
# eval $(dircolors -b /etc/DIR_COLORS) # eval $(dircolors -b /etc/DIR_COLORS)
#fi #fi
#
function command_not_found_handler {
local purple='\e[1;35m' bright='\e[0;1m' green='\e[1;32m' reset='\e[0m'
printf 'zsh: command not found: %s\n' "$1"
local entries=(
${(f)"$(/usr/bin/pacman -F --machinereadable -- "/usr/bin/$1")"}
)
if (( ${#entries[@]} ))
then
printf "${bright}$1${reset} may be found in the following packages:\n"
local pkg
for entry in "${entries[@]}"
do
# (repo package version file)
local fields=(
${(0)entry}
)
if [[ "$pkg" != "${fields[2]}" ]]
then
printf "${purple}%s/${bright}%s ${green}%s${reset}\n" "${fields[1]}" "${fields[2]}" "${fields[3]}"
fi
printf ' /%s\n' "${fields[4]}"
pkg="${fields[2]}"
done
fi
return 127
}

View File

@@ -903,6 +903,7 @@
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
typeset -g POWERLEVEL9K_VIRTUALENV_GENERIC_NAMES=(virtualenv venv .venv env .env)
#####################[ anaconda: conda environment (https://conda.io/) ]###################### #####################[ anaconda: conda environment (https://conda.io/) ]######################
# Anaconda environment color. # Anaconda environment color.