blob: 82999ba112f8d4b5bf77ec39460ccea08cfab1c2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
vim9script
# Split a comma-separated option value into parts, accounting for escaped
# commas and leading whitespace as Vim itself does internally
#
export def Split(expr: string, keepempty: bool = v:true): list<string>
const parts = split(expr, '\\\@<!,[, ]*', keepempty)
return map(copy(parts), (_, val) => substitute(val, '\,', ',', 'g'))
enddef
# Escape the right-hand side of a :set option value
#
export def Escape(expr: string): string
return escape(expr, ' |"\')
enddef
|