I feel lost without it, more than the tab completion.
I don't want to miss this plugin and can't really understand why not everyone wants it. I guess I am a little biased though since I wrote that plugin ;)
Zsh would probably be worth using, except for the fact that bash is almost everywhere, and I already know it very well. It's a tough one to call.
bind '"^[[1;5A": history-search-backward'
bind '"^[[1;5B": history-search-forward'
where ^[ is the escape character. This way, crtl-up goes to previous partial match (and up goes to last command as usual). I use it all the time. # Use up/down arrows to search on partially typed command
bind '"\e[A"':history-search-backward
bind '"\e[B"':history-search-forward
Just type the first letter(s) and use the up/down arrows to scroll through the filtered command history. Incredibly convenient.This is not to say that zsh doesn't have a lot more features, just that the comparison from the perspective of an osx user tends to be a lot more stark.
For example, I contributed bracketed paste support to bash and readline. Yay! No more inadvertent command execution! No security problems pasting shell commands from web pages! You'd think we'd want that feature enabled by default, right?
Well, no. The feature will be off by default. For reasons.
http://lists.gnu.org/archive/html/bug-bash/2014-10/msg00211....
ls something<TAB>
will complete to ls prefixSomething.sh
if it's unique enough. This is probably my single favorite zsh feature.It's like ido, but reorders the commands it presents to you in most-frequently-used order, which can be a real time-saver.
Just trying to save others some time here.
alias -g L=' | less '
which allows me to simply append "L" to a line to pipe the output to less. ls L
The pattern of short all-caps global aliases for ' | command 's make building/editing pipelines really easy/fast. alias -g C=' | wc -l '
alias -g A=' | ack-grep '
alias -g S=' | sort '
alias -g JQL=' | jq -C | less'
ls **/*png L
ls **/*png A -v regex C
curl $site JQL
puttingbindkey '^g' _expand_alias
in your zshrc allows you to expand aliases with <C-g>
You can find more global aliases and tips at: http://grml.org/zsh/zsh-lovers.html
say I type
$ sudo pacman -Syu
$ sudo chown blah blah
$ sudo pa <UP>
I just get `sudo chown blah blah` instead of `sudo pacman -Syu`Does anybody know how to fix this? :)
$ sudo foo
$ sudo bar
$ sudo fo<UP>
gives me `sudo foo`.I'm using zsh 5.0.7 (x86_64-apple-darwin14.0.0) on OS X 10.10 (with prezto[1]).
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
rationalise-dot() {
if [[ $LBUFFER = *.. ]]; then
LBUFFER+=/..
else
LBUFFER+=.
fi
}
zle -N rationalise-dot
bindkey . rationalise-dot
When you hit ... it will produce a slash and a ../ for each . you type after that. alias ..="cd .."
alias ...="cd ../.."
After that, the more dots you type, the more error-prone it is, as you start to have to carefully count exactly how many directories you have to go up to get to where you want.A better alternative is a script that shows a list of parent directories and lets you select them by typing the number or letter associated with them.
For example, if your current directory is "/a/b/c/d/e/f/g/h", then the script would display something like:
List of parent directories:
1 - a
2 - b
3 - c
4 - d
5 - e
6 - f
7 - g
Please choose a directory: _
and you could type "3" to get to directory "c". That would be equivalent to typing "......", but much less error-prone and it'll save you the tedium of counting dots too.all those z shell features the only useful one (i.e. the only one that's impossible on bash) is the recursion (i typed star star, but hn hides it) hack.
and it's awful. because now you just learned something that you can't use anywhere else! and to search that same way in a shell script? though luck.
also it has less parameter then find. and find is available everywhere so you can use it in scripts.
$ echo **/*.txt
Of course if you're using an ancient version of bash, you're out of luck. $ bash --version
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
GNU bash, version 4.1.13(7)-release (x86_64-unknown-cygwin)I wrote a tutorial on how to install it on Mac OS X and Ubuntu: http://hackercodex.com/guide/install-fish-shell-mac-ubuntu/ For me, the chief advantage to Fish is that you get more functionality out-of-the-box than with most other shells, including zsh.
I also published two related projects for easily sharing Fish shell enhancements — Tacklebox https://github.com/justinmayer/tacklebox and Tackle https://github.com/justinmayer/tackle) — because I wanted a way for folks to be able to have access to multiple plugin repositories and easily share their favorite shell snippets.
https://github.com/everett1992/dotfiles/blob/master/home/.zs...
I have noticed that zsh's globbing is greedy.
`grep ^foo *` tries to expand ^foo when bash would pass it as a string to grep.