Skip to content

Commit 2840590

Browse files
committed
Add highlight and link for :foobar (Issue #115)
1 parent 457f43c commit 2840590

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tools/makehtml.vim

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717

1818
function! MakeHtmlAll()
1919
let s:log = []
20+
21+
" syntax hilight for `:foobar`
22+
syn match helpBacktick contained "`" conceal
23+
syn match helpCommand "`[^` \t]\+`"hs=s+1,he=e-1 contains=helpBacktick
24+
syn match helpCommand "\(^\|[^a-z"[]\)\zs`[^`]\+`\ze\([^a-z\t."']\|$\)"hs=s+1,he=e-1 contains=helpBacktick
25+
hi def link helpCommand Comment
26+
2027
call MakeTagsFile()
2128
echo ""
2229
let files = split(glob('*.??[tx]'), '\n')
@@ -73,7 +80,7 @@ function! MakeHtml2(src, dst)
7380
" set dumy highlight to keep syntax identity
7481
if !exists("s:attr_save")
7582
let s:attr_save = {}
76-
for name in ["helpStar", "helpBar", "helpHyperTextEntry", "helpHyperTextJump", "helpOption", "helpExample"]
83+
for name in ["helpStar", "helpBar", "helpHyperTextEntry", "helpHyperTextJump", "helpOption", "helpExample", "helpCommand"]
7784
let s:attr_save[name] = synIDattr(synIDtrans(hlID(name)), "name")
7885
execute printf("hi %s term=bold cterm=bold gui=bold", name)
7986
endfor
@@ -83,12 +90,12 @@ function! MakeHtml2(src, dst)
8390
silent! call tohtml#Convert2HTML(1, line('$'))
8491

8592
let lang = s:GetLang(a:src)
86-
silent %s@<span class="\(helpHyperTextEntry\|helpHyperTextJump\|helpOption\)">\([^<]*\)</span>@\=s:MakeLink(lang, submatch(1), submatch(2))@ge
93+
silent %s@<span class="\(helpHyperTextEntry\|helpHyperTextJump\|helpOption\|helpCommand\)">\([^<]*\)</span>@\=s:MakeLink(lang, submatch(1), submatch(2))@ge
8794
silent %s@^<span class="Ignore">&lt;</span>\ze&nbsp;@\&nbsp;@ge
8895
silent %s@<span class="\(helpStar\|helpBar\|Ignore\)">[^<]*</span>@@ge
8996
call s:TranslateHelpExampleBlock()
9097
" remove style
91-
silent g/^\.\(helpBar\|helpStar\|helpHyperTextEntry\|helpHyperTextJump\|helpOption\)/silent delete _
98+
silent g/^\.\(helpBar\|helpStar\|helpHyperTextEntry\|helpHyperTextJump\|helpOption\|helpCommand\)/silent delete _
9299

93100
call s:Header()
94101
call s:Footer()
@@ -155,6 +162,8 @@ function! s:MakeLink(lang, hlname, tagname)
155162
let sep = "*"
156163
elseif a:hlname == "helpHyperTextJump"
157164
let sep = "|"
165+
elseif a:hlname == "helpCommand"
166+
let sep = "`"
158167
elseif a:hlname == "helpOption"
159168
let sep = ""
160169
endif

0 commit comments

Comments
 (0)