aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-12-05 23:30:42 +0100
committerTeddy Wing2017-12-05 23:30:42 +0100
commitdfdb91aa2dd792aa9074f4f15adb2ab32afb80d1 (patch)
tree0558dca65fdfb7d20a5f352d64d8e81c50cfdb91
parent73fa46a7796d5f53326c0d38f617b6cb839c2d34 (diff)
downloaddotvim-dfdb91aa2dd792aa9074f4f15adb2ab32afb80d1.tar.bz2
ftplugin/ruby.vim: Add mapping to reset the Rails test database
Occasionally I need to drop and reload the Rails test database. Recently I've been working on something that requires a "truncation"-cleaned test, and have had to reset my database regularly while writing the test to eliminate inconsistent state. This command gives me the ability to reset with a single key press. I've been testing it out for a few days in a Vim session and have found it very helpful.
-rw-r--r--ftplugin/ruby.vim4
1 files changed, 4 insertions, 0 deletions
diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim
index 2abb417..c829abe 100644
--- a/ftplugin/ruby.vim
+++ b/ftplugin/ruby.vim
@@ -18,6 +18,10 @@ nnoremap <buffer> Zd obyebug<Esc>
nnoremap <buffer> ZD Obyebug<Esc>
+" Reset Rails test database
+nnoremap <buffer> <F7> :!RAILS_ENV=test bundle exec rake db:reset<CR>
+
+
" Spring
command! -buffer FuckSpring :!bundle exec spring stop