From 31b1e63a908ed07eac6353f510f791aa179f67ae Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 14 Jun 2019 16:55:17 +1200 Subject: Refactor &runtimepath split a bit more --- vim/vimrc | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index f07f4cbe..0b52a2f9 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -87,20 +87,26 @@ scriptencoding utf-8 " string, due to the way that split() works by default without its third " parameter {keepempty} set to false. " -" Once we have the path element, we have to remove the escaping for periods, -" specifically remove up to one backslash before all periods. We don't, -" however, have to deal with escaped backslashes, or any other character; you -" can read the source code for the ad-hoc tokenizer in copy_option_part() in -" src/misc2.c in Vim's source code and test it with some values of your own if -" you want to understand why. +" Once we have the path elements, we have to remove the escaping for periods, +" specifically remove up to one backslash before all periods. We do that with +" a map() over substitute(), string-eval style to accommodate older Vim before +" Funcref variables were added. +" +" We don't, however, have to deal with escaped backslashes, or any other +" character; you can read the source code for the ad-hoc tokenizer in +" copy_option_part() in src/misc2.c in Vim's source code and test it with some +" values of your own if you want to understand why. +" +" I'll factor this out into a global function if I ever need it anywhere else. " " Vim, I love you, but you are really weird. " +let runtimepath = map( + \ split(&runtimepath, '\\\@