From b26b4c48f6bface96ef0d365d6ed7e89f2ef199c Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 18 Mar 2023 17:26:49 +0100 Subject: insert-layout: Add completion to `InsertLayout` command This allows us to complete the command's keyboard layout identifier making it easier to select one. --- bundle/insert-layout/plugin/insert_layout.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bundle') diff --git a/bundle/insert-layout/plugin/insert_layout.vim b/bundle/insert-layout/plugin/insert_layout.vim index 5ca3d7b..2600da1 100644 --- a/bundle/insert-layout/plugin/insert_layout.vim +++ b/bundle/insert-layout/plugin/insert_layout.vim @@ -77,8 +77,11 @@ def InsertLayoutOn(layout: string): void ]) enddef -# TODO: Add layout completion -command! -nargs=1 InsertLayout InsertLayoutOn() +def Complete(arg_lead: string, cmd_line: string, cursor_pos: number): string + return join(keys(layout_names), "\n") +enddef + +command! -nargs=1 -complete=custom,Complete InsertLayout InsertLayoutOn() command! InsertLayoutOff InsertLayoutOff() # SetInputLayout(layout_names['fr']) -- cgit v1.2.3