about summary refs log tree commit diff
path: root/Functions/Zle/zed-set-file-name
blob: 7456106608308e851947885179abb21c195fa29b (plain) (blame)
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
emulate -L zsh

autoload -Uz read-from-minibuffer

case $curcontext in
  (zed:::)
    local curcontext=zed-set-file-name:::
    # The call to vared from zed does the equivalent of
    #  bindkey -A zed main
    # which confuses read-from-minibuffer.  Fix it.
    bindkey -A zed-normal-keymap main;;
  (zed-set-file-name:::)
    zle -M "zed-set-file-name: may not be called recursively"
    return 1;;
  (*)
    zle -M "zed-set-file-name: not called from within zed"
    return 1;;
esac
{
  local REPLY
  read-from-minibuffer "File name: "
  zed_file_name=$REPLY
} always {
  # Re-install the zed keymap in the way vared should have all along
  zle -K zed
}