aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/man.vim
diff options
context:
space:
mode:
authorJoshua Cao <joshcao@amazon.com>2022-05-16 04:49:44 -0700
committerGitHub <noreply@github.com>2022-05-16 04:49:44 -0700
commit14d653b421d3ee4e0d641e45e67dafe43809e502 (patch)
treec6ead7e06a7be4bca683951e74a968fea4caeca2 /runtime/autoload/man.vim
parent7adecbcd29e17b71bf43e50a444724da184c04a7 (diff)
downloadrneovim-14d653b421d3ee4e0d641e45e67dafe43809e502.tar.gz
rneovim-14d653b421d3ee4e0d641e45e67dafe43809e502.tar.bz2
rneovim-14d653b421d3ee4e0d641e45e67dafe43809e502.zip
feat(man.vim): list command flags in "gO" outline #17558
Diffstat (limited to 'runtime/autoload/man.vim')
-rw-r--r--runtime/autoload/man.vim6
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
index 065ca8432e..b8a73a64c9 100644
--- a/runtime/autoload/man.vim
+++ b/runtime/autoload/man.vim
@@ -171,6 +171,12 @@ function! man#show_toc() abort
while lnum && lnum < last_line
let text = getline(lnum)
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})
endif
let lnum = nextnonblank(lnum + 1)