diff options
Diffstat (limited to 'zsh/zshrc')
| -rw-r--r-- | zsh/zshrc | 33 |
1 files changed, 26 insertions, 7 deletions
| @@ -4,20 +4,30 @@ | |||
| 4 | # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes | 4 | # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes |
| 5 | ZSH_THEME="archcraft" | 5 | ZSH_THEME="archcraft" |
| 6 | 6 | ||
| 7 | |||
| 7 | # helper repo | 8 | # helper repo |
| 8 | export SETTING_DIR=$HOME/helper | 9 | export SETTING_DIR=$HOME/helper |
| 9 | source $SETTING_DIR/tools/init/load-settings.sh | 10 | source $SETTING_DIR/tools/init/load-settings.sh |
| 10 | fpath=($SETTING_DIR/zsh $fpath) | 11 | fpath=($SETTING_DIR/zsh $fpath) |
| 11 | 12 | ||
| 13 | |||
| 12 | # Options | 14 | # Options |
| 13 | setopt extended_glob | 15 | setopt extended_glob |
| 14 | setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file. | 16 | setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file. |
| 15 | 17 | ||
| 16 | _comp_options+=(globdots) # With hidden files | 18 | |
| 19 | # Edit Command Line | ||
| 20 | autoload -Uz edit-command-line; zle -N edit-command-line | ||
| 21 | bindkey -- "^X^E" edit-command-line | ||
| 22 | |||
| 23 | |||
| 24 | # Enable completion | ||
| 17 | autoload -Uz compinit; compinit | 25 | autoload -Uz compinit; compinit |
| 26 | _comp_options+=(globdots) # With hidden files | ||
| 18 | zstyle ':completion:*' menu select | 27 | zstyle ':completion:*' menu select |
| 19 | zstyle ':completion::complete:*' gain-privileges 1 | 28 | zstyle ':completion::complete:*' gain-privileges 1 |
| 20 | 29 | ||
| 30 | |||
| 21 | # PS1 with git status at right | 31 | # PS1 with git status at right |
| 22 | autoload -Uz add-zsh-hook | 32 | autoload -Uz add-zsh-hook |
| 23 | add-zsh-hook precmd precmd | 33 | add-zsh-hook precmd precmd |
| @@ -27,13 +37,14 @@ function precmd() { | |||
| 27 | RPROMPT="%B%K{red}%F{black}${RIGHT}%f%k%b" | 37 | RPROMPT="%B%K{red}%F{black}${RIGHT}%f%k%b" |
| 28 | } | 38 | } |
| 29 | 39 | ||
| 40 | |||
| 30 | # Directory Stack | 41 | # Directory Stack |
| 31 | #setopt AUTO_PUSHD # Push the current directory visited on the stack. | 42 | setopt AUTO_PUSHD # Push the current directory visited on the stack. |
| 32 | #setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack. | 43 | setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack. |
| 33 | #setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd. | 44 | setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd. |
| 45 | alias d='dirs -v' | ||
| 46 | for index ({1..9}) alias "$index"="cd +${index}"; unset index | ||
| 34 | 47 | ||
| 35 | #alias d='dirs -v' | ||
| 36 | #for index ({1..9}) alias "$index"="cd +${index}"; unset index | ||
| 37 | 48 | ||
| 38 | # create a zkbd compatible hash; | 49 | # create a zkbd compatible hash; |
| 39 | # to add other keys to this hash, see: man 5 terminfo | 50 | # to add other keys to this hash, see: man 5 terminfo |
| @@ -66,7 +77,6 @@ bindkey -- "\C-b" backward-char | |||
| 66 | bindkey -- "\C-f" forward-char | 77 | bindkey -- "\C-f" forward-char |
| 67 | bindkey -- "\Eb" backward-word | 78 | bindkey -- "\Eb" backward-word |
| 68 | bindkey -- "\Ef" forward-word | 79 | bindkey -- "\Ef" forward-word |
| 69 | bindkey -- "\C-x-\C-e" edit-command-line | ||
| 70 | bindkey -- "\C-v" quoted-insert | 80 | bindkey -- "\C-v" quoted-insert |
| 71 | bindkey -- "\E." insert-last-word | 81 | bindkey -- "\E." insert-last-word |
| 72 | bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history | 82 | bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history |
| @@ -74,6 +84,15 @@ bindkey -- "${key[PageDown]}" end-of-buffer-or-history | |||
| 74 | bindkey -- "${key[Shift-Tab]}" reverse-menu-complete | 84 | bindkey -- "${key[Shift-Tab]}" reverse-menu-complete |
| 75 | #bindkey -- "${key[Insert]}" overwrite-mode | 85 | #bindkey -- "${key[Insert]}" overwrite-mode |
| 76 | 86 | ||
| 87 | |||
| 88 | # Common shell options | ||
| 89 | alias ls='ls --color' | ||
| 90 | |||
| 91 | |||
| 92 | # Quick jump to parent folders | ||
| 93 | source ~/helper/zsh/bd.zsh | ||
| 94 | |||
| 95 | |||
| 77 | # Finally, make sure the terminal is in application mode, when zle is | 96 | # Finally, make sure the terminal is in application mode, when zle is |
| 78 | # active. Only then are the values from $terminfo valid. | 97 | # active. Only then are the values from $terminfo valid. |
| 79 | if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then | 98 | if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then |