Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] optional plugin to provide table of contents in help files in popup menu #10446

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
da60d94
first commit
May 19, 2022
54f4fe2
fix: P was printing wrong entry
May 19, 2022
12cac7d
include max level in title
May 22, 2022
083215b
align toplines of help window and popup menu
May 22, 2022
aae59fb
in terminal buffer, highlight TOC menu with Terminal instead of Normal
May 22, 2022
f11f1cd
same thing for help window
May 22, 2022
7fd09bc
let user manually select nearest entry from cursor
May 22, 2022
1a74bc6
only uppercase identifiers related to user config
May 23, 2022
24e525e
promote TearDown() to the script-level
May 23, 2022
af03b2b
handle possible user interrupt when calling input()
May 23, 2022
14f56c5
make cache invalidation more reliable in terminal buffer
May 24, 2022
bcfd7bc
fix: title was not always properly updated
May 24, 2022
d8037e3
simplify return; rename function; add comment
May 24, 2022
24846fc
rename variable to make it more meaningful
May 24, 2022
90168cb
simplify type check validation
May 24, 2022
03ebf6f
fix: max level was sometimes wrong in manpages
May 24, 2022
5dea300
DRYer
May 24, 2022
a346520
remove useless utility function
May 24, 2022
20d789a
support <PageUp>, <PageDown>, <Home>, <End>
May 24, 2022
7dfc49b
update documentation
May 24, 2022
05a256c
be consistent when conjugating verb into the imperative
May 24, 2022
fcb1ec8
update documentation in help window
May 24, 2022
0b39f05
soft-wrap long lines in help window in more readable way
May 24, 2022
19add9d
handle autocmds with new autocmd_*() functions
May 24, 2022
5f1b5b1
add TODO item
May 24, 2022
1792a98
DRYer
May 24, 2022
bb3b6a3
fix: detection of markdown entries was sometimes wrong
May 24, 2022
f3b0fba
fix: J and K not aware of correct entries after escaped fuzzy search
May 24, 2022
7265e4c
add tip
May 24, 2022
32e7811
shorten lines in given tip
May 24, 2022
e2fe719
fix: Title highlighting in help window was sometimes wrong
May 24, 2022
bfcf9c9
use legacy syntax for user config in documentation
May 24, 2022
be0f63a
fix: the TOC was not restored after pressing C-U during a fuzzy search
May 24, 2022
5db93dc
fix: print 0/0 instead of 1/1 in title when TOC is empty
May 24, 2022
e73d029
no need to compute last lnum twice
May 24, 2022
1567296
fix: temporary mappings not removed when interrupting fuzzy search th…
May 24, 2022
3728a1f
tear down temporary mappings earlier in case of an interruption
May 24, 2022
64b8028
if a user starts a 2nd fuzzy search, they expect the TOC to be reset
May 24, 2022
8f11147
better name function
May 24, 2022
3feb443
make sure not to install duplicate autocmds
May 24, 2022
d21edeb
fix typo
May 24, 2022
2b97677
fix: popup filter did not consume "c" keypress after handling it
May 24, 2022
115f3ae
don't try to handle pum on top of popup terminal
May 30, 2022
1ae4f7d
fix tab completion when looking for given text
Apr 30, 2023
ba7f3b9
support options in man pages
May 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 55 additions & 0 deletions runtime/doc/helphelp.txt
Expand Up @@ -246,6 +246,61 @@ command: >
To rebuild the help tags in the runtime directory
(requires write permission there): >
:helptags $VIMRUNTIME/doc
<
*help-TOC*

If you want to access an interactive table of contents, from any position in
the file, you can use the helptoc plugin. Load the plugin with: >

packadd helptoc

Then you can use the `:HelpToc` command to open a popup menu.
The latter supports the following normal commands: >

key | effect
----+---------------------------------------------------------
j | select next entry
k | select previous entry
J | same as j, and jump to corresponding line in main buffer
K | same as k, and jump to corresponding line in main buffer
c | select nearest entry from cursor position in main buffer
g | select first entry
G | select last entry
H | collapse one level
L | expand one level
p | print current entry on command-line

P | same as p but automatically, whenever selection changes
| press multiple times to toggle feature on/off

q | quit menu
z | redraw menu with current entry at center
+ | increase width of popup menu
- | decrease width of popup menu
? | show/hide a help window

<C-D> | scroll down half a page
<C-U> | scroll up half a page
<PageUp> | scroll down a whole page
<PageDown> | scroll up a whole page
<Home> | select first entry
<End> | select last entry

The plugin can also provide a table of contents in man pages, markdown files,
and terminal buffers. In the latter, the entries will be the past executed
shell commands. To find those, the following regex is used: >

^\w\+@\w\+:\f\+\$\s

This is meant to match a default bash prompt. If it doesn't match your prompt,
you can change the regex with the `shell_prompt` key from the `g:helptoc`
dictionary variable: >

let g:helptoc = {'shell_prompt': 'regex matching your shell prompt'}

Tip: After inserting a pattern to look for with the `/` command, if you press
<Esc> instead of <CR>, you can then get more context for each remaining entry
by pressing `J` or `K`.

==============================================================================
2. Translated help files *help-translated*
Expand Down