]> git.donarmstrong.com Git - zsh.git/blob - .zsh/zshrc/80_zle
add ~/.local/bin to PATH
[zsh.git] / .zsh / zshrc / 80_zle
1 # -*- mode: sh -*-
2 # zshrc/80_zle
3 #
4 # Configure the zsh line editor
5 #
6 # Copyright © 1994–2008 martin f. krafft <madduck@madduck.net>
7 # Released under the terms of the Artistic Licence 2.0
8 #
9 # Source repository: git://git.madduck.net/etc/zsh.git
10 #
11
12 # automatically escape URLs
13 # /usr/share/zsh*/functions/Zle/url-quote-magic
14 autoload -U url-quote-magic
15 zle -N self-insert url-quote-magic
16 setopt no_nomatch
17
18 # http://www.zsh.org/mla/users/2006/msg00399.html
19 autoload      edit-command-line
20 zle -N        edit-command-line
21 bindkey '\ee' edit-command-line
22
23 _insert_datestamp() { LBUFFER+=${(%):-'%D{%Y.%m.%d}'}:; }
24 zle -N insert-datestamp _insert_datestamp
25 bindkey '\et' insert-datestamp
26
27 # prefix search (up to cursor position)
28 autoload history-search-end
29 zle -N history-beginning-search-backward-end history-search-end
30 zle -N history-beginning-search-forward-end  history-search-end
31 bindkey "\e[5~" history-beginning-search-backward-end # PageUp
32 bindkey "\e[6~" history-beginning-search-forward-end  # PageDown
33
34 _insert_last_typed_word() { zle insert-last-word -- 0 -1 };
35 zle -N _insert_last_typed_word;
36 bindkey "\em" _insert_last_typed_word
37
38 autoload insert-unicode-char
39 zle -N insert-unicode-char
40 bindkey '^Xi' insert-unicode-char
41
42 # jump behind the first word on the cmdline to add options
43 function _jump_after_first_word() {
44     local words
45     words=(${(z)BUFFER})
46
47     if (( ${#words} <= 1 )) ; then
48         CURSOR=${#BUFFER}
49     else
50         CURSOR=${#${words[1]}}
51     fi
52 }
53 zle -N _jump_after_first_word
54 bindkey '^x1' _jump_after_first_word
55
56 # vim:ft=zsh