Linuxious

~/.zshrc

This is my configuration file for Zsh, a powerful and extremely customizable interactive shell, which I highly recommend. I combine Zim and fzf with it for additional functionality.

If you are interested, my configuration file is available for download as well.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# vim: set et fenc=utf-8 ft=zsh sts=4 sw=4 ts=8 tw=80 :
#
# Author: microfracture / https://linuxious.com
# Updated: 2015-12-26


# =============================================================================
# Initial setup
# =============================================================================

export TERM='xterm-256color'

export BROWSER="firefox"                # Set Firefox as the default browser.
export EDITOR="nvim"                    # Set Neovim as the default editor.
export MAIL="~/.mail"                   # Set mail location.

# Set paths.
export PATH=${PATH}:~/.bin:~/.local/bin:~/.gem/ruby/2.3.0/bin

# Miscellaneous settings.
setopt appendhistory                    # Append history instead of replacing.
setopt autocd                           # If the given command is a directory
                                        # switch to it.
setopt beep                             # Beep when a history entry isn't there.
setopt extendedglob                     # Treat #, ~, and, ^ characters as part
                                        # of the patterns for filename gen.
setopt nomatch                          # Print an error when the filename
                                        # pattern has no match.
setopt notify                           # Report job status.
bindkey -v                              # Enable Vi mode.

# =============================================================================
# Aliases
# =============================================================================

alias cp="nocorrect cp -v"              # Verbose copying with no auto-correct.
alias df="df -h"                        # Enable human-readable output.
alias du='ncdu'                         # Use the Ncdu tool instead of du.
alias grep="grep -n --color"            # Show color and line numbers for match.
alias ht="htop -u $(whoami)"            # Show only my processes.

# Colorize listing output, append indicator, and list directories first.
alias ls="ls --group-directories-first --color -F"

alias mkdir='nocorrect mkdir'           # No auto-correct when making directory.
alias mv="nocorrect mv -v"              # Verbose moving with no auto-correct.
alias netstat="netstat -nap --inet"     # List all network connections.
alias pacman="pacaur"                   # Use pacaur to manage everything.
alias pgrep="pgrep -l"                  # List processes by both name and id.
alias rm="nocorrect rm -v"              # Verbose removing with no auto-correct.

# Take a screenshot with a slight delay and generate an additional thumbnail.
alias ss="scrot %Y-%m-%d_$(whoami).png -d 8 -c -t 10%"

# Update fzf and prezto to their latest versions.
alias updates="cd ~/.fzf && git pull && \
    git submodule update --init --recursive && \
    cd ~/.zprezto && git pull && \
    git submodule update --init --recursive && \
    cd ~/.zim && git pull && \
    git submodule update --init --recursive && \
    cd ~"

# =============================================================================
# Initalize scripts
# =============================================================================

# Initialize Prezto and fzf if available.
#if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
#    source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
#fi

# Initialize Zim and fzf if available.
if [[ -s ${ZDOTDIR:-${HOME}}/.zim/init.zsh ]]; then
  source ${ZDOTDIR:-${HOME}}/.zim/init.zsh
fi

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh