Added initial .zsh configuration
This commit is contained in:
commit
083bbbb9c4
10 changed files with 240 additions and 0 deletions
3
.zsh/lib/aliases.zsh
Normal file
3
.zsh/lib/aliases.zsh
Normal file
|
@ -0,0 +1,3 @@
|
|||
alias ll='ls -la'
|
||||
alias lh='ls -lah'
|
||||
alias ...='cd ../..'
|
35
.zsh/lib/appearance.zsh
Normal file
35
.zsh/lib/appearance.zsh
Normal file
|
@ -0,0 +1,35 @@
|
|||
# ls colors
|
||||
autoload colors; colors;
|
||||
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
||||
#export LS_COLORS
|
||||
|
||||
# Enable ls colors
|
||||
if [ "$DISABLE_LS_COLORS" != "true" ]
|
||||
then
|
||||
# Find the option for using colors in ls, depending on the version: Linux or BSD
|
||||
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
|
||||
fi
|
||||
|
||||
#setopt no_beep
|
||||
setopt auto_cd
|
||||
setopt multios
|
||||
setopt cdablevarS
|
||||
|
||||
if [[ x$WINDOW != x ]]
|
||||
then
|
||||
SCREEN_NO="%B$WINDOW%b "
|
||||
else
|
||||
SCREEN_NO=""
|
||||
fi
|
||||
|
||||
# Apply theming defaults
|
||||
PS1="%n@%m:%~%# "
|
||||
|
||||
# git theming default: Variables for theming the git info prompt
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
|
||||
|
||||
# Setup the prompt with pretty colors
|
||||
setopt prompt_subst
|
25
.zsh/lib/colors.zsh
Normal file
25
.zsh/lib/colors.zsh
Normal file
|
@ -0,0 +1,25 @@
|
|||
typeset -Ag FX FG BG
|
||||
|
||||
LSCOLORS="exfxcxdxbxegedabagacad"
|
||||
LS_COLORS="di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:"
|
||||
|
||||
FX=(
|
||||
reset "%{[00m%}"
|
||||
bold "%{[01m%}" no-bold "%{[22m%}"
|
||||
italic "%{[03m%}" no-italic "%{[23m%}"
|
||||
underline "%{[04m%}" no-underline "%{[24m%}"
|
||||
blink "%{[05m%}" no-blink "%{[25m%}"
|
||||
reverse "%{[07m%}" no-reverse "%{[27m%}"
|
||||
)
|
||||
|
||||
for color in {000..255}; do
|
||||
FG[$color]="%{[38;5;${color}m%}"
|
||||
BG[$color]="%{[48;5;${color}m%}"
|
||||
done
|
||||
|
||||
# Show all 256 colors with color number
|
||||
function spectrum_ls() {
|
||||
for code in {000..255}; do
|
||||
print -P -- "$code: %F{$code}Test%f"
|
||||
done
|
||||
}
|
73
.zsh/lib/completion.zsh
Normal file
73
.zsh/lib/completion.zsh
Normal file
|
@ -0,0 +1,73 @@
|
|||
# fixme - the load process here seems a bit bizarre
|
||||
|
||||
unsetopt menu_complete # do not autoselect the first completion entry
|
||||
unsetopt flowcontrol
|
||||
setopt auto_menu # show completion menu on succesive tab press
|
||||
setopt complete_in_word
|
||||
setopt always_to_end
|
||||
|
||||
WORDCHARS=''
|
||||
|
||||
zmodload -i zsh/complist
|
||||
|
||||
## case-insensitive (all),partial-word and then substring completion
|
||||
if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
|
||||
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
unset CASE_SENSITIVE
|
||||
else
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
fi
|
||||
|
||||
# uncomment if completion should be colorful
|
||||
# zstyle ':completion:*' list-colors ''
|
||||
|
||||
# should this be in keybindings?
|
||||
bindkey -M menuselect '^o' accept-and-infer-next-history
|
||||
|
||||
zstyle ':completion:*:*:*:*:*' menu select
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
|
||||
|
||||
# disable named-directories autocompletion
|
||||
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
||||
cdpath=(.)
|
||||
|
||||
# use /etc/hosts and known_hosts for hostname completion
|
||||
[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
|
||||
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
|
||||
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
|
||||
hosts=(
|
||||
"$_global_ssh_hosts[@]"
|
||||
"$_ssh_hosts[@]"
|
||||
"$_etc_hosts[@]"
|
||||
"$HOST"
|
||||
localhost
|
||||
)
|
||||
zstyle ':completion:*:hosts' hosts $hosts
|
||||
|
||||
# Use caching so that commands like apt and dpkg complete are useable
|
||||
zstyle ':completion::complete:*' use-cache 1
|
||||
zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/
|
||||
|
||||
# Don't complete uninteresting users
|
||||
zstyle ':completion:*:*:*:users' ignored-patterns \
|
||||
adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
|
||||
dbus distcache dovecot fax ftp games gdm gkrellmd gopher \
|
||||
hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \
|
||||
mailman mailnull mldonkey mysql nagios \
|
||||
named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
|
||||
operator pcap postfix postgres privoxy pulse pvm quagga radvd \
|
||||
rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs
|
||||
|
||||
# ... unless we really want to.
|
||||
zstyle '*' single-ignored show
|
||||
|
||||
if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then
|
||||
expand-or-complete-with-dots() {
|
||||
echo -n "\e[31m......\e[0m"
|
||||
zle expand-or-complete
|
||||
zle redisplay
|
||||
}
|
||||
zle -N expand-or-complete-with-dots
|
||||
bindkey "^I" expand-or-complete-with-dots
|
||||
fi
|
10
.zsh/lib/correction.zsh
Normal file
10
.zsh/lib/correction.zsh
Normal file
|
@ -0,0 +1,10 @@
|
|||
setopt correct_all
|
||||
|
||||
alias man='nocorrect man'
|
||||
alias mv='nocorrect mv'
|
||||
alias mysql='nocorrect mysql'
|
||||
alias mkdir='nocorrect mkdir'
|
||||
alias gist='nocorrect gist'
|
||||
alias heroku='nocorrect heroku'
|
||||
alias ebuild='nocorrect ebuild'
|
||||
alias hpodder='nocorrect hpodder'
|
4
.zsh/lib/directories.zsh
Normal file
4
.zsh/lib/directories.zsh
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Changing/making/removing directory
|
||||
setopt auto_name_dirs
|
||||
setopt auto_pushd
|
||||
setopt pushd_ignore_dups
|
13
.zsh/lib/history.zsh
Normal file
13
.zsh/lib/history.zsh
Normal file
|
@ -0,0 +1,13 @@
|
|||
## Command history configuration
|
||||
HISTFILE=$HOME/.zsh_history
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
|
||||
setopt append_history
|
||||
setopt extended_history
|
||||
setopt hist_expire_dups_first
|
||||
setopt hist_ignore_dups # ignore duplication command history list
|
||||
setopt hist_ignore_space
|
||||
setopt hist_verify
|
||||
setopt inc_append_history
|
||||
setopt share_history # share command history data
|
51
.zsh/lib/key_bindings.zsh
Normal file
51
.zsh/lib/key_bindings.zsh
Normal file
|
@ -0,0 +1,51 @@
|
|||
# TODO: Explain what some of this does..
|
||||
|
||||
bindkey -e
|
||||
bindkey '\ew' kill-region
|
||||
bindkey -s '\el' "ls\n"
|
||||
bindkey -s '\e.' "..\n"
|
||||
bindkey '^r' history-incremental-search-backward
|
||||
bindkey "^[[5~" up-line-or-history
|
||||
bindkey "^[[6~" down-line-or-history
|
||||
|
||||
# make search up and down work, so partially type and hit up/down to find relevant stuff
|
||||
bindkey '^[[A' up-line-or-search
|
||||
bindkey '^[[B' down-line-or-search
|
||||
|
||||
bindkey "^[[H" beginning-of-line
|
||||
bindkey "^[[1~" beginning-of-line
|
||||
bindkey "^[OH" beginning-of-line
|
||||
bindkey "^[[F" end-of-line
|
||||
bindkey "^[[4~" end-of-line
|
||||
bindkey "^[OF" end-of-line
|
||||
bindkey ' ' magic-space # also do history expansion on space
|
||||
|
||||
bindkey "^[[1;5C" forward-word
|
||||
bindkey "^[[1;5D" backward-word
|
||||
|
||||
bindkey '^[[Z' reverse-menu-complete
|
||||
|
||||
# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
|
||||
bindkey '^?' backward-delete-char
|
||||
bindkey "^[[3~" delete-char
|
||||
bindkey "^[3;5~" delete-char
|
||||
bindkey "\e[3~" delete-char
|
||||
|
||||
# consider emacs keybindings:
|
||||
|
||||
#bindkey -e ## emacs key bindings
|
||||
#
|
||||
#bindkey '^[[A' up-line-or-search
|
||||
#bindkey '^[[B' down-line-or-search
|
||||
#bindkey '^[^[[C' emacs-forward-word
|
||||
#bindkey '^[^[[D' emacs-backward-word
|
||||
#
|
||||
#bindkey -s '^X^Z' '%-^M'
|
||||
#bindkey '^[e' expand-cmd-path
|
||||
#bindkey '^[^I' reverse-menu-complete
|
||||
#bindkey '^X^N' accept-and-infer-next-history
|
||||
#bindkey '^W' kill-region
|
||||
#bindkey '^I' complete-word
|
||||
## Fix weird sequence that rxvt produces
|
||||
#bindkey -s '^[[Z' '\t'
|
||||
#
|
13
.zsh/lib/misc.zsh
Normal file
13
.zsh/lib/misc.zsh
Normal file
|
@ -0,0 +1,13 @@
|
|||
## smart urls
|
||||
autoload -U url-quote-magic
|
||||
zle -N self-insert url-quote-magic
|
||||
|
||||
## file rename magick
|
||||
bindkey "^[m" copy-prev-shell-word
|
||||
|
||||
## jobs
|
||||
setopt long_list_jobs
|
||||
|
||||
## pager
|
||||
export PAGER=less
|
||||
export LC_CTYPE=$LANG
|
13
.zshrc
Normal file
13
.zshrc
Normal file
|
@ -0,0 +1,13 @@
|
|||
export ZSH=~/.zsh
|
||||
|
||||
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
|
||||
|
||||
# add a function path
|
||||
fpath=($ZSH/functions $ZSH/completions $fpath)
|
||||
|
||||
# Load all of the config files in ~/oh-my-zsh that end in .zsh
|
||||
for config_file ($ZSH/lib/*.zsh) source $config_file
|
||||
|
||||
# Load and run compinit
|
||||
autoload -U compinit
|
||||
compinit -i
|
Loading…
Reference in a new issue