donRaphaco / neotex

latex live preview - plugin for neovim and vim 8
MIT License
177 stars 8 forks source link

NeoTex on windows chokes on temporary file path #2

Open indridieinarsson opened 7 years ago

indridieinarsson commented 7 years ago

NeoTex doesn't work in neovim on windows (running a build from late march 2017). Turns out, that the file path of the temporary file ( tempname() ) is not affected by set shellslash which should make paths use a forward slash instead of the windows backslash. A pathname such as C:\ble\rex.tex causes errors, while C:/ble/rex.tex is ok.

using expand(tempname()) seems to be a solution, the following patch fixes this

---
 ftplugin/tex.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ftplugin/tex.vim b/ftplugin/tex.vim
index 4172163..d1d9bcb 100644
--- a/ftplugin/tex.vim
+++ b/ftplugin/tex.vim
@@ -3,9 +3,9 @@ if !get(g:, 'neotex_enabled', 1)
 endif

 if !exists('s:neotex_loaded')
-       let s:neotex_buffer_tempname = tempname()
+       let s:neotex_buffer_tempname = expand(tempname())
        if get(g:, 'neotex_latexdiff', 0)
-               let s:neotex_preview_tempname = tempname()
+               let s:neotex_preview_tempname = expand(tempname())
        else
                let s:neotex_preview_tempname = s:neotex_buffer_tempname
        endif
--