Switch to zsh instead of bash

Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
Severin Kaderli 2019-02-13 20:40:47 +01:00
parent ca2c5b0c2b
commit 88927bbf39
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
13 changed files with 115 additions and 101 deletions

View file

@ -0,0 +1,43 @@
#!/bin/bash
#
# SCRIPT NAME:
# .aliases
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# This script is used to define aliases for commands.
#
# USAGE:
# This script is sourced by .bashrc
# Alias for clear because I sometimes type the DOS command instead
alias cls="clear"
# Alias for using exa as ls replacement
alias ls="exa -l"
# Alias for using ripgrep as grep replacement
alias grep="rg -n"
# Alias for using bat as cat replacement
alias cat="bat"
# Alias to get to my Projects folder
alias pj="cd ~/Projects"
# Alias for opening my code editor
alias e="code"
# Alias for wget to use XDG directories
alias wget='wget --hsts-file="${XDG_CACHE_HOME}/wget-hsts"'
# Alias for svn to use XDG directories
alias svn='svn --config-dir "${XDG_CONFIG_HOME}/subversion"'
# Alias for gpg2 to use XDG directories
alias gpg2='gpg2 --homedir "${XDG_DATA_HOME}/gnupg"'
# Alias for nvidia-settings to use XDG directories
alias nvidia-settings='optirun -b primus nvidia-settings --config="${XDG_CONFIG_HOME}/nvidia/settings" -c :8'

89
system/.config/custom/env Normal file
View file

@ -0,0 +1,89 @@
#!/bin/bash
#
# SCRIPT NAME:
# .env
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# This file contains declarations of environment variables.
#
# USAGE:
# This script is sourced by .bashrc
. "${XDG_BIN_HOME}/utils.sh"
# XDG Overrides for unsupported programs
export HTTPIE_CONFIG_DIR="${XDG_CONFIG_HOME}/httpie"
export XAUTHORITY="${XDG_RUNTIME_DIR}/Xauthority"
touch "${XAUTHORITY}"
export WGETRC="${XDG_CONFIG_HOME}/wget/wgetrc"
export VIMINIT=":source ${XDG_CONFIG_HOME}/vim/vimrc"
export CARGO_HOME="${XDG_DATA_HOME}/cargo"
export RUSTUP_HOME="${XDG_DATA_HOME}/rustup"
export PYLINTHOME="${XDG_CACHE_HOME}/pylint"
export DOCKER_CONFIG="${XDG_CONFIG_HOME}/docker"
export GTK_RC_FILES="${XDG_CONFIG_HOME}/gtk-1.0/gtkrc"
export GTK2_RC_FILES="${XDG_CONFIG_HOME}/gtk-2.0/gtkrc"
export XINITRC="${XDG_CONFIG_HOME}/X11/xinitrc"
export XSERVERRC="${XDG_CONFIG_HOME}/X11/xserverrc"
export NPM_CONFIG_USERCONFIG="${XDG_CONFIG_HOME}/npm/config"
export NODE_REPL_HISTORY="${XDG_DATA_HOME}/node/repl_history"
export GOPATH="${XDG_DATA_HOME}/go"
export GNUPGHOME="${XDG_DATA_HOME}/gnupg"
export GEM_HOME="${XDG_DATA_HOME}/gem"
export GEM_SPEC_CACHE="${XDG_CACHE_HOME}/gem/specs"
mkdir -p "${XDG_DATA_HOME}/wine/prefixes"
export WINEPREFIX="${XDG_DATA_HOME}/wine/prefixes/default"
# zsh
export ZDOTDIR="${XDG_CONFIG_HOME}/zsh"
export HISTFILE="${XDG_DATA_HOME}/zsh/history"
export HISTCONTROL=ignoreboth
export HISTSIZE=1000
export HISTFILESIZE=2000
mkdir -p "${XDG_DATA_HOME}/zsh/zcompdump-${ZSH_VERSION}"
compinit -d "${XDG_DATA_HOME}/zsh/zcompdump-${ZSH_VERSION}"
# Setting applications
export VISUAL=vim
export EDITOR="$VISUAL"
export TERMINAL=termite
# QT
export QT_QPA_PLATFORMTHEME=gtk2
export QT_STYLE_OVERRIDE=gtk2
# Ibus
export GTK_IM_MODULE=xim
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=xim
# Adding folders to the PATH variable
export PATH="${PATH}:${HOME}/.local/bin"
export PATH="${PATH}:${CARGO_HOME}/bin"
export PATH="${PATH}:${XDG_DATA_HOME}/npm/bin"
export PATH="${PATH}:${GOPATH}/bin"
export PATH="${PATH}:${GEM_HOME}/bin"
export PATH="${PATH}:${XDG_CONFIG_HOME}/composer/vendor/bin"
# Load version control information
function current_branch() {
branch="$(git rev-parse --abbrev-ref HEAD)" > /dev/null 2>&1
if [ -z "${branch}" ]
then
echo ""
else
echo "[${branch}]"
fi
}
# Custom prompt
NEWLINE=$'\n'
export PS1="┌─"
export PS1="${PS1}%F{red}[%*]%f"
export PS1="${PS1}%F{blue}[%m]%f"
export PS1="${PS1}%F{yellow}[%~]%f"
export PS1="${PS1}%F{blue}"'$(current_branch)'"%f"
export PS1="${PS1}${NEWLINE}└─╼ "

View file

@ -170,14 +170,14 @@ exec_always --no-startup-id $HOME/.config/polybar/launch.sh
# Custom keybinding
#######################################
# Screen lock controls
bindsym $mod+l exec --no-startup-id $HOME/bin/screenlock.sh
bindsym XF86Sleep exec --no-startup-id $HOME/bin/screenlock.sh
bindsym $mod+l exec --no-startup-id $XDG_BIN_HOME/screenlock.sh
bindsym XF86Sleep exec --no-startup-id $XDG_BIN_HOME/screenlock.sh
# Volume controls
bindsym XF86AudioMute exec --no-startup-id pamixer -t
bindsym $mod+m exec --no-startup-id pamixer -t
bindsym XF86AudioRaiseVolume exec --no-startup-id $HOME/bin/increase_volume.sh
bindsym $mod+KP_Add exec --no-startup-id $HOME/bin/increase_volume.sh
bindsym XF86AudioRaiseVolume exec --no-startup-id $XDG_BIN_HOME/increase_volume.sh
bindsym $mod+KP_Add exec --no-startup-id $XDG_BIN_HOME/increase_volume.sh
bindsym XF86AudioLowerVolume exec --no-startup-id pamixer -d 5 --allow-boost
bindsym $mod+KP_Subtract exec --no-startup-id pamixer -d 5 --allow-boost
@ -211,7 +211,7 @@ exec --no-startup-id compton -b
exec_always --no-startup-id feh --bg-fill $HOME/GoogleDrive/02_Media/Images/01_Wallpaper/Desktop/Fearsome_Awakening.png
# Monitor settings
exec_always --no-startup-id $HOME/bin/resolution.sh
exec_always --no-startup-id $XDG_BIN_HOME/resolution.sh
# Other applications
exec autokey-gtk

View file

@ -14,7 +14,7 @@
set undodir=$XDG_CACHE_HOME/vim/undo
set directory=$XDG_CACHE_HOME/vim/swap
set backupdir=$XDG_CACHE_HOME/vim/backup
set viminfo+='1000,n$XDG_CACHE_HOME/vim/viminfo
set viminfo+=n$XDG_CACHE_HOME/vim/viminfo
set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,$XDG_CONFIG_HOME/vim/after
syntax on

View file

@ -0,0 +1,18 @@
#!/bin/zsh
#
# SCRIPT NAME:
# .zlogout
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# This script is executed when the login shell exits.
#
# USAGE:
# This script is automatically executed when the login shell exits.
# Clear console output
if [ "${SHLVL}" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi

View file

@ -0,0 +1,31 @@
#!/bin/zsh
#
# SCRIPT NAME:
# .zprofile
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# This script is called when you start a login shell.
#
# USAGE:
# This script is automatically executed when you start a login shell.
if [[ -f "${HOME}/.config/zsh/.zshrc" ]]; then
. "${HOME}/.config/zsh/.zshrc"
fi
if [[ -f "${XDG_CONFIG_HOME}/custom/keyleds" ]]; then
. "${XDG_CONFIG_HOME}/custom/keyleds"
fi
# Restore custom dconf configuration
dconf load / < "${XDG_CONFIG_HOME}/dconf/root.conf"
# Activate correct crontab file
crontab "${XDG_CONFIG_HOME}/cron/crontab"
# If we are on tty1 we start the x-server
if [ "$(tty)" = "/dev/tty1" ]; then
startx "${XDG_CONFIG_HOME}/X11/xinitrc" && exit
fi

63
system/.config/zsh/.zshrc Normal file
View file

@ -0,0 +1,63 @@
#!/bin/zsh
#
# SCRIPT NAME:
# .zshrc
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# This script is called when you start a new shell.
#
# USAGE:
# This script is automatically executed when you start a new shell.
# Zsh options
setopt prompt_subst
setopt extendedglob
unsetopt correct
# Zsh keybindings
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\ee[C" forward-word
bindkey "\ee[D" backward-word
bindkey "^H" backward-delete-word
# Enable autocompletion features
autoload -Uz compinit
compinit
zstyle ':completion:*' menu select
# Persistent rehash
zstyle ':completion:*' rehash true
# XDG_Base_Directories
export XDG_CONFIG_HOME="${HOME}/.config"
export XDG_CACHE_HOME="${HOME}/.cache"
export XDG_DATA_HOME="${HOME}/.local/share"
export XDG_BIN_HOME="${HOME}/.local/bin"
# Sourcing environment variables
if [ -f "${XDG_CONFIG_HOME}/custom/env" ]; then
. "${XDG_CONFIG_HOME}/custom/env"
fi
# Enable color support of ls
if [ -f "${XDG_CONFIG_HOME}/custom/dircolors" ]; then
dircolors -b "${XDG_CONFIG_HOME}/custom/dircolors" > /dev/null 2>&1
fi
# Sourcing alias definitions
if [ -f "${XDG_CONFIG_HOME}/custom/aliases" ]; then
. "${XDG_CONFIG_HOME}/custom/aliases"
fi