Make gnim markdown highlight ignore internal markers

I recently upgraded to gvim 7.3 and was happy to find the highlight. I also noticed that he treats the "inner" _ (underscore) as a marker. For example:

I want gvim to display emphasis here

but not_here

gvim actually displays the last line in my example as 'but not_here'. It seems that interpreting SO labels is closer to what I want.

I am not saying that gvim is "wrong" because I do not know what the correct markdown implementation is. However, is there a way to tweak it so that bullets are considered normal text if they are surrounded by non-spaces?

+7
source share
4 answers

Runtime files (especially if you are using the old Vim 7.3.000 / 046 installer found on vim.org) are often not updated. Most plugin authors publish more recent releases elsewhere, and only occasionally does Vim pick them up.

In the Tim Pope repository you will find a newer version (which you can install in the ~/.vim ) that does not show the problem; instead, it even emphasizes a single underscore as an error.

+7
source

I found a solution that works in the things that I tested.

Copy the file %vim%/syntax/markdown.vim to %/.vim/syntax/markdown.vim and change line 63 to:

 syn region markdownItalic start="\s_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart 

Restart vim and it should match *this* and _this_ , but not_this .

EDIT: Changed info thanks to @ZyX

+4
source

I had these problems when documenting code in markup files.

The solution I used was to place the violation sections in a code block with four spaces or in a code sample with surrounding reverse ticks (`).

+2
source

Try using the fading taste of Github: https://github.com/jtratner/vim-flavored-markdown

+1
source

All Articles