From 803b9b9f3f561c78601de0439d4150a72238c3d3 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 19 Mar 2023 04:48:40 +0100 Subject: insert-layout: Error when 'xkbswitch' command not available If the 'xkbswitch' command isn't available, we shouldn't be adding any autocmds. --- bundle/insert-layout/plugin/insert_layout.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'bundle/insert-layout/plugin') diff --git a/bundle/insert-layout/plugin/insert_layout.vim b/bundle/insert-layout/plugin/insert_layout.vim index f5b93d3..9213dec 100644 --- a/bundle/insert-layout/plugin/insert_layout.vim +++ b/bundle/insert-layout/plugin/insert_layout.vim @@ -14,7 +14,7 @@ const layout_names = { var normal_layout: string -def IsLayoutSwitcherAvailable(): bool +def IsLayoutSwitcherAvailable(): number return executable('xkbswitch') enddef @@ -55,6 +55,11 @@ def InsertLayoutOff(): void enddef def InsertLayoutOn(layout: string): void + if !IsLayoutSwitcherAvailable() + echoerr "'xkbswitch' command not found" + return + endif + # autocmd insert_layout InsertEnter OnInsertEnter(layout) # autocmd insert_layout InsertLeave OnInsertLeave() autocmd_add([ -- cgit v1.2.3