The zshmisc man page on my new Debian Squeeze install states, under SIMPLE PROMPT ESCAPES:%mThe hostname up to the first `.'. An integer may follow the '%' to specify howmany components of the hostname are desired. With a negative integer, trailingcomponents of the hostname are shown.When I include %2m in my prompt, I see differing behaviour between OSX and Linux.On OSX (10.7.3), running zsh 4.3.11, the prompt behaves as expected, showing the two leading components of the system hostname.On Debian, running zsh 4.3.10, the prompt still only shows the bare hostname. hostname -f on this system confirms that the full hostname is set correctly. Note also that the manpage for this zsh release says that %2m should be supported.Does anyone have any suggestions as to where to start debugging this?
ZSH %m prompt escape not working as documented under Debian Linux
zsh;prompt;hostname
A quick look at zsh's prompt handling source code suggests that %m is based on what your system returns for the gethostname system call.  That's like running hostname without the -f option.I'm assuming running hostname without -f returns your bare hostname on your Debian system?You could try changing your hostname to include the domain name.  The Debian HowTo/ChangeHostname docs should help with that.  But maybe some Debian tools assume your hostname does not include the domain name, so that might be a bad idea.It might make more sense to just use command substitution.First set the PROMPT_SUBST optionsetopt PROMPT_SUBSTthen you can run any command and put its output in the prompt like this:PS1='$(hostname -f)$ 'to get only the first however many parts of the hostname, you could use cut, e.g.PS1='$(hostname -f | cut -f 1-2 -d .)$ 'Because your hostname shouldn't change, you could also be a little more efficient by running the command just once and storing it in a variable, then using the variable, e.g.HOSTANDSUBDOMAIN=$(hostname -f | cut -f 1-2 -d .)PS1=$HOSTANDSUBDOMAIN$ 