Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Automatically run ls on blank line for faster navigation



I rigged up a function that makes navigation super fast in zsh. If you
hit enter on a blank line, it runs ls automatically.

Just add the following to your .zshrc:
auto-ls () {
    if [[ $#BUFFER -eq 0 ]]; then
        echo ""
        ls
        zle redisplay
    else
        zle accept-line
    fi
}
zle -N auto-ls
bindkey '^M' auto-ls

To get the ^M correct in vim, hit <Ctrl+V><Enter>. You could really
make this run whatever you want, on any key you want, but I like this
shortcut in particular (It goes great with autocd!).

Cheers,
Mitch



Messages sorted by: Reverse Date, Date, Thread, Author