Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vimux-maven-test and key mappings for java files.
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
map <silent> <LocalLeader>ra :wa<CR> :RunAllMavenTests<CR> | ||
map <silent> <LocalLeader>rb :wa<CR> :RunCurrentMavenTests<CR> | ||
map <silent> <LocalLeader>rf :wa<CR> :RunFocusedMavenTests<CR> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Vimux plugin for running maven tests. | ||
|
||
## Requirements | ||
|
||
- [vimux](https://github.com/benmills/vimux) | ||
|
||
## Installation | ||
|
||
Use pathogen. | ||
|
||
## Commands | ||
|
||
* RunAllMavenTests - Run all tests | ||
* RunFocusedMavenTests - Run test closest to cursor | ||
* RunCurrentMavenTests - Run all tests in current file |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
if exists("g:loaded_vimux_maven_test") || &cp | ||
finish | ||
endif | ||
let g:loaded_vimux_maven_test = 1 | ||
|
||
command RunAllMavenTests :call s:RunAllMavenTests() | ||
command RunFocusedMavenTests :call s:RunFocusedMavenTests() | ||
command RunCurrentMavenTests :call s:RunCurrentMavenTests() | ||
|
||
function s:ClassName() | ||
let class_line_num = search("public class", "bn") | ||
let class_line = getline(class_line_num) | ||
let class_name = split(class_line, " ")[2] | ||
|
||
return class_name | ||
endfunction | ||
|
||
function s:CurrentTestName() | ||
let test_line_num = search("@Test", "bn") + 1 | ||
let test_line = getline(test_line_num) | ||
let test_name = substitute(split(test_line, " ")[2], "\(.*$", "", "") | ||
|
||
return test_name | ||
endfunction | ||
|
||
function s:RunAllMavenTests() | ||
call VimuxRunCommand("clear && mvn test") | ||
endfunction | ||
|
||
function s:RunCurrentMavenTests() | ||
call VimuxRunCommand("mvn -Dtest=" . s:ClassName() . " test") | ||
endfunction | ||
|
||
function s:RunFocusedMavenTests() | ||
call VimuxRunCommand("mvn -Dtest=" . s:ClassName() . "#" . s:CurrentTestName() . " test") | ||
endfunction |