Bind key for the full file name wherever the context is in Zsh

Sometimes I need a filename instead of zsh guessing about me. For example, I have a PNG file without the proper suffix .png, which makes zsh think that this is not an image, and will not list it when I type Tabto complete the arguments display.

I am wondering if there is a key sequence that ends with a file name wherever the context is, for example, ^XCfor _correct_filename, or how to configure zsh to perform this task?

+5
source share
1 answer

You can add key bindings to do what you want:

zle -C complete complete-word complete-files
bindkey '^X\t' complete
complete-files () { compadd - $PREFIX* }

: $PREFIX

~/.zshrc .

, Ctrl - x Tab Tab. , .

, ImageMagick, , ( ) /usr/share/zsh/functions/Completion/Unix/_imagemagick ( ) , , _files, :

if (( $# )); then
  # _files "$@" -g "*.(#i)(${~formats//:/|})(-.)"
  _files "$@"
  return
fi
+7

All Articles