zshzsh-zle

zsh: how to get back 'unexpanded' command


Zsh has a nice feature of expanding globs. For example, hitting Tab turns ls **/*.js into

ls app/assets/javascripts/application.js vendor/assets/javascripts/Markdown.Converter.js

Is there a way to collapse it back to original glob version? Or should I just disable glob expanding?

The reason I want it, is that when I am in the middle of debugging a glob and I hit Tab just to double check something, there is no way to get back and complete the pattern. I have to start from scratch.


Solution

  • Use the undo zle command. For example, bind it to Ctrl_:

    bindkey '^_' undo
    

    From zshzle(1):

    undo (^_ ^Xu ^X^U) (unbound) (unbound)
           Incrementally undo the last text modification.
    
    redo   Incrementally redo undone text modifications.