Closed 2Belette closed 3 months ago
Hi @2Belette. In steeef.zsh-theme, replace %m
by %2m
two have 2 components displayed (or replace by the number you prefer), or by %M
to have the full machine hostname displayed.
See more at the Prompt-Expansion documentation.
Thanks @ericbn ! I learned something :) For my usecase it doesn't work as my machine has short name in hostname and I would need to find a way to append the domain name but I can't find a way. Is there a way to parse anything? like echoing something
Doesn't %M
work?
@lnicola it is giving me the same result as %m
for example : username : belette name of the computer : x1 domain name on resolv.conf (mydomain.com)
zim prompt with %m :belette at x1 in ~$ zim prompt with %M : belette at x1 in ~$
No difference
Note that the domain
(called search
now) line in resolv.conf
doesn't set the domain name of your current computer, but configures the DNS resolver. The FQDN is in /etc/hostname
(or you can check it with hostnamectl
if you're running systemd
).
I think you can also embed commands in the prompt (PS1='$(ls)'
), but reading that file on each prompt would be quite slow. I would rather make sure the domain is configured correctly instead.
Would it be possible to do a quick hack to display domain after the host on steeef theme ? I like this theme so much, but I have multiple VM with the same name bur on different domain, so I got the same result when I connect to them :
user at host in /home/....#
I would like to append the domain to show user at host.domain1 in /home/....# user at host.domain2 in /home/....#
I know how to do that manually but would it be possible to retrieve it from resolv.conf for example ?
I would like to avoid extra ms to display / parse and more importantly not sending anything to the network.
If you have any suggestions :)