I have some instances that are part of a cloud environment. Their name is suffixed with an UUID, like:

```
<name-of-host>-411a7a0e-b409-46a0-bf8f-546ffc50ee2b

```

I don't want to hide it, since it helps me to know in which machine I'm in, so I'd like to see only the first 20 characters.

My default prompt is like:

```
PROMPT="[%n@%m %1~]%(#.#.$) "

```

So, my first attempt was:

```
PROMPT="[%n@%20>...>%m %1~]%(#.#.$) "

```

However, this doesn't work, as it shows like this:

```
user@name-of-host...<command prompt is right here>

```

Then I tried like this:

```
PROMPT="[%n@%{%20>...>%m%} %1~]%(#.#.$) "

```

It displays the prompt correctly, but when I try something like bck-i-search (`CTRL-R`), the portion inside the `%{...%}` is overwritten.

The ZSH docs explain why:

> 
> 
> ```
> %{...%}
> Include a string as a literal escape sequence.  The
>   string within the braces should not change the cur-
>   sor position.  Brace pairs can nest.
> 
> ```
> 
> 

Is there any other way of achieving what I want?