summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohannst <stoelp@eit.uni-kl.de>2018-05-27 22:42:57 +0200
committerjohannst <stoelp@eit.uni-kl.de>2018-05-27 22:42:57 +0200
commit41190507f28ee71d8907a4f9a0fc9bdf56a85a7f (patch)
treec0d5fb92005e430158320952199eaec2b2e55276
parente6b979acb8621854a2e8235feb78528ce5c0741e (diff)
downloaddotfiles-41190507f28ee71d8907a4f9a0fc9bdf56a85a7f.tar.gz
dotfiles-41190507f28ee71d8907a4f9a0fc9bdf56a85a7f.zip
Cleaned & improved zshrc
-rwxr-xr-xinstall16
-rw-r--r--install.config1
-rw-r--r--zshrc110
3 files changed, 106 insertions, 21 deletions
diff --git a/install b/install
index 9cd19fa..2c32e65 100755
--- a/install
+++ b/install
@@ -18,6 +18,7 @@ gToolsConfig=(
"i3status:i3status:i3statusConfigInstaller"
"i3blocks:i3blocks:i3blocksConfigInstaller"
"termite:termite:termiteConfigInstaller"
+"zshrc:zsh:zshrcInstaller"
)
gMagicNumber=e2718281
@@ -217,6 +218,21 @@ function termiteConfigInstaller() {
}
#}}}
+#{{{ zshrcInstaller
+
+function zshrcInstaller() {
+ local zshrc=~/.zshrc
+ touch $zshrc
+ grep $gMagicNumber $zshrc > /dev/null 2>&1
+ if [[ $? = 0 ]]; then
+ return 1
+ fi
+ echo -e "\n# $gMagicNumber - Auto generated, do not delete or modify!" >> $zshrc
+ echo -e "source $ABS_BASE_DIR/zshrc" >> $zshrc
+ return 0
+}
+
+#}}}
#{{{ Installer Main Loop
diff --git a/install.config b/install.config
index c337212..cdcffa0 100644
--- a/install.config
+++ b/install.config
@@ -15,3 +15,4 @@ n - i3config
n - i3status
n - i3blocks
n - termite
+n - zshrc
diff --git a/zshrc b/zshrc
index 0cda3b6..0e3d81c 100644
--- a/zshrc
+++ b/zshrc
@@ -1,6 +1,9 @@
-# Created by newuser for 4.3.10
+# dotfiles -- zshrc
+# author: johannst
-typeset -g -A key
+# Key definition
+
+typeset -A key
key[Up]="\e[A"
key[Down]="\e[B"
key[ShiftTab]="\e[Z"
@@ -8,43 +11,108 @@ key[CtrlA]="\Ca"
key[CtrlE]="\Ce"
key[CtrlR]="\Cr"
key[CtrlS]="\Cs"
+key[CtrlW]="\Cw"
+key[BackSpace]="\C?"
+
+# Basic settings
+
+setopt correctall
+setopt hist_ignore_all_dups
+
+# Basic alias
+
+alias ls='\ls --color=auto --classify'
+alias ll='\ls --color=auto --classify -l'
+alias la='\ls --color=auto --classify --almost-all'
+alias lt='\ls --color=auto --classify -l -t --reverse'
+alias grep='\grep --color=auto -HIn'
+alias rgrep='\grep --color=auto -HIrn'
+alias fn='_findName'
+function _findName() {
+ [[ -z $1 ]] && { echo "_findName pattern [path [action]]"; return } || { n=$1; shift }
+ [[ -z $1 ]] && p=. || { p=$1; shift }
+ [[ -z $1 ]] && find $p -name $n || find $p -name $n -exec $@ {} \;
+}
+
+# History
HISTFILE=~/.zshist
HISTSIZE=1000
SAVEHIST=1000
-autoload -Uz promptinit && promptinit
-prompt walters
+# Prompt
+
+#autoload -Uz promptinit && promptinit
+#prompt walters
+
+# Completion
autoload -Uz compinit && compinit
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
zstyle ':completion:*' menu select
-bindkey -v
+zmodload zsh/complist
+bindkey -M menuselect "$key[ShiftTab]" reverse-menu-complete
-autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
-zle -N up-line-or-beginning-search
-zle -N down-line-or-beginning-search
+# Key mappings
+
+autoload -Uz up-line-or-beginning-search && zle -N up-line-or-beginning-search
+autoload -Uz down-line-or-beginning-search && zle -N down-line-or-beginning-search
+
+[[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search || echo FALE
+[[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search || echo FALE
+
+# Vi mode
+
+bindkey -v
bindkey -M vicmd "k" up-line-or-beginning-search
bindkey -M vicmd "j" down-line-or-beginning-search
bindkey -M viins "jj" vi-cmd-mode
-bindkey -M vicmd "$key[CtrlA]" vi-digit-or-beginning-of-line
-bindkey -M vicmd "$key[CtrlE]" vi-end-of-line
-bindkey -M viins "$key[CtrlA]" vi-digit-or-beginning-of-line
-bindkey -M viins "$key[CtrlE]" vi-end-of-line
+[[ -n "$key[CtrlA]" ]] && bindkey -M vicmd "$key[CtrlA]" vi-digit-or-beginning-of-line
+[[ -n "$key[CtrlA]" ]] && bindkey -M viins "$key[CtrlA]" vi-digit-or-beginning-of-line
+[[ -n "$key[CtrlE]" ]] && bindkey -M vicmd "$key[CtrlE]" vi-end-of-line
+[[ -n "$key[CtrlE]" ]] && bindkey -M viins "$key[CtrlE]" vi-end-of-line
-bindkey -M viins "$key[CtrlR]" history-incremental-search-backward
-bindkey -M viins "$key[CtrlS]" history-incremental-search-forward
+[[ -n "$key[CtrlR]" ]] && bindkey -M viins "$key[CtrlR]" history-incremental-search-backward
+[[ -n "$key[CtrlS]" ]] && bindkey -M viins "$key[CtrlS]" history-incremental-search-forward
-[[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search || echo FALE
-[[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search || echo FALE
+[[ -n "$key[CtrlW]" ]] && bindkey -M viins "$key[CtrlW]" backward-kill-word
+[[ -n "$key[BackSpace]" ]] && bindkey -M viins "$key[BackSpace]" backward-delete-char
-zmodload zsh/complist
-bindkey -M menuselect "$key[ShiftTab]" reverse-menu-complete
+# Dirstack
+
+DIRSTACKSIZE=8
+setopt autopushd pushdminus pushdsilent pushdtohome
+alias dh='dirs -v'
+
+# Prompt
+
+typeset -A color
+color[noColor]='%f'
+color[darkGray]='%F{242}'
+color[mediumGray]='%F{246}'
+color[lightGray]='%F{252}'
+color[brightRed]='%F{196}'
+color[pinkRed]='%F{125}'
+color[babyBlue]='%F{38}'
+color[darkBlue]='%F{26}'
+
+function _installMyPrompt() {
+ function zle-line-init zle-keymap-select {
+ vinorm='n'
+ viins='i'
+ vimode="${${KEYMAP/vicmd/$color[pinkRed]$vinorm}/(main|viins)/$color[babyBlue]$viins}$color[noColor]"
+ PS1="$color[mediumGray]%n$color[brightRed]::$color[lightGray]%m$color[brightRed]:$color[darkGray]%l$color[noColor] [$vimode] $color[brightRed]%(?..%? )$color[noColor]> "
+ RPS1="%F$color[darkBlue]%~%f"
+ zle reset-prompt
+ }
+
+ zle -N zle-line-init
+ zle -N zle-keymap-select
+}
-#setopt PRINT_EXIT_VALUE
+_installMyPrompt
-#source ~/local/completion/fd/_fd
-#source ~/local/completion/rg/_rg
+#% vim:et:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1