vim-pandoc-syntax italic text is displayed with white background - vim

I'm using the vim-pandoc-snytax plugin to syntax-highlight pandoc-flavoured markdown. If I mark text as italic like this *italic*, it is displayed with a white background:
All the rest of the syntax highlighting works fine, just this white background of italic text is very disturbing.
I'm using Vim 8.0 installed from Homebrew on Mac 10.11.1. I observe the same behaviour in Terminal.app and iTerm. Currently, I use the built-in slate colour scheme, but this white background appears in any colour scheme I use.
Moreover, this white background appears whenever I set the filetype to one of :setf markdown, :setf markdown.pandoc, and :setf pandoc. That is, this white background appears also without the vim-pandoc-syntax plugin, if I just activate the built-in markdown syntax highlighting.
How can this white background of italic text be removed?

Apparently, the problem was that vim tried to format the text enclosed in * as italic, but the terminal, in which vim was running, didn't support italic text.
The Mac Terminal app doesn't support italic text at all. In iTerm, italic text can be enabled in Preferences > Profiles > Text.
After enabling italic text in iTerm, the white background didn't appear anymore, and instead the text was correctly displayed in italics.

Related

vim colorschemes not displaying properly

I'm running vim in the default Mac terminal and I'm trying to change the color scheme to one of the included color schemes, but none of them seem to be displaying properly.
For example, if I type :colorscheme blue, the colors change but there is a white border around the background.
Additionally, if I type :colorscheme desert, which is the color scheme I want to use, the syntax highlighting changes, but the background color does not.
Note that the desert color scheme is ostensibly supposed to look like this:
Why are these color schemes not displaying properly, and is there a way to fix them? Thanks!
vim's set background={light|dark} is not designed to change your background color, it is designed to work with your existing background color and give you colors that show up on that background.
Some colorschemes have multiple options to try and reproduce what the designers wanted in a variety of settings. For example, the colorscheme I am using has a base section with all the color settings followed by a 256 color specific section:
....
hi LineNr guifg=#465457 guibg=#232526
if &t_Co > 255
hi Normal ctermfg=252 " ctermbg=232
hi CursorLine ctermbg=234 cterm=none
...
which sets all the colors based on having a 256 color terminal, so that way people with 256 color terminals can still get close to what the colorscheme author intended, since a 256 color terminal cannot draw RRGGBB colors.
Likewise, colorschemes can respect background and change the colors they are using to be visible on that background color (so dark terminals don't have comments as dark blue, for example).
Lastly, vim only attempts to draw the background where it can draw characters, i.e., only the printable area of the screen. If your terminal width is, for instance, between 64 and 65 COLUMNS wide, then vim can only draw 64 characters, and there will be some space around the edges where vim doesn't try to draw, leaving the terminal's default background.
On Mac's Terminal.app, the easiest way to change your background color is to go to Preferences -> Profiles and either choose a default theme or edit the Background "Colors & Effects" section to be what you want.

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.

Vim syntax highlighting in terminal only affects the text background and not the text colour

I have just started using Vim in a terminal (PuTTY or MinTTY), after always using gVim. However, when using syntax highlighting, rather than the actual text colour changing appropriately, its background is changed to whatever colour -- and it looks horrible!
I've set my terminal to use 256 colours and downloaded a 256 colour colour scheme. I checked that the ctermfg and ctermbg settings are as I expect, but I still get this problem... Is this a Vim or a terminal configuration issue?
Many color schemes have features that are only supported in gvim/macvim. Some color schemes such as solarized, can be configured to support 256 color terminals using a setting such as let g:solarized_termcolors=256. For other color schemes, look at plugins like this one: http://www.vim.org/scripts/script.php?script_id=1809 and this one: http://www.vim.org/scripts/script.php?script_id=2390

How do I make a vim color scheme work with gvim?

I am trying to use this color scheme
https://github.com/goatslacker/mango.vim
It works when I open vim from the command line. But I usually open files from the file manager GUI and that opens them in gvim. The color scheme displays a white background in gvim. How do I fix it so it displays a dark background?
I've looked at the mango.vim file and it has the line set background=dark but apparently that is not working.
Vim separates between term, cterm (color terminal) and gui since they are capable of handling different numbers of colors
mango.vim only gives highlighting instructions for cterm. If it were for gui aswell it would look like this:
hi Comment term=bold ctermfg=Red guifg=Red0
So if your color-scheme lacks gui support it will reset to default.

Completely disable italic text in GVim

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)

Resources