Friday, March 2, 2018

Re: Prevent the use of italic

On Fri, Mar 2, 2018 at 10:47 PM, Nikolay Aleksandrovich Pavlov
<zyx.vim@gmail.com> wrote:
> 2018-03-02 19:06 GMT+03:00 Oliver Knodel <itc.knodel@gmail.com>:
>> Am Freitag, 2. März 2018 08:37:21 UTC+1 schrieb Anton Shepelev:
>>> Hello, all
>>>
>>> I am using GVim with a font that has no italic sub-
>>> set. When I edit markdown (.md) files, however, Vim
>>> tries to render *emphasized* text as italic. How
>>> can I prevent that? Is it configured in a color
>>> file or a syntax file?
>>>
>>> --
>>> Please, do not forward replies to the list to my e-mail.
>>
>> It is set in the syntax/markdown file and links to htmlItalic:
>> markdownItalic xxx links to htmlItalic
>>
>> You can override it in ~/.vim/after/syntax/html.vim:
>> hi htmlItalic gui=NONE
>>
>> If you use vim inside terminal, substitute gui with term or cterm.
>
> There is no need to use after/ directory, and especially after/syntax
> which will be constantly reloaded. Sane syntax file authors (and
> html.vim other is one of those) define highlight groups with
> `:highlight default` which means that if highlighting group is defined
> *before* sourcing syntax file then it will not be overridden, so
> placing something like `hi link htmlItalic Normal` into the
> colorscheme (if it is maintained by the OP) or vimrc is good and will
> not create uselessly reloaded oneline files. Usage of the `:highlight
> default` in syntax files aims precisely at allowing colorschemes to
> provide defaults better suited to the user.

Anton Shepelev: this last sentence is important. Rather than linking
htmlItalic to Normal, you might prefer to define your own colorscheme,
defining htmlItalic with some specific colours rather than as italic
text.

I'm attaching my "almost-default" colorscheme, which uses Vim's
defaults for everything not explicitly mentioned. Don't use it
unchanged, but you may add and remove highlight lines until it does
what you like. There are a few lines at beginning and end (lines 1-28
and, I think, 136-end) which should not be removed (but possibly
modified if you change the colorscheme's name). Please also change
lines 2 and 3 (which hold my name and the last change date). Line 4 is
to force it to get a 'fileencoding' of Latin1 because that line would
be invalid in UTF-8. After applying your changes, drop it into
~/.vim/colors/ (on Unix-like systems) or ~/vimfiles/colors (as named
in Vim terminology on Windows), and invoke it with a :colo[rscheme]
statement (see ":help :colorscheme") in your vimrc.

This colorscheme is intentionally written to work well with the
CSApprox plugin if loaded. It predates the invention of the
+termguicolors feature, which I don't use (instead, I use the CSApprox
plugin and I don't touch 'termguicolors', which remains at its FALSE
default if defined).

It also assumes that Vimscript lines whose first nonblank is a
backslash are continuation lines, which is the 'nocompatible' (or
"Vim") default but not the 'compatible' (or "Vi") default. The User1
and User2 highlights are used in my custom text-style tabline (defined
in my vimrc, not here, and used in both "GUI" and "console" operating
modes).

Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment