gerw / vim-latex-suite

71 stars 16 forks source link

Tex_CatFile() does not use readfile, overwrites unnamed register #6

Closed andymass closed 10 years ago

andymass commented 10 years ago

In vim configured without python, Tex_CatFile() checks for readfile() incorrectly and overwrites the unnamed register at each compile. The following changes fix this check.

--- a/ftplugin/latex-suite/main.vim
+++ b/ftplugin/latex-suite/main.vim
@@ -948,9 +948,12 @@
    endfunction
 endif " }}}
 " Tex_CatFile: returns the contents of a file in a <NL> seperated string {{{
-if has('*readfile')
+if exists('*readfile')
    function! Tex_CatFile(filename)
-       return join(readfile(filename), "\n")
+       if glob(a:filename) == ''
+           return ''
+       endif
+       return join(readfile(a:filename), "\n")
    endfunction
 elseif has('python') && g:Tex_UsePython
    function! Tex_CatFile(filename)
gerw commented 10 years ago

Thank you for your contribution. Should be fixed now!