diff options
author | Teddy Wing | 2023-03-19 04:48:40 +0100 |
---|---|---|
committer | Teddy Wing | 2023-03-19 19:52:34 +0100 |
commit | 803b9b9f3f561c78601de0439d4150a72238c3d3 (patch) | |
tree | ed90e3942cabbb7ffbabcef0e13703d670531fb9 /bundle/insert-layout/plugin | |
parent | ebf7b2e4677ac4e8cad77fc4a7efa0fc9cf39ada (diff) | |
download | dotvim-803b9b9f3f561c78601de0439d4150a72238c3d3.tar.bz2 |
insert-layout: Error when 'xkbswitch' command not available
If the 'xkbswitch' command isn't available, we shouldn't be adding any
autocmds.
Diffstat (limited to 'bundle/insert-layout/plugin')
-rw-r--r-- | bundle/insert-layout/plugin/insert_layout.vim | 7 |
1 files changed, 6 insertions, 1 deletions
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 <buffer> OnInsertEnter(layout) # autocmd insert_layout InsertLeave <buffer> OnInsertLeave() autocmd_add([ |