Skip to content

Instantly share code, notes, and snippets.

@itsterry
Created October 13, 2016 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsterry/e8e7e3c950ff9b7da479016cd64918a8 to your computer and use it in GitHub Desktop.
Save itsterry/e8e7e3c950ff9b7da479016cd64918a8 to your computer and use it in GitHub Desktop.
Vim command to turn RSpec controller actions into new 'process' format
# Only works with leading spaces (not tabs) and with existing params
# So get :edit, id: 1 # will work
# But get :edit # won't
%s/\(^ *\)\(get\|post\|patch\|delete\) \(:[^,]*\), \(.*$\)/\1process \3, via: :\2, params: { \4 }/ge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment