---
title: zsh
layout: default
created: 2009-02-21 12:34:27 +0100
updated: 2009-07-17 23:13:24 +0200
toc: false
tags:
  - know-how
  - software
  - linux
---
I recently switched to using the [zsh](http://zsh.sf.net/) instead of [bash](http://www.gnu.org/software/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](apt://zsh), [zsh-doc](apt://zsh-doc) and [zsh-lovers](apt://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 <kbd>Del</kbd>-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](http://www.gnegg.ch/2004/10/delete-key-in-zsh/):
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.
