Add keywords completion for --cwd and --config

This commit is contained in:
Kovid Goyal
2022-08-09 16:07:04 +05:30
parent 5ad55dd165
commit ed81a60065
3 changed files with 6 additions and 1 deletions

View File

@@ -612,7 +612,7 @@ are running a program that does not set titles.
--config -c
type=list
completion=type:file ext:conf group:"Config files"
completion=type:file ext:conf group:"Config files" kwds:none,NONE
{config_help}

View File

@@ -637,6 +637,10 @@ def complete_file_path(ans: Completions, spec: Dict[str, str], prefix: str, only
def complete_path(ans: Completions, opt: OptionDict, prefix: str) -> None:
spec = opt['completion']
t = spec['type']
if 'kwds' in spec:
kwds = [x for x in spec['kwds'].split(',') if x.startswith(prefix)]
if kwds:
ans.add_match_group('Keywords', kwds)
if t == 'file':
complete_file_path(ans, spec, prefix)
elif t == 'directory':

View File

@@ -73,6 +73,7 @@ opened window.
--cwd
completion=type:directory kwds:current,oldest,last_reported
The working directory for the newly launched child. Use the special value
:code:`current` to use the working directory of the currently active window.
The special value :code:`last_reported` uses the last working directory reported