sponsor Vim development Vim logo Vim Book Ad

grails-conque : Run grails shell and unit/integration tests inside vim

 script karma  Rating 24/8, Downloaded by 2750  Comments, bugs, improvements  Vim wiki

created by
Marin Staykov
script type
This script is still in early stages and updates often - I recommend cloning the github repo and submitting issues/code there if you find problems or think of good features.

Github repo: https://github.com/hoffoo/vim-grails-console

Simple plugin that uses ConqueTerm to run tests, interact with the shell, and use the grails console inside vim. Requires ConqueTerm http://www.vim.org/scripts/script.php?script_id=2771

You can either run the entire test file or the test function under your cursor.

" Start the grails shell

" Run the current file as a Grails test

" Run the Test under the cursor

" You can also run a test by name
:GrailsRunTest TestName

" Rerun the last test
" Settings:

" NOTE: all the keymappings apply only to the _grails_ buffer so not to conflict
" with the rest of your setup

" set this to open the shell buffer across the bottom in a split
let g:GrailsShellStartSplit = 1

" remap an insert mode key to switch back to previous buffer
let g:GrailsShellReturnKey = "<C-w><C-w>"

" if this is set insert mode backspace will be remapped to <C-w> to delete
" whole word backwards
let g:GrailsShellRemapBS = 1

" command that will be passed the tests url when running :GrailsTestsBrowser
let g:GrailsTestsBrowser = "chromium --app=file://";

" You can override the path to the grails executable using:
" default is grails
let g:GrailsShellExecutable = "/opt/grails/bin/grails"

" Recommended Conque settings
let g:ConqueTerm_ReadUnfocused = 1 " run while not the selected window
let g:ConqueTerm_CloseOnEnd = 1 " quit grails when done
You can open a browser frame to show the html output of your tests:

" this is the executable that will be ran when opening the test result pages
" open in chromium/google-chrome frame with no tabs
let g:GrailsTestsBrowser = 'chromium --app=file://'
let g:GrailsTestsBrowser = 'firefox ' " NOTE: notice the space

" open with regular tab
let g:GrailsTestsBrowser = '/usr/bin/google-chrome '

" and then to open the browser with

=== Console ===
Provided you have the grails-console plugin you can run scripts directly to the grails app from vim. To do this either copy, or link the RunConsole.groovy file to the scripts directory within your grails project.

:GrailsRunConsole <filename>.groovy " send the file to groovy console

" Note that by default :GrailsReRun will only rerun tests - to enable
" rerun of console set the option

let g:GrailsReRunConsole = 1

The default behaviour is to enter insert mode after switching back to the grails buffer so Conque will update. This way it does not override the g:ConqueTerm_InsertOnEnter. You can disable this with g:GrailsShellInsertOnEnter.

- Search upwards if we are in a sub directory of a grails project
- Regex upwards to find the test function name, rather than passing it with the cursor

Resources: http://www.objectpartners.com/2012/02/28/using-vim-as-your-grails-ide-part-2/
install details
Install ConqueTerm: http://www.vim.org/scripts/script.php?script_id=2771

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
grails-conque.tgz 0.4 2013-06-13 7.0 Marin Staykov Add support for VAM
grails-conque.tgz 0.3 2013-06-04 7.0 Marin Staykov fixed startup annoyances
grails-conque.tgz 0.3 2013-06-03 7.0 Marin Staykov Grails Console Integration and minor refactoring
grails-conque.tgz 0.2 2013-06-02 7.0 Marin Staykov more sensible browser config
option to remap <BS>
option to remap key to return from the shell buffer to prev buffer
general cleanup
grails-conque.tgz 0.2 2013-06-02 7.0 Marin Staykov ReRun unit tests, Open test results in browser, option to always open in :botright split
grails-conque.tgz 0.1 2013-05-29 7.0 Marin Staykov Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.