Pergunta

Is it possible to color the completed part of the partial completion results in Zsh?

Fish does this by default (in Gentoo at least) as shown in the image below:

enter image description here

Full size image: http://i.imgur.com/tN6w3.png

Foi útil?

Solução

Yes, you can do it with things like that:

zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)*==02=01}:${(s.:.)LS_COLORS}")'

Just change the 01 and 02 colors so it matches your taste, for example to match your screenshot:

zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)*==34=34}:${(s.:.)LS_COLORS}")';

(Taken from reddit thread, added here to help people searching for this, like I did.)

Outras dicas

I think [1] is thing you want. You need menu and select as @svlasov commented.

[1]. ZSH highlight on tab

I long time ago (2002) i wrote a experimental shell script to explain about control characters in shell. Check this out http://cltfc.sites.uol.com.br/ and you gonna see a lot of examples about how to color, make sounds and positioning of any char on your black screen. But this is for Bash and i do not know if they are compatible.

Anyway, for Zsh, check this page http://spiralofhope.wordpress.com/2009/04/23/zsh-ansi-prompt/ and you gonna see some examples of how to customize your prompt with colors. The same ANSI codes for colors and the same syntax should work when you use directly on the shell.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top