From fb7809fd3fd8182f627acf5958acc33f22d2a126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Wed, 27 Mar 2024 23:49:34 +0100 Subject: [PATCH] fix: handle windows directories --- autoload/vimtex/paths.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/autoload/vimtex/paths.vim b/autoload/vimtex/paths.vim index fe30b18ca8..2b089fa3d9 100644 --- a/autoload/vimtex/paths.vim +++ b/autoload/vimtex/paths.vim @@ -68,6 +68,14 @@ function! vimtex#paths#relative(path, current) abort " {{{1 let l:target = simplify(substitute(a:path, '\\', '/', 'g')) let l:common = simplify(substitute(a:current, '\\', '/', 'g')) + if l:common[-1:] ==# '/' + let l:common = l:common[:-2] + endif + + if has('win32') || v:true + let l:target = substitute(l:target, '^[A-Z]:', '', '') + let l:common = substitute(l:common, '^[A-Z]:', '', '') + endif " This only works on absolute paths if !vimtex#paths#is_abs(l:target)