nelstrom / vim-textobj-rubyblock

A custom text object for selecting ruby blocks.
http://www.vim.org/scripts/script.php?script_id=3382
331 stars 21 forks source link

textobj-rubyblock-a selects only the first line #3

Closed meqif closed 13 years ago

meqif commented 13 years ago

I installed both textobj-user and textobj-rubyblock (HEAD == 6739e4a05eec872cae7a7764b0ebd18115a41aef) via pathogen but can't get reproduce the first example described at http://vimcasts.org/blog/2010/12/a-text-object-for-ruby-blocks/.

The cursor was over def, I typed var in normal mode to select the whole method definition but only the current line is selected, as shown here.

I also tried the other examples in the blog post with no success.

On the other hand, textobj-indent works just fine.

I can reproduce this bug in both MacVim 7.3 (53) (both in the GUI and terminal mode) and Snow Leopard's vim 7.2 (108).

Here's a sample file: https://gist.github.com/756312 (don't mind the nasty code).

telemachus commented 13 years ago

I believe the problem is your indentation (which appears to be 4 spaces rather than 2). I'm not yet sure if the it comes from textobj-rubyblock or textobj-user (which rubyblock builds on), but something is very sensitive to indentation/spacing.

After I reformatted your code to have 2 space indentations, it worked fine. See here if you want to experiment: https://gist.github.com/756745

meqif commented 13 years ago

Actually, the problem had a completely different cause: there is an additional dependency which @nelstrom overlooked — matchit.vim. He mentioned it here.

After I added runtime macros/matchit.vim to my vimrc, the plugin started working correctly (except for the parser method, which var handles correctly but vir or successive irs and ars behave incorrectly, but that's for another issue).

In any case, thanks for your help, I truly appreciate it. :-)

Since this was actually a non-issue, I apologize for taking people's time and I'll close this.

nelstrom commented 13 years ago

No need to apologize, this was not a non-issue. You made me realise that my plugin was dependent on matchit.vim, so thanks for raising it.