Use proper memfiles (max one per buffer)
Fix #39 Use tempname when creating temporary files
This commit is contained in:
parent
17b22b6fc3
commit
0c4c82e70e
2 changed files with 21 additions and 16 deletions
|
|
@ -54,11 +54,14 @@ endfunction
|
||||||
|
|
||||||
|
|
||||||
function! util#MemFilePath(file)
|
function! util#MemFilePath(file)
|
||||||
return "/tmp/nvimnvimtemp" . substitute(a:file, "\/", "_-_", "g")
|
if !exists("b:nvim_tmpfile")
|
||||||
|
let b:nvim_tmpfile = tempname()
|
||||||
|
endif
|
||||||
|
return b:nvim_tmpfile
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
"" Writes current buffer into a memfile
|
" Writes current buffer into a memfile
|
||||||
function! util#WriteMemfile()
|
function! util#WriteMemfile()
|
||||||
let memfile = util#MemFilePath(expand("%:p"))
|
let memfile = util#MemFilePath(expand("%:p"))
|
||||||
call writefile(getline(1, '$'), memfile)
|
call writefile(getline(1, '$'), memfile)
|
||||||
|
|
@ -108,18 +111,18 @@ function! util#ParseV1(line)
|
||||||
let res = split(a:line, " ")
|
let res = split(a:line, " ")
|
||||||
let path = split(res[2], "\\.")
|
let path = split(res[2], "\\.")
|
||||||
let result = {
|
let result = {
|
||||||
\ "ctype": res[0],
|
\ "ctype": res[0],
|
||||||
\ "kind": res[1],
|
\ "kind": res[1],
|
||||||
\ "symbol": res[2],
|
\ "symbol": res[2],
|
||||||
\ "name": res[3],
|
\ "name": res[3],
|
||||||
\ "file": res[4],
|
\ "file": res[4],
|
||||||
\ "line": res[5],
|
\ "line": res[5],
|
||||||
\ "col": res[6],
|
\ "col": res[6],
|
||||||
\ "doc": res[7],
|
\ "doc": res[7],
|
||||||
\ "module": s:GetModule(path),
|
\ "module": s:GetModule(path),
|
||||||
\ "location": join(path[0:-2], "."),
|
\ "location": join(path[0:-2], "."),
|
||||||
\ "lname": path[-1],
|
\ "lname": path[-1],
|
||||||
\ "kindstr": s:idtypes[res[1]][1],
|
\ "kindstr": s:idtypes[res[1]][1],
|
||||||
\ "kindshort": s:idtypes[res[1]][0],
|
\ "kindshort": s:idtypes[res[1]][0],
|
||||||
\ }
|
\ }
|
||||||
return result
|
return result
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,10 @@ if !exists("g:nvim_nim_highlight_builtin")
|
||||||
let g:nvim_nim_highlight_builtin = 1
|
let g:nvim_nim_highlight_builtin = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" let g:nvim_nim_highlighter_semantics = ["skConst", "skForVar", "skGlobalVar", "skGlobalLet", "skLet", "skModule", "skParam", "skTemp", "skVar"]
|
if !exists("g:nvim_nim_highlighter_semantics")
|
||||||
let g:nvim_nim_highlighter_semantics = []
|
" let g:nvim_nim_highlighter_semantics = ["skConst", "skForVar", "skGlobalVar", "skGlobalLet", "skLet", "skModule", "skParam", "skTemp", "skVar"]
|
||||||
|
let g:nvim_nim_highlighter_semantics = []
|
||||||
|
endif
|
||||||
|
|
||||||
call highlighter#select_highlights(["skProc", "skTemplate", "skType", "skMacro", "skMethod", "skField", "skForVar", "skIterator"])
|
call highlighter#select_highlights(["skProc", "skTemplate", "skType", "skMacro", "skMethod", "skField", "skForVar", "skIterator"])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue