Skip to content

Instantly share code, notes, and snippets.

@mattn
Created February 17, 2012 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/1851782 to your computer and use it in GitHub Desktop.
Save mattn/1851782 to your computer and use it in GitHub Desktop.
diff --git a/autoload/quickrun.vim b/autoload/quickrun.vim
index 288cab6..1061470 100644
--- a/autoload/quickrun.vim
+++ b/autoload/quickrun.vim
@@ -142,9 +142,11 @@ let g:quickrun#default_config = {
\ },
\ 'go': {
\ 'type':
+\ executable('8g') || executable('6g') || executable('5g') ?
\ $GOARCH ==# '386' ? (s:is_win ? 'go/386/win' : 'go/386'):
\ $GOARCH ==# 'amd64' ? 'go/amd64':
-\ $GOARCH ==# 'arm' ? 'go/arm': '',
+\ $GOARCH ==# 'arm' ? 'go/arm': '' :
+\ executable('go') ? (s:is_win ? 'go/go/win' : 'go/go'): '',
\ },
\ 'go/386': {
\ 'exec': ['8g %o -o %s:p:r.8 %s', '8l -o %s:p:r %s:p:r.8',
@@ -170,6 +172,16 @@ let g:quickrun#default_config = {
\ 'tempfile': '%{tempname()}.go',
\ 'output_encode': 'utf-8',
\ },
+\ 'go/go': {
+\ 'exec': ['go build %s', '%s:p:r %a', 'rm -f %s:p:r'],
+\ 'tempfile': '%{tempname()}.go',
+\ 'output_encode': 'utf-8',
+\ },
+\ 'go/go/win': {
+\ 'exec': ['(cd %s:p:h ^\& go build %s:p:t)', '%s:p:r.exe %a', 'del /F %s:p:r.exe'],
+\ 'tempfile': '%{tempname()}.go',
+\ 'output_encode': 'utf-8',
+\ },
\ 'groovy': {
\ 'cmdopt': '-c %{&fenc==#""?&enc:&fenc}'
\ },
diff --git a/autoload/quickrun/runner/system.vim b/autoload/quickrun/runner/system.vim
index 64dc1a5..0db0c4c 100644
--- a/autoload/quickrun/runner/system.vim
+++ b/autoload/quickrun/runner/system.vim
@@ -35,7 +35,9 @@ function! s:execute(cmd, input)
try
if is_cmd_exe
let sxq = &shellxquote
- let &shellxquote = '"'
+ if a:cmd !~ '^(.*)$'
+ let &shellxquote = '"'
+ endif
endif
let cmd = a:cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment