1
0
mirror of https://github.com/mbirth/wiki.git synced 2024-11-14 14:06:46 +00:00
wiki.mbirth.de/know-how/software/linux/_posts/2009-07-17-zsh.md

2.3 KiB

title layout created updated toc tags
zsh default 2009-02-21 12:34:27 +0100 2009-07-17 23:13:24 +0200 false
know-how
software
linux

I recently switched to using the zsh instead of bash. The reasons were those comfort functions of zsh, such as:

  • menu driven completion (you can navigate items using the cursor keys)
  • command correction (typing mkae gives a Did you mean 'make'?)
  • parameter completion (shows possible parameters for most commands incl. a short description)
  • path name guessing (typing tail /v/l/dmesg gets corrected into tail /var/log/dmesg)

So I installed the packages: zsh, zsh-doc and zsh-lovers. When starting it for the first time, you'll encounter a configuration tool which asks several questions to make your zsh experience a good one.

Bad thing is: This tool can't read the settings you made in a previous session, so be careful running it a second time.

I found an easy way to make the prompt show only 2 parts of the PWD using some zsh-magic: [Prompt with 2 directories]({% post_url 2009-02-20-prompt-with-2-dirs %}).

My full configuration file is here: [.zshrc]({{ site.url }}/assets/zshrc.txt).

DEL-key not working

Using the Del-key changed the 3 letters after the cursor to upper case and then made further editing of the current line impossible. I found a solution to this problem over at gnegg.ch: Just add the following bindings to the .zshrc:

bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char

Problems with mc

zsh seems to cause problems with the Midnight Commander. The mc can't detect the PWD using zsh as a sub-shell and therefore gives several "Warning: Cannot change directory to …" although the path did change. But this message moves the rest of the screen and makes mc almost unusable. You can use mc without a subshell by starting it with mc -u or just switch your login-shell back to bash (in your /etc/passwd) and change the link of your preferred console application to e.g. gnome-terminal -e zsh - in the latter case, mc will use your login-shell (bash) as a sub-shell and work as expected.