diff --git a/runtime/pack/dist/opt/helptoc/autoload/helptoc.vim b/runtime/pack/dist/opt/helptoc/autoload/helptoc.vim index 087da798e9..c0d86a4e63 100644 --- a/runtime/pack/dist/opt/helptoc/autoload/helptoc.vim +++ b/runtime/pack/dist/opt/helptoc/autoload/helptoc.vim @@ -2,9 +2,20 @@ vim9script noclear # Config {{{1 -const SHELL_PROMPT: string = g: - ->get('helptoc', {}) - ->get('shell_prompt', '^\w\+@\w\+:\f\+\$\s') +var SHELL_PROMPT: string = '' + +def UpdateUserSettings() #{{{2 + var new_prompt: string = g: + ->get('helptoc', {}) + ->get('shell_prompt', '^\w\+@\w\+:\f\+\$\s') + if new_prompt != SHELL_PROMPT + SHELL_PROMPT = new_prompt + # invalidate cache: user config has changed + unlet! b:toc + endif +enddef + +UpdateUserSettings() # Init {{{1 @@ -141,6 +152,8 @@ export def Open() #{{{2 return endif + UpdateUserSettings() + # invalidate the cache if the buffer's contents has changed if exists('b:toc') && &filetype != 'man' if b:toc.changedtick != b:changedtick