1 |
On Sun, Jul 12, 2015 at 06:52:35PM -0700, walt wrote: |
2 |
> Maybe someone here has missed the recent discussion of zsh? ;) |
3 |
> |
4 |
> I just found this website, giving a wonderful primer on how to |
5 |
> configure zsh: |
6 |
> |
7 |
> http://wiki.redbrick.dcu.ie/mw/Account_Customisation_(zsh) |
8 |
> |
9 |
> Disclaimer: I have no idea who they are, but I found this article very |
10 |
> helpful indeed, and their advice Worked For Me. |
11 |
> |
12 |
> In particular, I wanted to set my zsh command prompt to look like the |
13 |
> custom bash prompt I've been using forever: |
14 |
> |
15 |
> echo $PS1 |
16 |
> \u@\h:\w |
17 |
> |
18 |
> Now here's the equivalent value in zsh: |
19 |
> |
20 |
> echo $PS1 |
21 |
> %n@%M:%~ |
22 |
> |
23 |
> The most significant thing I just learned is that the zsh config name |
24 |
> for its command prompt is PS1, the same as for bash. (I needed help |
25 |
> from the above-named website to get the details, but that was easy.) |
26 |
> |
27 |
> I made the change to PS1 permanent by adding this familiar line to my |
28 |
> ~/.zshrc: |
29 |
> |
30 |
> export PS1="%n@%M:%~ " |
31 |
> |
32 |
> Here is one interesting feature of zsh: when I type e.g. 'les' and |
33 |
> then hit Tab to invoke shell-completion, zsh shows me the usual |
34 |
> suspects like less, lessecho, lesskey, etc. |
35 |
> |
36 |
> But then if I continue to hit Tab multiple times, zsh actually changes |
37 |
> the command prompt, rotating the possible commands through all the |
38 |
> possible choices, and then I can just hit Return to execute my choice. |
39 |
> |
40 |
> A minor feature, but clever, I think. |
41 |
|
42 |
zsh can also auto-complete all sorts of things, including process list |
43 |
for `kill' and `pkill', zfs datasets for the zfs and zpool commands... |
44 |
you can even write your own completions for any command. |
45 |
|
46 |
just wanted to point out, that the article got the "Adding colors to the |
47 |
command prompt" part a little wrong. instead of using raw escape |
48 |
sequences, zsh supports constructs like %F{red}, %F{green}, ... and %f. |
49 |
you can read more about them in the zshmisc(1) manpage. |