Skip to content

Commit

Permalink
Adds Fish compatibility.
Browse files Browse the repository at this point in the history
This entails using '; and' instead of '&&' to chain shell commands. This
also adds a caching variable catching the separator.
  • Loading branch information
haarts committed Mar 21, 2014
1 parent 3d2e09f commit 6eb485d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions plugin/vimux-golang.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ command! GolangTestCurrentPackage :call GolangTestCurrentPackage()
command! GolangTestFocused :call GolangTestFocused()
command! GolangRun :call GolangRun()

function! ShellCommandSeperator()
if empty(matchstr($SHELL, 'fish'))
return '&&'
else
return '; and'
endif
endfunction

let s:separator = ShellCommandSeperator()

function! GolangUsingExamples()
let examples_import_line_number = search("github.com\/lionelbarrow\/examples", "bs")
if examples_import_line_number
Expand All @@ -20,11 +30,11 @@ function! GolangCwd()
endfunction

function! GolangTestCurrentPackage()
call VimuxRunCommand("cd " . GolangCwd() . " && clear && go test -v " . GolangCurrentPackage())
call VimuxRunCommand("cd " . GolangCwd() . " " . s:separator . " clear " . s:separator . " go test -v " . GolangCurrentPackage())
endfunction

function! GolangRun()
call VimuxRunCommand("cd " . GolangCwd() . " && clear && go run " . expand('%:t'))
call VimuxRunCommand("cd " . GolangCwd() . " " . s:separator . " clear " . s:separator . " go run " . expand('%:t'))
endfunction

function! GolangTestFocused()
Expand All @@ -36,7 +46,7 @@ function! GolangTestFocused()
let test_name_raw = split(line, " ")[1]
let test_name = split(test_name_raw, "(")[0]

call VimuxRunCommand("cd " . GolangCwd() . " && clear && go test " . GolangFocusedCommand(test_name) . " -v " . GolangCurrentPackage())
call VimuxRunCommand("cd " . GolangCwd() . " " . s:separator . " clear " . s:separator . " go test " . GolangFocusedCommand(test_name) . " -v " . GolangCurrentPackage())
else
echo "No test found"
endif
Expand Down

0 comments on commit 6eb485d

Please sign in to comment.