[ Prev ] [ Index ] [ Next ]

Zsh

Created lørdag 17 december 2016


Zsh is an alternate, improved, version from the Bash shell (default).
My .zshrc file can be found at Github


Installation

$ pacman -S zsh


# Then make it the default Shell - don't run with sudo!
$ chsh -s /bin/zsh


# For the Fish-like syntax highligthing
$ pacman -S zsh-syntax-highlighting


Configuring $PATH

# Paths should be set in a different configuration, since there is some source conflict with /etc/profile
# To prevent the path from being overwritten, set it in ~/.zprofile

typeset -U path
path=(~/bin /home/stick/.scripts /usr/local/bin $path[@])



Configuration

# User configuration is found in ~/.zshrc
# My Zsh configuration file can be found at Github.


Search official repositories when a command was invalid

# This requires the pkgfile package
$ pacman -S pkgfile


# Once installed the pkgfile database can be synced with
$ pkgfile -u


# Enable its system timer servce
$ systemctl enable pkgfile-update.timer


# Then add the following to the ~/.zshrc file
# This is already incl. in my configuration. Just make sure the package is installed.

source /usr/share/doc/pkgfile/command-not-found.zsh


Defining Keybinds

# To get a key-value, first hit Ctrl+v and then push the key (or key combo) to get its value
# That value can be used in a bindkey variable to define its action, ex;
# (Control+Delete to delete forward word) Ctrl+v Ctrl+Delete outputs ^[[3^
# Then we define the action of that value in the our .zshrc
# ( kill-word is the command to forward delete word)

bindkey '^[[3^' kill-word



Oh my Zsh

# OMZsh is a shitload of additional functions and themes ready to use out-the-box
# Below is still just added to the .zshrc file - OMZsh just adds a little extra.
# A further explained (example) OMZsh .zshrc file can be found at /usr/share/oh-my-zsh/zshrc


Install from the AUR

$ yaourt -S oh-my-zsh-git


Themes

# Original (supported) themes can be found at https://github.com/robbyrussell/oh-my-zsh/wiki/themes
# I've found this one to be quite lovely

ZSH_THEME="ys"


Functions

# Functions are added to the plugins=() line (space separated list)
# A full list of functions can be found here https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
# Below is a list of favorites^


# dirhistory
# Allows you to navigate back and forth in directories (history) with the arrow keys
# Usage : ALT+left ALT+right


# encode64
# Encode/decode base64
# Usage : encode64 <string> decode64 <string>


# screen
# Automaticly sets title and status for Gnu Screen


# sudo
# ESC twice to put sudo infront of current command


# urltools
# For URL manipulation. Encode/decode the RFC 1738 standard
# Usage : urlencode <string> urldecode <string>


# web-search
# adds bing, google, yahoo and DUCKDUCKGO! to command web search
# Usage : ddg <search> google <search>


# ssh-agent
# Add the following to your .zshrc file to enable (already included in my configuration)

zstyle :omz:plugins:ssh-agent agent-forwarding on