1
0
mirror of https://github.com/amix/vimrc synced 2025-07-09 02:25:00 +08:00

Updated plugins

This commit is contained in:
Amir Salihefendic
2019-08-22 17:36:17 +02:00
parent 6711ae6453
commit 3aefdbd21a
244 changed files with 9486 additions and 3395 deletions

View File

@ -12,6 +12,9 @@ set cpo&vim
" The full path to the created directory is returned, it is the caller's
" responsibility to clean that up!
fun! gotest#write_file(path, contents) abort
if go#util#has_job()
call go#lsp#CleanWorkspaces()
endif
let l:dir = go#util#tempdir("vim-go-test/testrun/")
let $GOPATH .= ':' . l:dir
let l:full_path = l:dir . '/src/' . a:path
@ -19,15 +22,23 @@ fun! gotest#write_file(path, contents) abort
call mkdir(fnamemodify(l:full_path, ':h'), 'p')
call writefile(a:contents, l:full_path)
exe 'cd ' . l:dir . '/src'
if go#util#has_job()
call go#lsp#AddWorkspaceDirectory(fnamemodify(l:full_path, ':p:h'))
endif
silent exe 'e! ' . a:path
" Set cursor.
let l:lnum = 1
for l:line in a:contents
let l:m = match(l:line, "\x1f")
let l:m = stridx(l:line, "\x1f")
if l:m > -1
call setpos('.', [0, l:lnum, l:m, 0])
let l:byte = line2byte(l:lnum) + l:m
exe 'goto '. l:byte
call setline('.', substitute(getline('.'), "\x1f", '', ''))
silent noautocmd w!
break
endif
@ -42,6 +53,9 @@ endfun
" The file will be copied to a new GOPATH-compliant temporary directory and
" loaded as the current buffer.
fun! gotest#load_fixture(path) abort
if go#util#has_job()
call go#lsp#CleanWorkspaces()
endif
let l:dir = go#util#tempdir("vim-go-test/testrun/")
let $GOPATH .= ':' . l:dir
let l:full_path = l:dir . '/src/' . a:path
@ -51,6 +65,9 @@ fun! gotest#load_fixture(path) abort
silent exe 'noautocmd e ' . a:path
silent exe printf('read %s/test-fixtures/%s', g:vim_go_root, a:path)
silent noautocmd w!
if go#util#has_job()
call go#lsp#AddWorkspaceDirectory(fnamemodify(l:full_path, ':p:h'))
endif
return l:dir
endfun