Completely disable italic text in GVim
Asked Answered
R

3

16

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.

Rabi answered 30/3, 2011 at 13:22 Comment(4)
I'd recommend using a better font. "Consolas" and "Andale Mono" are both fixed-width, and is readable in italic.Mullock
I'm using Fixedsys Excelsior for years and I'd prefer to not switch.Rabi
Not sure about GVim but in regular vim you can say ":se syntax=none"Lungi
Why would I want to disable all syntax highlighting?! I just don't want italics!Rabi
H
7

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.

Hypochondriac answered 30/3, 2011 at 14:2 Comment(4)
Unfortunately it's done in the syntax file: hi def rstEmphasis term=italic cterm=italic gui=italic. Is there a way to override it without actually modifying the file?Rabi
@ThiefMaster: you can create your own ~/.vim/after/syntax/rst.vim and modify/replace the rule there.Hypochondriac
Is there a way to inherit from the original one and simply overwrite the problematic rule?Rabi
You're not overriding the entire file. You can specify just that one rule in ~/.vim/after/syntax/rst.vim. The files in the after directory are just sourced after the system-wide files, so your rules in that file apply on top of what's already been defined.Hypochondriac
F
16

When using the highly recommended Solarized theme, you can configure this using:

let g:solarized_italic=0
Fasciation answered 6/6, 2011 at 7:56 Comment(1)
Incidentally you have to add this to your ~/.vimrc to get MacVim to pick it up. In case you're using MacVim.Obstruction
H
7

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.

Hypochondriac answered 30/3, 2011 at 14:2 Comment(4)
Unfortunately it's done in the syntax file: hi def rstEmphasis term=italic cterm=italic gui=italic. Is there a way to override it without actually modifying the file?Rabi
@ThiefMaster: you can create your own ~/.vim/after/syntax/rst.vim and modify/replace the rule there.Hypochondriac
Is there a way to inherit from the original one and simply overwrite the problematic rule?Rabi
You're not overriding the entire file. You can specify just that one rule in ~/.vim/after/syntax/rst.vim. The files in the after directory are just sourced after the system-wide files, so your rules in that file apply on top of what's already been defined.Hypochondriac
S
3

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)
Studbook answered 21/4, 2020 at 17:47 Comment(1)
Heyo, nice to see a dracula user!Ottavia

© 2022 - 2024 — McMap. All rights reserved.