Live data from Hacker News

Use Zsh

fendrich.se

81–90 of 117 posts

Re: Use Zsh

#81

I used to use zsh but switched back to bash a couple years ago simply because the benefit wasn't worth the trouble. When I first changed back I went to some difficulty to get my PS1 to have color in it. That slowly faded away and now I have a visceral, negative reaction to prompts with that much colorful whizzy fu. Maybe in a few more years I'll trim out the username/hostname/path and become content with just a %.

It faded away because it was too difficult to get the prompt working?

This was an honest question to clarify what was meant by faded away... I appreciated the response... what is the problem? Sheesh

Re: Use Zsh

#82
post #75
post #70

Earlier quoted context omitted.

One important difference between how that completion works and zsh's is that zsh cycles between the available completions if you repeatedly type tab. E.g. if you have the files [less01.png, less02.png, less03.png] and type "eog less " in bash will show you the files. Press tab again and it will list the files again. In zsh, the second tab press would fill in "less01.png", then "less02.png" and so on. It's a matter of…

That is an inputrc configuration not a shell feature. http://stackoverflow.com/questions/7179642/how-can-i-make-ba... Yay Unix. Input collection is a pluggabls component.

That almost works. But it seems like you can't have tab to both bring up a list of completions and cycle through completions which zsh does.

Re: Use Zsh

#84

There's one of these "why you should convert from X to Y" posts every week or so. I understand that a person can be somewhat excited about finding a better application to replace their old stand-by and might feel the need to evangelize. I don't see anything wrong with wanting to introduce others to new software with a helpful attitude. However, it seems like all of the bash-to-zsh posts boil down to better autocomple…

The killer feature of zsh is not the tab completion but the globbing. Really.

More or less, you never need the 'find' tool when using zsh. For example, if I want to find all the Makefiles in this or child directories that have the string 'abc' and have been modified less than 1 hour ago, I can do

  $ grep -l abc **/Makefile(mh-1)
If I want to look at the most-recently-modified file, I can

  $ less *(om[1])
If I have a symlink 'dir' that points to a directory and I want to cd to the pointed-to directory, I can

  $ cd dir(:A)
Clearly, there are lots of codes, but you don't need to remember them, since the tab-completion gives you online help. I can type the '(' then press 'tab', and it'll give me a list of the various codes that can follow and what they mean. There are tons of others. If I want all

  *
EXCEPT

  *.h
I can use

  '*~*.h'
Or for instance, say I have a directory of photos. I want to pick DSC00095.jpg through DSC00107.jpg. In bash, you cry; in zsh I say

  DSC.jpg.
After I've typed in the glob, I can press 'tab', and it'll expand the glob in-place, letting me know if the code worked without executing. I can then undo to get the code back and have it live in my history.

This feature alone is enough to make a switch worthwhile. It did take me an hour to set up my .zshrc to work like bash, but this has easily paid for itself.

Re: Use Zsh

#85
post #33
post #30

Earlier quoted context omitted.

How many computers do you use? Having to switch between zsh and bash mentally when you from your dev box to a server can be jarring. For some people it's worth it, for others it isn't.

just stick an exec zsh at the end of your bashrc, wrapper in an if statement if it's not available on all machines on your environment. do people have the same attitude to screen/tmux or vim/emacs (vs nano)?

I don't think untog was talking about the overhead of executing zsh upon starting a new session so much as the mental overhead of the mode change from zsh specific features to those of another shell.

Re: Use Zsh

#86
post #41

This article really feels like bikeshedding to me. I'm always going to use whatever shell comes default with the OS I'm on (which almost always means Bash), simply because changing the shell is an unnecessary block of time that could instead be used writing software. I need a really good reason to switch, something the equivalent of pipes, and if the #1 reason you can give is "Powerful context based tab completion",…

This is the same logic that keeps me from jailbreaking my iPhone - it's possible and fairly straightforward, but eventually some condition (likely an important iOS point release) causes the situation to revert. f.lux for iOS is tempting me to re-visit this, as it's crucial to me getting a few more Z's at night.

Meanwhile I've been enjoying a jailbroken iPhone for over three years now. How many important iOS updates have there been anyway? All I can recall were the SMS exploit and the PDF exploit for which there was a fix available on Cydia sooner than Apple provided an iOS update.

Re: Use Zsh

#87
post #84

There's one of these "why you should convert from X to Y" posts every week or so. I understand that a person can be somewhat excited about finding a better application to replace their old stand-by and might feel the need to evangelize. I don't see anything wrong with wanting to introduce others to new software with a helpful attitude. However, it seems like all of the bash-to-zsh posts boil down to better autocomple…

The killer feature of zsh is not the tab completion but the globbing. Really. More or less, you never need the 'find' tool when using zsh. For example, if I want to find all the Makefiles in this or child directories that have the string 'abc' and have been modified less than 1 hour ago, I can do $ grep -l abc **/Makefile(mh-1) If I want to look at the most-recently-modified file, I can $ less *(om[1]) If I have a sy…

> Or for instance, say I have a directory of photos. I want to pick DSC00095.jpg through DSC00107.jpg. In bash, you cry; in zsh I say DSC.jpg.

No need to cry -- Bash does it this way:

   DSC{95..107}.jpg.

Re: Use Zsh

#88
I've been using zsh for a decade or so, and I like it quite a lot. For basic things, it works enough like bash to hardly notice it; but slowly I've learned all the special tricks.

Now, I would recommend against using /oh-my-zsh/ and the like wholesale; just add useful things to your zsh setup step-by-step, where you actually understand each step.

Otherwise you're just importing a blob of magic that can interact with other things in weird ways. /oh-my-zsh/ contains a lot of gems, but take them one by one.

Re: Use Zsh

#89
post #87
post #84

Earlier quoted context omitted.

The killer feature of zsh is not the tab completion but the globbing. Really. More or less, you never need the 'find' tool when using zsh. For example, if I want to find all the Makefiles in this or child directories that have the string 'abc' and have been modified less than 1 hour ago, I can do $ grep -l abc **/Makefile(mh-1) If I want to look at the most-recently-modified file, I can $ less *(om[1]) If I have a sy…

> Or for instance, say I have a directory of photos. I want to pick DSC00095.jpg through DSC00107.jpg. In bash, you cry; in zsh I say DSC .jpg. No need to cry -- Bash does it this way: DSC{95..107}.jpg.

Ugh... Did you actually try this?

  dima@fatty:/media/usb/DCIM/100RICOH$ ls R*
  R0022399.JPG  R0022400.JPG  R0022401.JPG  R0022402.JPG
  dima@fatty:/media/usb/DCIM/100RICOH$ bash -c 'ls R {22392..22402}*'
  ls: cannot access R22399*: No such file or directory
  ls: cannot access R22400*: No such file or directory
  ls: cannot access R22401*: No such file or directory
  ls: cannot access R22402*: No such file or directory
Bash seems to treat these as strings, not like numbers. So in this specific case, I could have manually counted the number of 0s that are required. In some other case where the field width wasn't constant, I wouldn't be able to do that. What if I have files

file.1, file.2, file.3, ..., file.9, file.10, file.11, ...

How do I pick 9-11 in bash? The point is zsh has features that are a real productivity boost. It's certainly arguable whether a switch is worthwhile, but claiming that these features are just "cosmetic" is wrong.

Re: Use Zsh

#90

There's one of these "why you should convert from X to Y" posts every week or so. I understand that a person can be somewhat excited about finding a better application to replace their old stand-by and might feel the need to evangelize. I don't see anything wrong with wanting to introduce others to new software with a helpful attitude. However, it seems like all of the bash-to-zsh posts boil down to better autocomple…

> My intent is not to discourage this author specifically, but rather to call into question the underlying motivation and behind and utility of all posts of this type.

http://xkcd.com/974/

Post reply on HN