Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make hard-coded strings heinous-looking in VIM?

Tags:

vim

colors

I was inspired by this (number 2) to make my hard-coded strings ugly.

How can I do this in VIM?

like image 1000
Thomas G Henry Avatar asked Dec 31 '22 05:12

Thomas G Henry


2 Answers

The language-based files are stored in $VIMRUNTIME/syntax, one .vim file per language, so that's where you need to go to change things.

For example, my C file is stored in C:\Program Files\Vim\vim70\syntax\c.vim and, if you add the following line near the end, before the let b:current_syntax = "c", you'll get the exact effect you require:

hi String guifg=#ff0000 guibg=#ffff00

For text-based VIM, the ctermfg and ctermbg options need to be used instead, something like:

hi String ctermfg=Red ctermbg=Yellow

I haven't tested these since I only use gvim nowadays.

like image 190
paxdiablo Avatar answered Jan 01 '23 19:01

paxdiablo


In your .vimrc:

highlight String guifg=1 guibg=11
like image 34
Paul Beckingham Avatar answered Jan 01 '23 19:01

Paul Beckingham