commit ab301801b0ad65783b96f110059f19cd935bab97
parent 73527d3f14c85d8e3c15ca61afb46c286f5a9a09
Author: Patrick Stockwell <mail@deciphr.net>
Date: Sat, 9 May 2020 17:35:29 +1000
Improve path normalisation with separate substitutions
This change reverts the original regex and simply adds a second regex
which is called on the result. '/\./' is one literal forward slash, one
literal fullstop (escaped with a leading backslash), and one literal
forward slash. In plain text, `/./` will be replaced with `/`.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/autoload/vimwiki/path.vim b/autoload/vimwiki/path.vim
@@ -24,7 +24,8 @@ endif
function! vimwiki#path#normalize(path) abort
let path = a:path
while 1
- let result = substitute(path, '/[^/]\+/\.\.\|\./', '', '')
+ let intermediateResult = substitute(path, '/[^/]\+/\.\.', '', '')
+ let result = substitute(intermediateResult, '/\./', '/', '')
if result ==# path
break
endif