Created
August 18, 2013 03:33
-
-
Save sent-hil/6259773 to your computer and use it in GitHub Desktop.
Run go test under cursor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function RunGoTestUnderLine() | |
let line_text = getline(".") | |
let raw_test_name = matchstr(getline("."), "Test.*\(") | |
if raw_test_name != -1 | |
let test_name = substitute(raw_test_name, "\(", "", "") | |
exec '!go test -run ' . test_name | |
endif | |
endfunction | |
autocmd FileType go nnoremap <leader>s :call RunGoTestUnderLine()<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment