diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2022-06-30 01:53:44 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2022-07-10 22:08:50 +1200 |
commit | b4be8fa9b4baf367d34fe0816c1ce05878ec1aca (patch) | |
tree | 00866349f82c617eb9e4cfa78589a4ef7d1eee68 | |
parent | Translate autoload/option.vim to vim9script (diff) | |
download | dotfiles-b4be8fa9b4baf367d34fe0816c1ce05878ec1aca.tar.gz dotfiles-b4be8fa9b4baf367d34fe0816c1ce05878ec1aca.zip |
Translate autoload/option/item.vim to vim9script
-rw-r--r-- | vim/autoload/option/item.vim | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/vim/autoload/option/item.vim b/vim/autoload/option/item.vim index ee92101f..bccb351a 100644 --- a/vim/autoload/option/item.vim +++ b/vim/autoload/option/item.vim @@ -1,14 +1,11 @@ -" Escape a single item for a comma-separated list, optionally escaping any -" filename wildcards -" -function! option#item#Escape(item, ...) abort - if a:0 > 1 - echoerr 'Too many arguments' - endif - let item = a:item - let wild = a:0 ? a:1 : 0 - if wild - let item = escape(item, '\*?[{`''$~') - endif - return escape(item, ',') -endfunction +vim9script + +# Escape a single item for a comma-separated list, optionally escaping any +# filename wildcards +# +export def Escape(item: string, wild: bool = v:false): string + return escape( + wild ? escape(item, '\*?[{`''$~') : item, + ',' + ) +enddef |