More clean-ups

Better Cross-platform stuff

https://vimways.org/2018/from-vimrc-to-vim/
This commit is contained in:
2020-08-08 13:50:22 -07:00
parent 5a42a0c8e1
commit e12d093365
10 changed files with 140 additions and 126 deletions

19
autoload/option.vim Normal file
View File

@@ -0,0 +1,19 @@
" From https://sanctum.geek.nz/cgit/dotfiles.git/tree/vim/autoload/option.vim
" 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, '\\\@<!,[, ]*', keepempty)
return map(copy(parts), 'substitute(v:val, ''\\,'', '','', ''g'')')
endfunction
" Escape the right-hand side of a :set option value
"
function! option#Escape(expr) abort
return escape(a:expr, ' |"\')
endfunction