I switched to zsh from bash several years ago, for several useful features:
Better tab-completion for command flags
Ignore duplicates in history. This saves me from scrolling past commonly run commands all the time, like “ls”
The “push-line” action, which pushes the current text on the line into a stack that will get popped after you press enter. This is useful when you type a long command to run, but realize that you want to run another command first.
It’s been too long at this point, but I seem to recall that the vi mode was more complete than bash’s
As mjn mentioned, the multi-line editing is more sane and useful
The ** glob is really nice; it expands across multiple directories, so **/*.c expands to all .c files in subdirectories
I’ve been using zsh for a long time, but I don’t really use push-line. Instead, I tend to do C-a C-k, run the other command, then C-y. Or, if in vi mode, ESC 0 d$, run the command, followed by ESC p.
You can do that in Bash by putting ‘erasedups’ in HISTCONTROL. I also want commands that start with a space to be ignored by the history, so I have this in my ~/.bashrc:
I switched to zsh from bash several years ago, for several useful features:
I’ve been using zsh for a long time, but I don’t really use push-line. Instead, I tend to do C-a C-k, run the other command, then C-y. Or, if in vi mode, ESC 0 d$, run the command, followed by ESC p.
2 and 6 exist in bash too. 3 can be easily achieved by putting a # at the start of the command you want to run later.
You can do that in Bash by putting ‘erasedups’ in HISTCONTROL. I also want commands that start with a space to be ignored by the history, so I have this in my ~/.bashrc: