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

2
.gitignore vendored
View file

@ -7,3 +7,5 @@ system/.config/mpv/encoding.rst
system/.config/mpv/tech-overview.txt
system/.config/mpv/mplayer-input.conf
system/.config/mpv/restore-old-bindings.conf
.zcompdump

View file

@ -95,6 +95,9 @@ This folder contains my configuration for
### `.config/X11`
This folder contains my configuration for the X-Server.
### `.config/zsh`
This folder contains my configuration for Zsh.
### `.config/Trolltech.conf`
This file contains my QT4 configuration.
@ -106,18 +109,3 @@ functions that I use in other scripts.
### `udev`
This folder contains my custom udev rules. They are moved to
`/etc/udev/rules.d/` by the installation script.
### `.aliases`
This file contains my aliases that I use on a regular basis. I also use it to replace some standard commands wiht alternatives, like using `exa` instead of `ls`.
### `.bash_logout`
This file contains code that gets executed when the shell is exited.
### `.bash_profile`
This file contains code that gets executed when a login shell is started.
### `.bashrc`
This file contains code that gets executed when a new shell is started.
### `.env`
This file contains my used environment variables.

View file

@ -30,10 +30,6 @@ DIRECTORIES=(
# Array of files which should be symlinked in the home folder
LINKED_FILES_HOME=(
".aliases"
".bash_logout"
".bash_profile"
".bashrc"
".config/autokey"
".config/bat"
".config/compton"
@ -57,7 +53,7 @@ LINKED_FILES_HOME=(
".config/vue"
".config/wget"
".config/X11"
".env"
".config/zsh"
".local/bin"
)

View file

@ -1,50 +0,0 @@
#!/bin/bash
#
# SCRIPT NAME:
# .bashrc
#
# 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.
# Bash configuration
shopt -s histappend
shopt -s checkwinsize
shopt -s globstar
# 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 "${HOME}/.env" ]; then
. "${HOME}/.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 "${HOME}/.aliases" ]; then
. "${HOME}/.aliases"
fi
# Source git-prompt script
if [ -f "/usr/share/git/completion/git-prompt.sh" ]; then
. "/usr/share/git/completion/git-prompt.sh"
fi
# Enable autocompletion features
if [ -f "/usr/share/bash-completion/bash_completion" ]; then
. /usr/share/bash-completion/bash_completion
fi
complete -cf sudo

View file

@ -38,3 +38,6 @@ 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'

View file

@ -36,10 +36,14 @@ export GEM_SPEC_CACHE="${XDG_CACHE_HOME}/gem/specs"
mkdir -p "${XDG_DATA_HOME}/wine/prefixes"
export WINEPREFIX="${XDG_DATA_HOME}/wine/prefixes/default"
# Bash
# 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
@ -64,15 +68,22 @@ export PATH="${PATH}:${GOPATH}/bin"
export PATH="${PATH}:${GEM_HOME}/bin"
export PATH="${PATH}:${XDG_CONFIG_HOME}/composer/vendor/bin"
# Set bash prompt
set_bash_prompt() {
PS1="${RESET}┌─"
PS1="${PS1}${RED}[\t]"
PS1="${PS1}${BLUE}[\h]"
PS1="${PS1}${YELLOW}[\w]"
PS1="${PS1}${BLUE}$(__git_ps1 "[%s]")"
PS1="${PS1}${RESET}\n└─╼ "
export MSYS2_PS1="$PS1"
}
# 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
export PROMPT_COMMAND=set_bash_prompt
}
# 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

@ -1,7 +1,7 @@
#!/bin/bash
#!/bin/zsh
#
# SCRIPT NAME:
# .bash_logout
# .zlogout
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/bin/zsh
#
# SCRIPT NAME:
# .bash_profile
# .zprofile
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -11,8 +11,8 @@
#
# USAGE:
# This script is automatically executed when you start a login shell.
if [[ -f "${HOME}/.bashrc" ]]; then
. "${HOME}/.bashrc"
if [[ -f "${HOME}/.config/zsh/.zshrc" ]]; then
. "${HOME}/.config/zsh/.zshrc"
fi
if [[ -f "${XDG_CONFIG_HOME}/custom/keyleds" ]]; then

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

View file

@ -24,7 +24,6 @@ ACTIONS=(
action=$(zenity --list --width="${WIDTH}" --height="${HEIGHT}" --text="${TEXT}" --column="Action" "${ACTIONS[@]}")
echo "$action"
if [ "${action}" == "Reboot" ]
then
systemctl reboot
@ -34,8 +33,10 @@ then
elif [ "${action}" == "Performance Mode" ]
then
gksudo "cpupower frequency-set -g performance"
optirun -b primus nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=2' -c :8 > /dev/null
elif [ "${action}" == "Powersave Mode" ]
then
gksudo "cpupower frequency-set -g powersave"
optirun -b primus nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=0' -c :8 > /dev/null
fi