vim - 如何匹配带****下划线的行

标签 vim

为了突出显示,我如何匹配用星号突出显示的行?

1. Really big title
*******************

最佳答案

在 Markdown 高亮 (https://github.com/plasticboy/vim-markdown/blob/master/syntax/mkd.vim) 中,plasticboy 是这样做的:

"HTML headings
syn region htmlH1       start="^\s*#"                   end="\($\|#\+\)" contains=@Spell
syn region htmlH2       start="^\s*##"                  end="\($\|#\+\)" contains=@Spell
syn region htmlH3       start="^\s*###"                 end="\($\|#\+\)" contains=@Spell
syn region htmlH4       start="^\s*####"                end="\($\|#\+\)" contains=@Spell
syn region htmlH5       start="^\s*#####"               end="\($\|#\+\)" contains=@Spell
syn region htmlH6       start="^\s*######"              end="\($\|#\+\)" contains=@Spell
syn match  htmlH1       /^.\+\n=\+$/ contains=@Spell  "<-- Here is the one I think you want
syn match  htmlH2       /^.\+\n-\+$/ contains=@Spell

为了完整起见,Markdown header 如下所示:

H1 header
=========

H2 header
---------

关于vim - 如何匹配带****下划线的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8453590/

相关文章:

Vim:如何在保存时保持折叠?

user-interface - VIM 中心文本到屏幕,左右边框无效

vim - 拼写错误 : Automatically insert first spellcheck sugestions and highlight them

vim - 如何在vim中查找和替换#(磅)字符的字符串?

Vim 右括号(不使用插件)在我按 Enter 或在第一个括号后不立即按 Enter 时表现不同

macos - 保存时热重载

vim - zsh 函数退出后搞砸了提示

vim - 如何在VIM的easymotion插件中向上跳转?

vim - 在 Vim 中, "alternate file"是什么?

vim - 与 vim 中 Atom 的 docblockr 类似的插件吗? (自动文档方法)