From b9cc11536a4e726c58c4776e9bcecff26fc454cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Mon, 23 Sep 2024 23:07:42 +0200 Subject: [PATCH] fix: handle too long file names refer: #3001 --- autoload/vimtex/cache.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/autoload/vimtex/cache.vim b/autoload/vimtex/cache.vim index c2e1249eea..e6eb0bc253 100644 --- a/autoload/vimtex/cache.vim +++ b/autoload/vimtex/cache.vim @@ -320,6 +320,14 @@ function! s:local_name(name) abort " {{{1 let l:filename = substitute(l:filename, '\/', '%', 'g') let l:filename = substitute(l:filename, '\\', '%', 'g') let l:filename = substitute(l:filename, ':', '%', 'g') + + " We can't save cache files with too long names. This is not a rigorous fix, + " but I think it should handle most relevant cases well enough. + " See: https://github.com/lervag/vimtex/issues/3001 + if strlen(l:filename) > 200 + let l:filename = '%...' .. strpart(l:filename, strlen(l:filename) - 200) + endif + return a:name . l:filename endfunction