All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 # Configure the zsh line editor
4 # Copyright © 1994–2017 martin f. krafft <madduck@madduck.net>
5 # Released under the terms of the Artistic Licence 2.0
7 # Source repository: http://git.madduck.net/v/etc/zsh.git
10 # allow 700ms between esc and subsequent character
13 # do not consider '/' to be part of a word, i.e. delete-word
14 # iterates through URL components
15 WORDCHARS="${WORDCHARS//\/}"
17 # esc-= :: Repeat the previous shell-word ($WORDCHARS)
18 bindkey '\e=' copy-prev-shell-word
20 # esc-q :: allow for better ad-hoc multiline editing
21 bindkey '\eq' push-line-or-edit
23 # Perform history expansion and insert a space into the buffer.
24 bindkey ' ' magic-space
26 # Automatically escape URLs
27 autoload -U url-quote-magic
28 zle -N self-insert url-quote-magic
30 autoload -U bracketed-paste-magic
31 zle -N bracketed-paste bracketed-paste-magic
33 # Change defaults and remove {} from the meta characters, as we often use them
34 # in the shell to create multiple URLs, e.g. http://example.org/{1,2,3}.txt
35 zstyle ':url-quote-magic:*' url-metas '*?[]^(|)~#='
37 # Allow editing of the command line using $EDITOR with esc-e
38 autoload -U edit-command-line
39 zle -N edit-command-line
40 bindkey '\ee' edit-command-line
42 # Bind esc-u/-U to insert date-/timestamp based on shell timezones
43 # (esc-t/-T does it from urxvt in the local timezone
44 _insert_datestamp() { LBUFFER+=${(%):-'%D{%Y-%m-%d}'}; }
45 zle -N insert-datestamp _insert_datestamp
46 bindkey '\eu' insert-datestamp
47 _insert_timestamp() { LBUFFER+=${(%):-'%D{%Y-%m-%d-%H%M%S}'}; }
48 zle -N insert-timestamp _insert_timestamp
49 bindkey '\eU' insert-timestamp
51 # Jump behind the first word (and the space) on the cmdline to add options
52 function _jump_after_first_word() {
57 if (( ${#words} <= 1 )) ; then
60 CURSOR=$((${#${words[1]}}+1))
63 zle -N _jump_after_first_word
64 bindkey '\e1' _jump_after_first_word
66 # ^k :: kill through the end of the line
67 bindkey '^k' kill-line
69 # ^? :: borrow backspace behaviour from emacs-mode, rather than stilly limited
71 bindkey $terminfo[kbs] backward-delete-char
73 # ^a/^e :: move to beginning and end of line, like emacs
74 bindkey '^a' beginning-of-line
75 bindkey '^e' end-of-line
77 # \ew :: print pwd to status line
78 function _whereami() {
79 zle -M "${(%):-"%m:%~"}"
82 bindkey '\ew' _whereami
84 # ^x^x :: execute widgets directory
85 bindkey '^x^x' execute-named-cmd