Live data from Hacker News

My favourite Zsh features

code.joejag.com

41–44 of 44 posts

Re: My favourite Zsh features

#41

Clever history doesn't really work for me when I use `sudo` say I type $ sudo pacman -Syu $ sudo chown blah blah $ sudo pa I just get `sudo chown blah blah` instead of `sudo pacman -Syu` Does anybody know how to fix this? :)

I don't know how to fix, but this behavior is actually set by oh-my-zsh, so the other commenter does not get the same result.

Re: My favourite Zsh features

#42
post #32
post #15

interestingly you can s/bash/zsh/ and s/zsh/bash/ in this text and everything also works.

How do you get a menu like in the second screenshot in bash?

There is no such menu (tried it on CentOS and OS X). It simply lists the available directories.

Re: My favourite Zsh features

#43
post #32

Earlier quoted context omitted.

How do you get a menu like in the second screenshot in bash?

There is no such menu (tried it on CentOS and OS X). It simply lists the available directories.

Note that he uses ohmyzsh. There's ohmybash too: https://github.com/revans/bash-it

For menu complete with bash, the easiest is to add:

TAB menu-complete

inside of "~/.inputrc" then start a new shell to test it. Thats because it uses readline to handle command line (and inputrc configures readline).

Note: im not saying the experience is not better in zsh, just that both can do all this stuff. ive been switching between zsh and bash quite a few times myself over the last decade and use bash daily most of the time lately.

In my eyes:

zsh:

- nice and neat to configure/less bloat maybe

- powerful scripting language

- some scripting syntax requires zsh so when you get used to that... you write non-portable stuff ;)

bash:

- does approx everything zsh does and some more

- scripting language works everywhere because everyone has default to bash

- scripting language is slightly less powerful than zsh in some ways

- configuration is a little more all over the place (just like the .inputrc above)

Thus, all things considered, and given the improvements in bash over the last past .. 5 years or so - i'm using bash more often even thus zsh is also a very nice shell.

Re: My favourite Zsh features

#44

Clever history doesn't really work for me when I use `sudo` say I type $ sudo pacman -Syu $ sudo chown blah blah $ sudo pa I just get `sudo chown blah blah` instead of `sudo pacman -Syu` Does anybody know how to fix this? :)

There's a variety of different things you can bind up-cursor to. It sounds like you want. bindkey '\e[A' history-beginning-search-backward

Even better is the function in Functions/Zle/up-line-or-beginning-search To use that, you need to first do: autoload -U up-line-or-beginning-search zle -N up-line-or-beginning-search

Post reply on HN