about summary refs log tree commit diff
path: root/.config
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2020-07-18 20:27:54 -0500
committerStarfall <us@starfall.systems>2020-07-22 14:36:01 -0500
commit3dd0a773b93a3307b8a61f096dad540f1f917a9e (patch)
tree16c8b71741767a53841df52a9ba4e88af4dab47b /.config
parent586cdb5c4b94654034ae92652b43940b2cda30f6 (diff)
zsh: pull in more config from oh-my-zsh defaults and belak/zsh-utils
Diffstat (limited to '.config')
-rw-r--r--.config/zsh/.zshenv1
-rw-r--r--.config/zsh/.zshrc54
2 files changed, 54 insertions, 1 deletions
diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv
index 77603e5..d002695 100644
--- a/.config/zsh/.zshenv
+++ b/.config/zsh/.zshenv
@@ -1,4 +1,5 @@
 export EDITOR='vim'
+export PAGER='less'
 
 if [[ $INTELLIJ -eq 1 ]]; then
 	export PATH=/usr/local/bin:/usr/bin:$PATH
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc
index b5b37ce..4aed2b7 100644
--- a/.config/zsh/.zshrc
+++ b/.config/zsh/.zshrc
@@ -2,6 +2,39 @@
 setopt autocd
 export CDPATH=".:$HOME:$HOME/devil:$HOME/src"
 
+# use multiple redirections to imply tee / cat
+setopt multios
+
+# spelling correction... TBA if we like this
+# could also use correct_all & potentially alias some things with nocorrect
+setopt correct
+
+# completions
+setopt complete_in_word   # complete both ends of words
+setopt always_to_end      # and move cursor to the end afterward
+setopt auto_menu          # <tab><tab> brings up the menu ...
+unsetopt menu_complete    # ... and does not select the first option
+setopt auto_param_slash   # convenience: add trailing / after directories
+setopt extended_glob
+unsetopt flow_control
+zstyle ':completion:*' special-dirs true
+# cache completions
+zstyle ':completion::complete:*' use-cache yes
+zstyle ':completion::complete:*' cache-path "$HOME/.zcompcache"
+# enable completions
+autoload -Uz compinit && compinit
+
+# history
+HISTFILE="$HOME/.zsh_history"
+HISTSIZE=10000
+SAVEHIST=$HISTSIZE
+setopt bang_hist
+setopt extended_history   # write timestamp
+setopt inc_append_history # write always, not just at end of session
+setopt hist_ignore_space  # add leading space to hide from history
+setopt hist_ignore_dups   # deduplicate commands run twice in a row
+setopt hist_verify        # confirm before executing
+
 # vi mode
 bindkey -v
 # make backspace and delete behave like vim
@@ -21,11 +54,27 @@ zle -N zle-keymap-select
 zle -N zle-line-init
 zle -N zle-line-finish
 
+# colors in various core utils
+alias diff='diff --color'
+alias ls='ls --color=auto'
+export LESS='-R'
+
+grep_opts="--color=auto --exclude-dir=.git"
+alias grep="grep $grep_opts"
+alias egrep="egrep $grep_opts"
+alias fgrep="fgrep $grep_opts"
+unset grep_opts
+
+# dots go up
+alias -g ...='../..'
+alias -g ....='../../..'
+alias -g .....='../../../..'
+
 # aliases
 alias cls=clear
 alias config='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
-alias ls='ls --color=auto'
 alias ll='ls -l --almost-all --no-group --human-readable'
+alias mkdir='mkdir -p'
 
 # collapse spaces into tabs in-place
 # spacetotab <FILE> [WIDTH=4]
@@ -34,5 +83,8 @@ function spacetotab () {
 	mv "$1.tmp" "$1"
 }
 
+# prompt
+setopt prompt_subst
+
 # display a fortune when opening an interactive terminal
 tty -s && fortune $HOME/fortunes 2>/dev/null ||: