233 lines
6.4 KiB
Bash
233 lines
6.4 KiB
Bash
##### ENVIRONMENT
|
||
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/bin/core_perl:/home/felix/bin
|
||
|
||
|
||
export LANG=en_US.UTF-8
|
||
export EDITOR='vim'
|
||
export GIT_EDITOR='vim'
|
||
export PAGER='most'
|
||
export SHELL="/bin/zsh"
|
||
export TERM=xterm
|
||
export BROWSER='/usr/bin/google-chrome-stable'
|
||
|
||
export ANDROID_SDK_ROOT=/opt/android-sdk
|
||
export PATH=$PATH:/opt/android-sdk/platform-tools:/opt/android-sdk/tools
|
||
export PATH=$PATH:~/.platformio/penv/bin
|
||
|
||
# colors for less without compiled termcap files (curses feature)
|
||
export LESS_TERMCAP_mb=$'\e[01;31m'
|
||
export LESS_TERMCAP_md=$'\e[01;31m'
|
||
export LESS_TERMCAP_me=$'\e[0m'
|
||
export LESS_TERMCAP_se=$'\e[0m'
|
||
export LESS_TERMCAP_so=$'\e[01;44;33m'
|
||
export LESS_TERMCAP_ue=$'\e[0m'
|
||
export LESS_TERMCAP_us=$'\e[01;32m'
|
||
|
||
export LESS=XFRaeiM # the XFR is important here: don't mess with the terminal!export LESS=-cex3M
|
||
export HELPDIR=/usr/local/lib/zsh/help
|
||
|
||
# / is now word separator
|
||
WORDCHARS=${WORDCHARS//[&=\/;!#%]_/}
|
||
|
||
bindkey -e #emacs navi
|
||
|
||
bindkey '5D' emacs-backward-word
|
||
bindkey '5C' emacs-forward-word
|
||
|
||
setopt correctall
|
||
setopt autopushd pushdminus pushd_ignore_dups
|
||
setopt ignoreeof
|
||
setopt interactivecomments
|
||
setopt noclobber
|
||
setopt HIST_REDUCE_BLANKS
|
||
setopt HIST_IGNORE_SPACE
|
||
setopt SH_WORD_SPLIT
|
||
setopt nohup
|
||
setopt NO_CASE_GLOB # globbing is not case sensitive
|
||
setopt ZLE
|
||
setopt kshglob
|
||
|
||
setopt AUTO_CD # cd if no matching command
|
||
setopt AUTO_PARAM_SLASH # adds slash at end of tabbed dirs
|
||
setopt CHECK_JOBS # check bg jobs on exit
|
||
#setopt CORRECT # corrects spelling
|
||
setopt EXTENDED_GLOB # globs #, ~ and ^
|
||
#setopt EXTENDED_HISTORY # saves timestamps on history
|
||
#setopt GLOB_DOTS # find dotfiles easier
|
||
setopt HASH_CMDS # save cmd location to skip PATH lookup
|
||
#setopt HIST_EXPIRE_DUPS_FIRST # expire duped history first
|
||
#setopt HIST_NO_STORE # don't save 'history' cmd in history
|
||
#setopt INC_APPEND_HISTORY # append history as command are entered
|
||
#setopt LIST_ROWS_FIRST # completion options left-to-right, top-to-bottom
|
||
setopt LIST_TYPES # show file types in list
|
||
setopt MARK_DIRS # adds slash to end of completed dirs
|
||
setopt NUMERIC_GLOB_SORT # sort numerically first, before alpha
|
||
setopt PROMPT_SUBST # sub values in prompt (though it seems to work anyway haha)
|
||
#setopt SHARE_HISTORY # share history between open shells
|
||
# Don't overwrite, append
|
||
setopt APPEND_HISTORY
|
||
|
||
# Write after each command
|
||
# setopt INC_APPEND_HISTORY
|
||
|
||
# Killer: share history between multiple shells
|
||
setopt SHARE_HISTORY
|
||
|
||
# If I type cd and then cd again, only save the last one
|
||
setopt HIST_IGNORE_DUPS
|
||
|
||
# Even if there are commands inbetween commands that are the same, still only save the last one
|
||
setopt HIST_IGNORE_ALL_DUPS
|
||
|
||
# Pretty Obvious. Right?
|
||
setopt HIST_REDUCE_BLANKS
|
||
|
||
# If a line starts with a space, don't save it.
|
||
setopt HIST_IGNORE_SPACE
|
||
setopt HIST_NO_STORE
|
||
|
||
# When using a hist thing, make a newline show the change before executing it.
|
||
setopt HIST_VERIFY
|
||
|
||
# Save the time and how long a command ran
|
||
setopt EXTENDED_HISTORY
|
||
|
||
setopt HIST_SAVE_NO_DUPS
|
||
setopt HIST_EXPIRE_DUPS_FIRST
|
||
setopt HIST_FIND_NO_DUPS
|
||
|
||
##### COMPLETION
|
||
|
||
# die Completion aktivieren
|
||
zmodload zsh/complist
|
||
autoload -U compinit
|
||
compinit
|
||
|
||
|
||
#{{{ Completion Stuff
|
||
|
||
bindkey -M viins '\C-i' complete-word
|
||
|
||
# Faster! (?)
|
||
zstyle ':completion::complete:*' use-cache 1
|
||
|
||
# case insensitive completion
|
||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
||
|
||
zstyle ':completion:*' verbose yes
|
||
zstyle ':completion:*:descriptions' format '%B%d%b'
|
||
zstyle ':completion:*:messages' format '%d'
|
||
zstyle ':completion:*:warnings' format 'No matches for: %d'
|
||
zstyle ':completion:*' group-name ''
|
||
|
||
# generate descriptions with magic.
|
||
zstyle ':completion:*' auto-description 'specify: %d'
|
||
|
||
# Don't prompt for a huge list, page it!
|
||
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
|
||
|
||
# Have the newer files last so I see them first
|
||
zstyle ':completion:*' file-sort modification reverse
|
||
|
||
# color code completion!!!! Wohoo!
|
||
zstyle ':completion:*' list-colors "=(#b) #([0-9]#)*=36=31"
|
||
|
||
unsetopt LIST_AMBIGUOUS
|
||
setopt COMPLETE_IN_WORD
|
||
|
||
# Separate man page sections. Neat.
|
||
zstyle ':completion:*:manuals' separate-sections true
|
||
|
||
# Egomaniac!
|
||
zstyle ':completion:*' list-separator 'fREW'
|
||
|
||
# complete with a menu for xwindow ids
|
||
zstyle ':completion:*:windows' menu on=0
|
||
zstyle ':completion:*:expand:*' tag-order all-expansions
|
||
|
||
# more errors allowed for large words and fewer for small words
|
||
zstyle ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) )'
|
||
|
||
# Errors format
|
||
zstyle ':completion:*:corrections' format '%B%d (errors %e)%b'
|
||
|
||
# Don't complete stuff already on the line
|
||
zstyle ':completion::*:(rm|vi):*' ignore-line true
|
||
|
||
# Don't complete directory we are already in (../here)
|
||
zstyle ':completion:*' ignore-parents parent pwd
|
||
|
||
#zstyle ':completion::approximate*:*' prefix-needed false
|
||
|
||
##### History
|
||
|
||
HISTFILE=$HOME/.zsh_history
|
||
HISTSIZE=10000
|
||
SAVEHIST=10000
|
||
HOSTNAME="`hostname`"
|
||
REPORTTIME=120 # print elapsed time when more than 10 seconds
|
||
|
||
##### PROMPT
|
||
|
||
# %T System time (HH:MM)
|
||
# %* System time (HH:MM:SS)
|
||
# %D System date (YY-MM-DD)
|
||
# %n Your username
|
||
# %B - %b Begin - end bold print
|
||
# %U - %u Begin - end underlining
|
||
# %d Your current working directory
|
||
# %~ Your current working directory, relative to ~
|
||
# %M The computer's hostname
|
||
# %m The computer's hostname (truncated before the first period)
|
||
# %l Your current tty
|
||
|
||
|
||
# configure the following, or leave it commented out:
|
||
#PROMPT=$' %B%{$fg[white]%}%~%b $(__git_prompt) %# '
|
||
#setopt prompt_subst
|
||
|
||
#export RPS1='%{$fg[white]%}%n%{$fg[cyan]%}%m%{$reset_color%}'
|
||
|
||
|
||
##### WINDOW TITLE
|
||
|
||
case $TERM in
|
||
*xterm*|rxvt|rxvt-unicode|rxvt-256color|rxvt-unicode-256color|(dt|k|E)term)
|
||
precmd () { print -Pn "\e]0;zsh %~\a" }
|
||
#preexec () { print -Pn "\e]0;zsh %~ ($1)\a" }
|
||
;;
|
||
screen)
|
||
precmd () {
|
||
print -Pn "\e]83;title \"$1\"\a"
|
||
print -Pn "\e]0;$TERM - (%L) zsh %~\a"
|
||
}
|
||
#preexec () {
|
||
#print -Pn "\e]83;title \"$1\"\a"
|
||
#print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~] ($1)\a"
|
||
#}
|
||
;;
|
||
esac
|
||
|
||
source ~/.zsh/aliases.zsh
|
||
source ~/.zsh/key-bindings.zsh
|
||
alias :q='exit'
|
||
|
||
source ~/.zsh/git-prompt/loader.sh
|
||
#PROMPT='%* %B%{[0;36m%}%n%{[0;34m%}@%m %{[0;33m%}%~%b $(git_super_status) %# '
|
||
|
||
# stuff for development (e.g. nvm)
|
||
if [ "$(hostname)" = "t480" ]; then
|
||
# source ~/.zsh/dev-machine.zsh
|
||
# export NVM_DIR=~/.nvm
|
||
# sh $NVM_DIR/nvm.sh
|
||
# underline hostname
|
||
PROMPT='%* %B%{[0;36m%}%n%{[0;34m%}@%U%m%u %{[0;33m%}%~%b $(git_super_status) %# '
|
||
fi
|
||
|
||
source <(kubectl completion zsh)
|
||
|
||
if [ -z "$DISPLAY" -a $XDG_VTNR -eq 1 ]; then
|
||
startx
|
||
fi
|
||
|