Multi-dot paths in zsh, like `cd …`

前端 未结 4 1522
被撕碎了的回忆
被撕碎了的回忆 2021-02-05 23:54

All shells understand these commands:

$ cd .
$ cd ..

And zsh will also understand:

$ cd ...
$ cd ....

Provide

4条回答
  •  我寻月下人不归
    2021-02-06 00:58

    A good option is manydots-magic, which expands ... into ../.., etc. but does it intelligently. See the link above for more details, but briefly:

    • It allows you to revert the expansion with a single Backspace (if it were the last thing you typed).
      • But it won't revert explicitly typed ../..
    • You can use it inline, e.g. cd a/b/..../y/z.
    • Nevertheless, it won't expand when it doesn't make sense, e.g. git log branch...
    • It will expand when it might make sense, but revert when you type more. e.g.
      • git diff ... -> git diff ../..
      • git diff ...b -> git diff ...b (for git diff ...branch)

提交回复
热议问题