X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=zsh%2Frc;h=f82abc75268ba2332901abcf196f5477e7c1a60d;hb=bf112c3be047b2e3849b583dc3c8932e1b38d39d;hp=7c833b5194b45263d16bc5b9b360f8cb8294a7ec;hpb=819bc9d7c9a57af67b48995ea17a1d8f63c6f58d;p=config%2Fdotfiles.git diff --git a/zsh/rc b/zsh/rc index 7c833b5..f82abc7 100644 --- a/zsh/rc +++ b/zsh/rc @@ -96,7 +96,7 @@ fi # Autoload add-zsh-hook to add/remove zsh hook functions easily. autoload -Uz add-zsh-hook -# Load zmv (zsh move) which is powerful to rename files. +# Load zmv (zsh move) which is a powerful file renamer. autoload -Uz zmv @@ -114,10 +114,10 @@ setopt incappendhistory setopt histignoredups # Vim like completions of previous executed commands (also enter Vi-mode). If # called at the beginning it just recalls old commands (like cursor up), if -# called after typing something, only lines starting with the typed are -# returned. Very useful to get old commands quickly. Thanks to Mikachu in #zsh -# on Freenode (2010-01-17 12:47 CET) for the information how to a use function -# with bindkey. +# called after typing something, only lines starting with the typed text are +# returned. Very useful to get old commands quickly - in addition to the +# history commands (!..). Thanks to Mikachu in #zsh on Freenode (2010-01-17 +# 12:47 CET) for the information how to a use function with bindkey. zle -N my-vi-history-beginning-search-backward my-vi-history-beginning-search-backward() { local not_at_beginning_of_line @@ -140,6 +140,15 @@ bindkey -a '^P' history-beginning-search-backward # binding for Vi-mode # after calling ^P. bindkey -a '^N' history-beginning-search-forward +# Automatically push cd-ed directories on the directory stack. +setopt autopushd +# Don't push duplicates on the directory stack. +setopt pushdignoredups +# Exchange the meaning of + and - when specifying a directory on the stack. +# This way cd - lists the last used directory first, which is more +# natural because cd - goes to the last directory. +setopt pushdminus + # PROMPT SETTINGS @@ -150,7 +159,7 @@ autoload -Uz colors && colors zmodload zsh/datetime # Some shortcuts for colors. The %{...%} tells zsh that the data in between -# doesn't need any space, necessary for correct prompt draw. +# doesn't need any space, necessary for correct prompt drawing. local red="%{${fg[red]}%}" local blue="%{${fg[blue]}%}" local green="%{${fg[green]}%}" @@ -203,7 +212,7 @@ if [[ $ZSH_VERSION == (4.3.<9->|4.<4->*|<5->*) || zstyle ':vcs_info:*' unstagedstr '¹' zstyle ':vcs_info:*' stagedstr '²' - # Default to running vcs_info. If possible we prevent running it later for + # Default to run vcs_info. If possible we prevent running it later for # speed reasons. If set to a non empty value vcs_info is run. FORCE_RUN_VCS_INFO=1 @@ -249,16 +258,15 @@ else fi # Set the prompt. A two line prompt is used. On the top left the current -# working directory is displayed, on the right vcs_info (if available). On the -# bottom left current user name and host is shown, the exit code of the last -# command if it wasn't 0, the number of running jobs if not 0. +# working directory is displayed, on the right vcs_info (if available) and the +# current time in hex. On the bottom left current user name and host is shown, +# the exit code of the last command if it wasn't 0, the number of running jobs +# if not 0. # # The prompt is in green and blue to make easily detectable, the error exit # code in red and bold and the job count in yellow. # # Thanks to Adam's prompt for the basic idea of this prompt. -# -# The current time is display in hex in the right prompt. prompt_precmd() { # Regex to remove elements which take no space. Used to calculate the # width of the top prompt. Thanks to Bart's and Adam's prompt code in @@ -445,8 +453,8 @@ fi # COMPLETION SETTINGS -# Load the complist module which provides additions to completion lists -# (coloring, scrollable). +# Load the complist module which provides additional features to completion +# lists (coloring, scrolling). zmodload zsh/complist # Use new completion system, store dumpfile in ~/.zsh/cache to prevent # cluttering of ~/. $fpath must be set before calling this. Thanks to Adlai in @@ -454,15 +462,16 @@ zmodload zsh/complist # problem. autoload -Uz compinit && compinit -d ~/.zsh/cache/zcompdump -# Use cache to speed up completions. +# Use cache to speed up some slow completions (dpkg, perl modules, etc.). zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path ~/.zsh/cache # Complete arguments and fix spelling mistakes when possible. zstyle ':completion:*' completer _complete _match _correct _approximate -# Make sure the list of possible completions is displayed after pressing -# the first time. +# If there are multiple matches after pressing always display them +# immediately without requiring another . a lists aaa, aab, aac as +# possible completions if the directory contains aaa, aab, aac, bbb. setopt nolistambiguous # Allow completions in the middle of a text, i.e. "/usr/bin/whatever" # completes like "/usr/bin/". Useful when adding new options to commands. @@ -471,14 +480,13 @@ bindkey '^I' expand-or-complete-prefix # typing in lowercase most of the time and completion fixes the case. zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' -# Use ls like colors for completions. +# Use ls-like colors for completions. zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} # Make completion lists scrollable so "do you wish to see all n possibilities" -# is no longer displayed. +# is no longer displayed. Display current position in percent (%p). zstyle ':completion:*' list-prompt '%p' -# Display group name (like 'external command', 'alias', etc.) when there are -# multiple matches in bold. +# Display group name (%d) (like 'external command', 'alias', etc.), in bold. zstyle ':completion:*' format ' %B%d%b:' # Display different types of matches separately. zstyle ':completion:*' group-name '' @@ -504,9 +512,10 @@ zstyle ':completion:*:(mv|cp):*' ignore-line no zstyle ':completion:*:*:-command-:*' ignored-patterns './config.*' # Don't complete unwanted files with Vim. Thanks to Nomexous in #zsh on -# Freenode (2010-06-06 04:54 CEST). See below to complete them. -zstyle ':completion:*:*:vim:*:all-files' ignored-patterns '*.aux' '*.log' \ - '*.pdf' '*.class' +# Freenode (2010-06-06 04:54 CEST). See below for a way to complete them. +zstyle ':completion:*:*:vim:*:all-files' ignored-patterns \ + '*.aux' '*.log' '*.pdf' \ + '*.class' # Provide a fallback completer which always completes files. Useful when Zsh's # completion is too "smart". Thanks to Frank Terbeck