zsh-workers
 help / color / mirror / code / Atom feed
04fccf1763dc77962350a60950b1faa35903a801 blob 1774 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
 
# This function lets you implement widgets that can execute arbitrary commands
# without losing the current command line, in a fashion similar to the
# 'run-help' and 'which-command' widgets. You can use this, for example, to
# create key bindings that let you instantly change directories, even while in
# the middle of typing another command:
#
#   autoload -Uz execute-command
#   setopt autopushd pushdminus pushdsilent
#   zle -N cd-upward  ; cd-upward()   { execute-command cd .. }
#   zle -N cd-backward; cd-backward() { execute-command pushd -1 }
#   zle -N cd-forward ; cd-forward()  { execute-command pushd +0 }
#   bindkey '^[^[[A' cd-upward; bindkey '^[^[OA' cd-upward
#   bindkey '^[-' cd-backward
#   bindkey '^[=' cd-forward
#

case $CONTEXT in
  ( start ) # PS1
    ;;
  ( cont )  # PS2
    # Add a one-time hook that will re-run this widget at the top-level prompt.
    autoload -Uz add-zle-hook-widget
    local hook=line-init
    local func=:$hook:$WIDGET
    eval "$func() {
      # Make sure we don't run twice.
      add-zle-hook-widget -d $hook $func

      # Don't leave anything behind.
      zle -D $func
      unfunction $func

      zle $WIDGET
    }"
    add-zle-hook-widget $hook $func

    # Move the entire current multiline construct into the editor buffer. This
    # function is then aborted and we return to the top-level prompt, which
    # triggers the hook above.
    zle .push-line-or-edit
    return  # Not actually necessary, but for clarity's sake
    ;;
  ( * )
    # We don't want this to be used in a select loop or in vared.
    return 1
    ;;
esac

# Push the current buffer onto the buffer stack and clear the buffer. The ZLE
# will auto-restore it at the next top-level prompt.
zle .push-line

BUFFER="$*"
zle .accept-line
debug log:

solving 04fccf176 ...
found 04fccf176 in https://inbox.vuxu.org/zsh-workers/AEC92FEA-6216-4952-818E-9DC7C584698A@gmail.com/

applying [1/1] https://inbox.vuxu.org/zsh-workers/AEC92FEA-6216-4952-818E-9DC7C584698A@gmail.com/
diff --git a/Functions/Zle/execute-command b/Functions/Zle/execute-command
new file mode 100644
index 000000000..04fccf176

Checking patch Functions/Zle/execute-command...
Applied patch Functions/Zle/execute-command cleanly.

index at:
100644 04fccf1763dc77962350a60950b1faa35903a801	Functions/Zle/execute-command

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).