terminal - How to "highlight" using text in Vim? -


these 3 lines of vim script "highlights" instances of todo in source code placing [[[ , ]]] around it.

:set t_co=1 :highlight braces start=[[[ stop=]]] :call matchadd("braces", "todo") 

unfortunately, works in "normal terminals". why have set t_co 1.

can similar achieved in color terminal or in gui? (or in neovim?). extremely useful way of augmenting code meta information.

please keep in mind vim text editor; these display file contents as-is. in order augment code meta information, vim offers:

  • (syntax) highlighting: colors , text attributes bold or italic
  • concealment: hide or condense matches nothing / single character
  • signs (shown in column left of window)

your approach hack misuses definition of raw terminal codes; these meant invisible control sequences interpreted terminal, send visible text.

as you've found out @ :help highlight-args:

there 3 types of terminals highlighting: term      normal terminal (vt100, xterm) cterm     color terminal (ms-dos console, color-xterm, these have "co"           termcap entry) gui       gui 

the start= , end= arguments (that hack relies on) supported "normal terminals", not cterm , gui. that's why have :set t_co=1 (i.e. force non-color terminal) work.

because of these downsides (and more: redrawing problems, vertical navigation that's off), recommend drop this, , use 1 of "approved" methods listed above. there many vim users, , seem fine them well.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -