Completely disable italic text in GVim - vim

In GVim I'm using a fixedsys-like font which looks good, but with italic text it breaks (chars partially unreadable, especially the last italic one if the next one is regular).
For this reason (and because I dislike italic text anyway) I'd like to completely disable italic text in Vim; without modifying any syntax highlighting related files.

When using the highly recommended Solarized theme, you can configure this using:
let g:solarized_italic=0

Whether syntax highlighting uses italic text or not is defined by your colorscheme. Any colorscheme rule can define term, cterm, and/or gui attribute lists, which are described at :help attr-list. You can either clear the relevant colorscheme rules or remove the italic attribute from them.
For example, if the following rule is in your colorscheme
hi IncSearch gui=italic guifg=#303030 guibg=#cd8b60
you would want to simply remove the gui=italic bit. You can also specify not to use any of the attributes from attr-list by setting gui=NONE.

When using the highly recommeded Dracula theme, you can configure this by adding the following to your ~/.vimrc:
let g:dracula_italic = 0
From dracula's documentation
Having issues with font styles (italic, bold, underline)?
Be sure your terminal supports these styles.
If running tmux, see tmux section.
If all else fails, disable the style by setting let g:dracula_<style-name> = 0 in your vimrc, where <style-name> is one of (italic, bold, underline, undercurl,
inverse)

Related

How to use bolt/italic fonts in a Vim colorscheme?

I've been making a custom colorscheme for myself, but I can't seem to figure out how to apply bold/italic font to my code syntax.
I've got a series of lines like let s:keyword=#0197F4 to define colors to variables, then more lines below like exe 'hi Keyword guifg='s:keyword' gui=bold' to assign colors and text decoration. This is from a template I found, not my original code. I've got set termguicolors in my .vimrc as well.
However, the gui=bold part doesn't actually seem to do anything. I'm using Vim in the terminal (iTerm2) and I know it's capable of bold text, because when I load up my .vimrc, I can see that it does work. For example, the phrase g:python_highlight_all is bold.
I'm using python code snippets to test my highlighting, if that matters.
gui, guibg, and guifg are attributes specific to GUI Vim,
cterm, ctermbg, and ctermfg are attributes specific to color terminals.
You say:
the gui=bold part doesn't actually seem to do anything
and then:
I'm using Vim in the terminal
Since you are running Vim in a terminal emulator, the right attribute is rather obviously cterm, not gui.

vim cursorline not working properly

I have the following in my .vimrc:
hi CursorLine ctermfg=00 ctermbg=00 cterm=bold
I should be unable to read the line the cursor is on, but I am able, because the text appears in grey. If I remove cterm=bold, I get true black, so it seems to be black or bold, but not both. Is "bold" a variable for a color in the theme (solarized light)? Or is my terminal theme overriding the fg color somehow? I get the exact same results in various terminal apps (on Xubuntu).
By typing :help attr-list you will get a whole list of possible values for cterm argument:
bold underline undercurl
inverse italic standout
term={attr-list} attr-list highlight-term E418
attr-list is a comma separated list (without spaces) of the
following items (in any order):
bold
underline
undercurl not always available
reverse
inverse same as reverse
italic
standout
NONE no attributes used (used to reset it)
These terms are not colors but they are considered as typographical emphasis. They add more font and shape to the text.
First, highlighting of the cursorline is disabled by default so there's no reason whatsoever to hack your colorscheme if you don't want it: just don't enable it. For the record, that feature is enabled with :set cursorline and disabled with :set nocursorline.
See :help 'cusorline'.
Second, the "bold" keyword is passed more or less directly to your terminal emulator which is ultimately in charge of deciding what to do with it. It may display "bold" text with a bolded font or use a brighter or color or… whatever. Use "bold" only if you know how your terminal emulator will react to it.
Third, Solarized is an over-engineered and very poorly written colorscheme that's a lot harder to hack than necessary. It's really a bad platform for experiments and customization.

How to change the color of Vim's (straight) underline?

I've tried everything changing the color of this:
call s:h("Underlined", {"fg": s:norm, "gui": "underline", "cterm": "underline"})
As well as all the colors of the link texts.
Does anybody know how to change it?
Here's a picture:
For anyone finding that in 2021, you can use guisp=red in neovim at least.
For example I use
:hi CocErrorHighlight gui=undercurl guisp=red
to have red curly lines.
I am using NeoVim in the Xfce-Terminal.
For a long time, you couldn't; the underline color always equaled the text color. AFAICT, in terminals this wasn't supported, and for consistency, Vim also didn't offer this in GVIM.
With Vim 8.2.0863, the ctermul attribute allows setting a separate color for underline / undercurl now. Apparently, this still isn't supported in GVIM, though (which I find odd, because Vim usually values consistency in features over fancy stuff (as explained by :help design-not)).
In GVIM, you could switch to the (GUI-only) undercurl attribute (mostly used for spell checking), which supports a separate "special color", set via guisp={color-name}; see :help highlight-guisp.
You can colorize underline only with ctermul(independent with ctermfg).
See this commit enabling that.

How to make comments Italic in gVim?

I am fairly new to Vim and mainly use gVim for most of my coding purposes. I am trying to figure out what to add in my _vimrc (in windows) to make my comments italic.
I tried adding
highlight Comment cterm=italic
but that didn't work. My modifications so far in my vimrc (if it matters) is:
color slate
set number
set nowrap
set guioptions+=b
if has('gui_running')
set guifont=Consolas:h10
endif
So what can I do so that my comments appear in italics (consolas, italic, size 10)?
The cterm definition is only for high color terminals; for the GUI, you need to use the gui= argument:
highlight Comment cterm=italic gui=italic
Also, put this after the :colorscheme command in your ~/.vimrc, or else it might get overridden.

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.

Resources