From 038797c6da26bd067a280e62215bb652b0e21e7c Mon Sep 17 00:00:00 2001 From: baabelfish Date: Sun, 7 Feb 2016 19:01:10 +0200 Subject: [PATCH] Fix the rest of tempfiles --- autoload/highlighter.vim | 6 +++--- autoload/suggest.vim | 10 ++-------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/autoload/highlighter.vim b/autoload/highlighter.vim index aefa73d..8fa32d1 100644 --- a/autoload/highlighter.vim +++ b/autoload/highlighter.vim @@ -102,9 +102,9 @@ function highlighter#New() let result.lines = [] let result.job = jobstart([g:nvim_nim_exec_nimsuggest, '--v2', '--stdin', expand("%:p")], result) let result.file = expand("%:p") - let tempfile = result.file . ".temp" - call writefile(getline(1, '$'), tempfile) - call jobsend(result.job, "highlight " . result.file . ";" . tempfile . ":1:1\nquit\n") + let result.tempfile = util#WriteMemfile() + + call jobsend(result.job, "highlight " . result.file . ";" . result.tempfile . ":1:1\nquit\n") if !exists("b:highlights") let b:highlights = [] endif diff --git a/autoload/suggest.vim b/autoload/suggest.vim index cff0d1f..79f7193 100644 --- a/autoload/suggest.vim +++ b/autoload/suggest.vim @@ -53,18 +53,12 @@ function! suggest#NewKnown(command, sync, useV2, file, line, col, handler) let result = copy(s:NimSuggest) let result.lines = [] let result.file = a:file - let result.tempfile = result.file . ".temp" let result.line = a:line let result.col = a:col let result.handler = a:handler let result.isAsync = has("nvim") && !a:sync && g:nvim_nim_enable_async - - " if a:useTempFile - " call writefile(getline(1, '$'), result.tempfile) - " endif - " let nimcom = completion . " " . file . (a:useTempFile ? (";" . result.tempfile) : "") . ":" . line . ":" . col - - let query = a:command . " " . result.file . ":" . result.line . ":" . result.col + let result.tempfile = util#WriteMemfile() + let query = a:command . " " . result.file . ";" . result.tempfile . ":" . result.line . ":" . result.col if !result.isAsync let jobcmdstr = g:nvim_nim_exec_nimsuggest . " " . (a:useV2 ? '--v2' : '') . " " . '--stdin' . " " . result.file