You are not logged in.

#1 2015-07-23 13:32:16

colinh
Member
Registered: 2014-08-23
Posts: 19

Vim: how to set my own highlight colours?

Hi,

I'm creating my own syntax highlighting plugin (for ARM assembly code), by sort of following Steve Losh's nice Learn Vimscript the Hard Way book.

I'm using termite, a VTE-based terminal, which vim recognises as a cterm (out of term, cterm and gui). Now, according to Colors in Terminal, "modern" terminals (including xterm and termite) support TrueColor (24bit RGB) directly via escape sequences and

printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n"

does indeed print out TRUECOLOR in a nice orange in my terminal.


For each highlight group in Vim (eg. "Comment") one can define the colour (for each terminal type) and attributes, such as bold, underline or italic.


Here's the problem:
For the "term" type, one can specify start and stop escape sequences. Ironically, this would let me define 24-bit colours for the (non-colour) terminal.
For the "gui" type one can also specify 24-bit colours.
For the "cterm" type though, one appears to be limited to the 256-colour palette.

So, given that my terminal does support 24-bit colour, how do I convince Vim of the fact, without cheating? (ie. setting TERM to something wrong).

Offline

#2 2015-07-23 15:16:55

Malkymder
Member
Registered: 2015-05-13
Posts: 258

Re: Vim: how to set my own highlight colours?

Look at http://vim.wikia.com/wiki/256_colors_in_vim specifically the 'set t_Co=256' part

Offline

#3 2015-07-23 15:17:29

AaronBP
Member
Registered: 2012-08-06
Posts: 149
Website

Re: Vim: how to set my own highlight colours?

Vim doesn't support truecolor in the terminal, unfortunately. That's something you can get in neovim if you want. See https://github.com/neovim/neovim/wiki/F … e-terminal

If you need vim, you use the csapprox plugin to approximate the GUI colorscheme in your terminal for up to 256 color mode.

Offline

#4 2015-07-23 15:21:54

Stebalien
Member
Registered: 2010-04-27
Posts: 1,237
Website

Re: Vim: how to set my own highlight colours?

Vim doesn't support 24bit color (https://gist.github.com/XVilka/8346728# … iscussions). NeoVim, however, does (`export NVIM_TUI_ENABLE_TRUE_COLOR=1`).


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C
Do not email: honeypot@stebalien.com

Offline

Board footer

Powered by FluxBB