From be12982398b4e67c02fc38a653020b1a653a4509 Mon Sep 17 00:00:00 2001 From: Yan Pritzker Date: Mon, 1 Oct 2012 17:16:15 -0700 Subject: [PATCH] Added outer ruby block functionality --- README.md | 1 + vim/plugin/settings/outerblock.vim | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 vim/plugin/settings/outerblock.vim diff --git a/README.md b/README.md index 0471c5ff..c17bda43 100644 --- a/README.md +++ b/README.md @@ -318,6 +318,7 @@ If you omit the key combo, you'll get a list of all the maps. You can do the sam #### Utility + * `,orb` - outer ruby block. takes you one level up from nested blocks (great for rspec) * `crs`, `crc`, `cru` via abolish.vim, coerce to snake_case, camelCase, and UPPERCASE. There are more `:help abolish` * `:NR` - NarrowRgn - use this on a bit of selected text to create a new split with just that text. Do some work on it, then :wq it to get the results back. * `,ig` - toggle visual indentation guides diff --git a/vim/plugin/settings/outerblock.vim b/vim/plugin/settings/outerblock.vim new file mode 100644 index 00000000..bc65559f --- /dev/null +++ b/vim/plugin/settings/outerblock.vim @@ -0,0 +1,13 @@ +" Navigate to the block surrounding this one +" For example if you're inside +" foo do +" bar do +" # you are here +" end +" end +" +" Then hitting ,orb ("outer ruby block") will take you to 'foo do' +" +" This is relying on the textobj-rubyblock which gives us 'ar' around ruby +" and matchit.vim which gives us jumping to the matching +nnoremap ,orb :normal varar%