Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
created 2006 · complexity intermediate · author Yakov Lerner · version n/a
Vim has the ability to display long echo-messages such that they are truncated in the middle to fit the line ('...' will appear in the line). But it's tricky to turn this capability on.
To turn this shortening on, you need two steps:
set shortmess+=T " add T flag to 'shortmess' option
:exe "norm :echomsg repeat('a',&co+10)\n" :exe "norm :echomsg LongMessage\n"
Or use the function
The first step (
set shortmess+=T) is straightforward. You might already have T in the
shortmess option already.
The second step is tricky.
:echo does not shorten long messages.
:echomsg, by itself, does not shorten long messages. Only when
:echomsg is used under
:norm, are long messages truncated. And don't forget trailing
\n when using
function! ShortEcho(msg) " regular :echomsg is supposed to shorten long messages when shortmess+=T but it does not. " under "norm echomsg", echomsg does shorten long messages. let saved=&shortmess set shortmess+=T exe "norm :echomsg a:msg\n" let &shortmess=saved endfunction