diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-09 15:30:47 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-09 15:30:47 +1200 |
commit | 54960d194a30514780ca9bdcab824060db03288c (patch) | |
tree | 4c84e39a9b4b84c8817b098ed5f50c347145c565 /vim | |
parent | Refactor directory creation with custom command (diff) | |
download | dotfiles-54960d194a30514780ca9bdcab824060db03288c.tar.gz dotfiles-54960d194a30514780ca9bdcab824060db03288c.zip |
Refactor 'runtimepath' split back into function
Still not sure about this part.
Diffstat (limited to 'vim')
-rw-r--r-- | vim/vimrc | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -43,11 +43,16 @@ " We don't have to deal with escaped backslashes; read the source of " copy_option_part() in vim/src/misc2.c to see why. " -let s:option_split_pattern - \ = '\\' - \ . '\@<!' - \ . ',' - \ . '[, ]*' +function! s:SplitOption(string) abort + let string = a:string + let pattern + \ = '\\' + \ . '\@<!' + \ . ',' + \ . '[, ]*' + let parts = split(string, pattern) + return parts +endfunction " With 'runtimepath' cleaned up, the next thing we'll do is set an environment " variable MYVIM for the user runtime directory, if such a variable does not @@ -66,7 +71,7 @@ let s:option_split_pattern " database files in the absence of a setting for 'spellfile'. " if !exists('$MYVIM') && &runtimepath !=# '' - let $MYVIM = split(&runtimepath, s:option_split_pattern)[0] + let $MYVIM = s:SplitOption(&runtimepath)[0] endif " We need to check the MYVIM environment variable's value to ensure it's not |