vim: highlight Folds change only background color - vim

I have commented out the
"hi Fold …
line in my current vim-colorscheme (xoria256 modified), but when I edit there is still (an even uglier) syntax highlight. I looked in the syntax file for the specific filetype - but there was no Fold highlight too. Now I don't know where to look for a "default syntax highlighting".
In the end I just want to have folds with foreground color as specified by syntax and just the background changed. Maybe I am thinking to much and there is a plain easy way to do that.
ps: i tried to leave off the guifg and ctermfg part to no success.

I'm afraid that doing so is not possible (at least without touching Vim's source code). The text in the fold line is computed and not part of your file, which means that it will not be processed like the rest of the text/code and it will be only applied the Folded highlighting group. That's why you get a single foreground color when you comment out the hi Folded line.

Related

Highlighting and syntax trouble in vim using rmarkdown

I would like to get Vim to stop highlighting list characters (-,*) and heading characters (#) in rmarkdown. You can find a screenshot here: https://imgur.com/a/0YSB8V8.
This is happening when I set the file type to either pandoc or rmd. This is also happening no matter what terminal or colortheme I use.
I have the plugins: vim-pandoc, vim-pandoc-syntax, and vim-rmarkdown installed.
I would like to know a way to make the two characters just appear normally.
I would also like to know if there is a way to make italicized text in tables and headings appear italicized. As far as modifying the appearance of italicized text, I've tried using: hi Italic ctermfg=red cterm=italic in my vimrc, but that does not seem to affect the text in between asterisks (*) in rmd files. I admit I don't know much about the way that syntax works in Vim. Do I need to modify after/ftplugin/rmd.vim or runtime/syntax/rmd.vim? What is the difference between the two?
Any help would be appreciated!
Your syntax highlighter does not seem to recognize the bullet points, but thinks that they mark the beginning of an italic span. Maybe you have a clash of plugins. You could also try another highlighter (e.g. vim-polyglot, supports italics).
vim-pandoc-syntax uses the conceal feature (:h conceal). You can recolor the highlighting group Conceal to change the appearance of the replacement characters.
You can put changes to existing syntax files in .vim/after/syntax/rmd.vim. Files in syntax are executed when they are needed for the first time, but at most once per session. Files in ftplugin are executed every time the file type is changed.

Tweaking syntax checker shellcheck's highlight colors (with syntastic and pathogen)

To me, shellcheck's highlight colors and message zone (where syntax is flagged as dubious and warnings are displayed) are both wrong.
Is it possible to modify status-line and main window highlight colors used by shellcheck?
I looked into that and since I have syntax on in ~/.vimrc. I imagine that my main window's highlight color scheme is vim's default, as opposed to having syntax enable, the which supposedly allows subsequent definition of a highlight color scheme by the user.
Digging a bit more, I found that since syntastic's install, I have the following for the status line in ~/.vimrc:
" General status line option unchanged (vim window and multiple buffer window) - already there before Syntastic
set statusline=%<\ %n\ %f\ %m%r%h\ %y%h%=\ Line:\ \%l/\%L\ (\%p%%)\ Column:\ \%c\
" Syntastic options (new)
" Set highlight group 'warningmsg' <= defined where?
set statusline+=%#warningmsg#
" No clue what function SyntasticStatuslineFlag() to evaluate is or does...
set statusline+=%{SyntasticStatuslineFlag()}
" Restore normal highlight mode or scheme
set statusline+=%*
I am not intent on completely revisiting the warningmsg hi-color scheme. Instead I want to modify a few color hi-rules for syntax checking, so my terminal window does not punch me in the face, whenever I trip a syntax checker in bash or C or Python or whatever.
Can I modify the height of the syntastic's message display area in the terminal's vim's window? It find it way too big. Ideally I'd like to be able to modify it directly from my vim session to adapt it to circumstances. If not possible, just permanently shaving a couple of lines off it would be good.
Is it possible to modify status-line and main window highlight colors used by shellcheck?
Shellcheck doesn't highlight anything. It doesn't know, nor care, about either Vim, or highlighting. The one doing the highlighting is syntastic. It does that by using highlighting groups that are linked to some standard ones by default. It's up to you to redefine the colors corresponding to these groups. See :help syntastic-highlighting.
Highlighting the status line is possible, but not trivial. It has nothing to do with syntastic.
" No clue what function SyntasticStatuslineFlag() to evaluate is or does...
:help syntastic-statusline-flag, :help 'syntastic_stl_format'
Can I modify the height of the syntastic's message display area in the terminal's vim's window ?
:help 'syntastic_loc_list_height'

vim: change line's font color based upon first character in the line?

In vim, I'd like to change a font color for just one line depending on if said line starts (with any preceding tab/space/whitespace) a dash, period, slash, or 'x'. How can I program/configure existing vim to do this?
In Vim, a colorscheme just provides a mapping of highlighting groups (usually generic ones such as Comment, String, though particular syntaxes also define things like vimLineComment) to foreground / background colors and text attributes such as bold or italic. What you want is a custom syntax definition.
:help usr_44.txt introduces writing a syntax file; you can also look to the existing ones in $VIMRUNTIME/syntax/ for inspiration. To highlight lines starting with x:
:syntax match mysyntaxXLine /^x.*$/
:highlight link mysyntaxXLine Error

How to make vim's replacement selection blinking

In latex files I have the on-fly spelling switched so you can imagine that together with the syntax highlighting there is already a lot of colors in the terminal screen. When in such environment I am running a string replacement, say with :%s/x/y/gc I need a lot of time to identify where the string-to-be-replaced is located in all this color mess. Is it possible to make vim's current selection blink?
You change the highlighting of the to-be-replaced text with highlight IncSearch.
For example,
:highlight IncSearch ctermfg=Red guifg=Red
highlights the text with a red background (despite it being fg not bg).
However, I don't think there's any way to make it blink (and are you sure you really want that?). You might be able to use italics or underlines instead. See :h highlight for the options that are available.

How do I make vim syntax highlight a whole line?

I'd like to have vim highlight entire lines that match certain patterns. I can get all the text in a line to highlight (by doing syn match MyMatch "^.*text-to-match.*$"), but it always stops at the end of the text. I'd like to to continue to the end of the term, like highlighting CursorLine.
I've tried replacing $ with a \n^, hoping that would wrap it around. No change. (I didn't actually expect this would work, but there's no harm in trying.) I also tried adjusting the syn-pattern-offset (which I read about here: http://vimdoc.sourceforge.net/htmldoc/syntax.html#:syn-pattern). Long story short, adding he=he-5 will highlight 5 fewer characters, but he=he+5 doesn't show any extra characters because there aren't characters to highlight.
This is my first attempt at making a vim syntax and I'm relatively new to vim. Please be gentle and include explanations.
Thanks!
(edit: Forgot to include, this is a multiline highlight. That probably increases the complexity a bit.)
It's not very adaptive as the filename (buffer) and line to full row highlight needs to be explicitly identified, but apparently the sign command can be used:
It is possible to highlight an entire
line using the :sign mechanism.
An example can be found at :help
sign-commands
In a nutshell:
:sign define wholeline linehl=ErrorMsg
:sign place 1 name=wholeline line=123 file=thisfile.txt
Obviously, you should pick a higlight
group that changes the color of the
background for the linehl argument.
source: Erik Falor, vim mailing list
From the documentation on syn-pattern:
The highlighted area will never be
outside of the matched text.
I'd count myself surprised if you got this to work, but then again, Vim is always full of surprises.
could also try
:set cursorline
:set cursorcolumn
change colors like this:
:hi cursorline
:hi cursorcolumn
using the usual term=, ctermfg=, ctermbg= etc
see this answer
VIM Highlight the whole current line

Resources