summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2019-12-21 22:42:39 +0000
committerGrégoire Duchêne <gduchene@awhk.org>2019-12-21 22:42:39 +0000
commitc9d29d439ca341dd24dd05aede1d94baf13fc3ff (patch)
tree3e66c815f693a5150fe02c2f4f9dcc998d3cd4a8
parent2fcc816c333862c64b768ce3eec3bc41d7ad7471 (diff)
Add zsh configuration
-rw-r--r--.gitignore2
-rw-r--r--dotfiles-darwin/zsh/env8
-rw-r--r--dotfiles-darwin/zsh/rc4
-rw-r--r--zsh/env16
-rw-r--r--zsh/login5
-rw-r--r--zsh/rc57
6 files changed, 92 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..99e2cff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+dotfiles-*
+!dotfiles-darwin
diff --git a/dotfiles-darwin/zsh/env b/dotfiles-darwin/zsh/env
new file mode 100644
index 0000000..d239818
--- /dev/null
+++ b/dotfiles-darwin/zsh/env
@@ -0,0 +1,8 @@
+# -*- mode: shell-script -*-
+
+export DOMAIN=$(cut -d. -f2- <<<${HOST})
+export GOPATH=~/Go
+export XDG_CACHE_HOME=~/Library/Caches
+export XDG_CONFIG_HOME=~/Library/Preferences
+export XDG_DATA_HOME=~/Library
+export XDG_RUNTIME_DIR=${TMPDIR}org.awhk.runtime-dir
diff --git a/dotfiles-darwin/zsh/rc b/dotfiles-darwin/zsh/rc
new file mode 100644
index 0000000..019d611
--- /dev/null
+++ b/dotfiles-darwin/zsh/rc
@@ -0,0 +1,4 @@
+# -*- mode: shell-script -*-
+
+alias ls='ls -G'
+alias lsh='du -a | sort -h'
diff --git a/zsh/env b/zsh/env
new file mode 100644
index 0000000..852686f
--- /dev/null
+++ b/zsh/env
@@ -0,0 +1,16 @@
+# -*- mode: shell-script -*-
+
+source_if_exists() {
+ local f=~/.zshenv
+ [[ -f ${f:A:h:h}/$1 ]] && . ${f:A:h:h}/$1 || return 0
+}
+
+export UNAME=$(uname)
+export LC_ALL=en_US.UTF-8
+
+setopt EXTENDED_GLOB
+setopt REMATCH_PCRE
+
+source_if_exists dotfiles-${UNAME:l}/zsh/env
+source_if_exists dotfiles-${DOMAIN:l}/zsh/env
+source_if_exists dotfiles-${HOST:l}/zsh/env
diff --git a/zsh/login b/zsh/login
new file mode 100644
index 0000000..756a391
--- /dev/null
+++ b/zsh/login
@@ -0,0 +1,5 @@
+# -*- mode: shell-script -*-
+
+source_if_exists dotfiles-${UNAME:l}/zsh/login
+source_if_exists dotfiles-${DOMAIN:l}/zsh/login
+source_if_exists dotfiles-${HOST:l}/zsh/login
diff --git a/zsh/rc b/zsh/rc
new file mode 100644
index 0000000..1050f1f
--- /dev/null
+++ b/zsh/rc
@@ -0,0 +1,57 @@
+# -*- mode: shell-script -*-
+
+autoload -Uz compinit zmv
+
+[[ ! -d ${XDG_CACHE_HOME}/zsh ]] && mkdir -p ${XDG_CACHE_HOME}/zsh
+compinit -d ${XDG_CACHE_HOME}/zsh/compdump
+zstyle ':completion:*' cache-path ${XDG_CACHE_HOME}/zsh/cache
+zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
+zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}'
+zstyle ':completion:*' use-cache on
+zstyle ':completion:*' users root ${USER}
+
+HISTFILE=${XDG_CACHE_HOME}/zsh/history
+HISTSIZE=65535
+PS1="%n@%m:%~ %# "
+SAVEHIST=${HISTSIZE}
+WORDCHARS=${WORDCHARS/\//}
+
+() {
+ local dir
+ for dir in ~/{.local/bin,bin} ${GOPATH:-~/go}/bin; do
+ [[ -d ${dir} ]] && path=(${dir} ${path})
+ done
+}
+
+alias bc='bc -lq'
+alias cp='cp -i'
+alias ddig='dig +noall +answer'
+alias df='df -h'
+alias du='du -h'
+alias dusum='du -d1 | sort -hr'
+alias ec='emacsclient -t'
+alias et='emacsclient -c'
+alias grep='grep --color=auto'
+alias la='ls -A'
+alias ll='ls -hl'
+alias lla='ls -Ahl'
+alias mv='mv -i'
+alias senv='env | sort'
+
+bindkey -e
+bindkey "^R" history-incremental-search-backward
+
+export EDITOR=vim
+export VISUAL=${EDITOR}
+
+setopt AUTO_CD
+setopt HIST_IGNORE_ALL_DUPS
+setopt HIST_IGNORE_SPACE
+setopt HIST_NO_STORE
+setopt HIST_REDUCE_BLANKS
+setopt INC_APPEND_HISTORY
+setopt SHARE_HISTORY
+
+source_if_exists dotfiles-${UNAME:l}/zsh/rc
+source_if_exists dotfiles-${DOMAIN:l}/zsh/rc
+source_if_exists dotfiles-${HOST:l}/zsh/rc