From a01b0d7f23a31352e25d42e44ea3d55f8952cab1 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 30 Jun 2022 01:43:10 +1200 Subject: Translate autoload/option.vim to vim9script --- vim/autoload/option.vim | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/vim/autoload/option.vim b/vim/autoload/option.vim index 49fbf1a4..82999ba1 100644 --- a/vim/autoload/option.vim +++ b/vim/autoload/option.vim @@ -1,17 +1,15 @@ -" Split a comma-separated option value into parts, accounting for escaped -" commas and leading whitespace as Vim itself does internally -" -function! option#Split(expr, ...) abort - if a:0 > 1 - echoerr 'Too many arguments' - endif - let keepempty = a:0 ? a:1 : 0 - let parts = split(a:expr, '\\\@ + const parts = split(expr, '\\\@ substitute(val, '\,', ',', 'g')) +enddef + +# Escape the right-hand side of a :set option value +# +export def Escape(expr: string): string + return escape(expr, ' |"\') +enddef -- cgit v1.2.3