mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
feat(man.vim): list command flags in "gO" outline #17558
This commit is contained in:
parent
7adecbcd29
commit
14d653b421
@ -171,6 +171,12 @@ function! man#show_toc() abort
|
|||||||
while lnum && lnum < last_line
|
while lnum && lnum < last_line
|
||||||
let text = getline(lnum)
|
let text = getline(lnum)
|
||||||
if text =~# '^\%( \{3\}\)\=\S.*$'
|
if text =~# '^\%( \{3\}\)\=\S.*$'
|
||||||
|
" if text is a section title
|
||||||
|
call add(toc, {'bufnr': bufnr('%'), 'lnum': lnum, 'text': text})
|
||||||
|
elseif text =~# '^\s\+\%(+\|-\)\S\+'
|
||||||
|
" if text is a flag title. we strip whitespaces and prepend two
|
||||||
|
" spaces to have a consistent format in the loclist.
|
||||||
|
let text = ' ' .. substitute(text, '^\s*\(.\{-}\)\s*$', '\1', '')
|
||||||
call add(toc, {'bufnr': bufnr('%'), 'lnum': lnum, 'text': text})
|
call add(toc, {'bufnr': bufnr('%'), 'lnum': lnum, 'text': text})
|
||||||
endif
|
endif
|
||||||
let lnum = nextnonblank(lnum + 1)
|
let lnum = nextnonblank(lnum + 1)
|
||||||
|
@ -10,7 +10,7 @@ syntax match manReference display '[^()[:space:]]\+(\%([0-9][a-z]*\|[nlpox]
|
|||||||
syntax match manSectionHeading display '^\S.*$'
|
syntax match manSectionHeading display '^\S.*$'
|
||||||
syntax match manHeader display '^\%1l.*$'
|
syntax match manHeader display '^\%1l.*$'
|
||||||
syntax match manSubHeading display '^ \{3\}\S.*$'
|
syntax match manSubHeading display '^ \{3\}\S.*$'
|
||||||
syntax match manOptionDesc display '^\s\+\%(+\|-\)\S\+'
|
syntax match manOptionDesc display '^\s\+\(\%(+\|-\)\S\+,\s\+\)*\%(+\|-\)\S\+'
|
||||||
|
|
||||||
highlight default link manHeader Title
|
highlight default link manHeader Title
|
||||||
highlight default link manSectionHeading Statement
|
highlight default link manSectionHeading Statement
|
||||||
|
Loading…
Reference in New Issue
Block a user