-" something that won't be met anywhere
-let s:sep = "₀◎○ë"
+vim9script
-function! align#do(first, last, sep) abort
- let in = []
- for n in range(a:first, a:last)
- let in = add(in, substitute(getline(n), a:sep, "\t" . s:sep, "g"))
+const Sep = "₀◎○ë" # something that won't be met anywhere
+
+export def Do(first: number, last: number, sep: string)
+ var in: list<string>
+ for n in range(first, last)
+ in = add(in, substitute(getline(n), sep, "\t" .. Sep, "g"))
endfor
- let out = systemlist("column -t -s \"\t\"", add(in, ""))
- for n in range(a:first, a:last)
- call setline(n, substitute(out[n - a:first], " " . s:sep, escape(a:sep, "&"), "g"))
+ var out = systemlist("column -t -s \"\t\"", add(in, ""))
+ for n in range(first, last)
+ setline(n, substitute(out[n - first], " " .. Sep, escape(sep, "&"), "g"))
endfor
-endfunction
+enddef