Wednesday, August 26, 2009

Re: using % (shift 5) for end or do/end style blocks

For whats its worth you guys thoroughly answered my question and its
working well here (I was the original poster). Thanks a bunch!

On Wed, Aug 26, 2009 at 4:14 PM, Philip Rhoades<phil@pricom.com.au> wrote:
>
> Tony,
>
>
> On 2009-08-22 15:38, Tony Mechelynck wrote:
>> On 12/08/09 04:08, Gary Johnson wrote:
>>> On 2009-08-12, Philip Rhoades wrote:
>>>> On 2009-08-12 05:49, Gary Johnson wrote:
>>>>> On 2009-08-12, Philip Rhoades wrote:
>>>>>> But when I checked, the matchit plugin was not there so I downloaded and
>>>>>> installed it but still no improvement so I read the doc (!) and changed
>>>>>> the last line in .vimrc to:
>>>>>>
>>>>>>   :source ~phil/.vim/plugin/matchit.vim
>>>>>>
>>>>>> but still no joy.  What is really odd is that "g%" ie the reverse
>>>>>> movement works fine!
>>>>>>
>>>>>> I have:
>>>>>>
>>>>>>   vim v7.2.148-1
>>>>>>   matchit.vim v1.13.2, for Vim 6.3+
>>>>> I suppose the problem could be some other plugin interfering with
>>>>> these.  To make sure it wasn't working for me because of some
>>>>> peculiarity of my setup, I started vim like this:
>>>>>
>>>>>        vim -N -u NONE
>>>>>
>>>>> Then within vim, executed these:
>>>>>
>>>>>        :runtime macros/matchit.vim
>>>>
>>>> This works OK.
>>>>
>>>>
>>>>>        :filetype detection on
>>>>
>>>> This gives:
>>>>
>>>>     E475: Invalid argument: detection on
>>> I'm sorry--that should have been
>>>
>>>       :filetype plugin on
>>>
>>>>>        :e foo.rb
>>>>>
>>>>> where foo.rb contains your example code.  The % worked fine.  Try
>>>>> that and see if it works any better for you.  That's pretty much
>>>>> what you already tried with your simple .vimrc except that your
>>>>> experiment also loaded all your plugins as well, whereas starting
>>>>> vim with -u NONE also inhibits the loading of plugins.
>>>>> Alternatively, you could repeat your experiment but start vim as
>>>>>
>>>>    >        vim --noplugin
>>>>
>>>>
>>>> Still have the same problem with this:
>>>>
>>>>     vim --noplugin t.rb
>>>>
>>>> where t.rb is:
>>>>
>>>> #!/usr/bin/env ruby
>>>>
>>>> x = 1
>>>>
>>>> if (x == 1)
>>>>            puts 'Yesss'
>>>> else
>>>>            puts 'Noooo'
>>>> end
>>> I'm at a loss then.  I've tried it on straight Windows on a
>>> different PC with gvim 7.2.148 from Cream, and on a Red Hat Linux
>>> system with vim 7.2.148 I built myself, and it just works.  I don't
>>> know enough about the internals of either the ruby.vim plugin or
>>> the matchit.vim script to know how to troubleshoot this further.
>>> For what it's worth, if I execute this from vim on Linux when
>>> editing a Ruby file (so that ft=ruby),
>> [...]
>>
>> After having rtead all this thread, let's try to revive it.
>>
>> The reason matchit.vim is in macros/, not in plugin/, is that it is
>> vi-incompatible and therefore not loaded by default.
>>
>> To have it sourced whenever Vim is started with global plugins enabled,
>> add the following one-line file as ~/.vim/plugin/matchit.vim (for Unix)
>> or ~/vimfiles/plugin/matchit.vim (for Windows):
>>
>>       runtime macros/matchit.vim
>
>
> Done.
>
>
>> Also copy $VIMRUNTIME/macros/matchit.txt to ~/.vim/doc/ or
>> ~/vimfiles/doc/ depending on platform (on Unix you can make a symlink
>> instead) then run the ":helptags" command (q.v.) on that directory.
>> Create any not-yet-existent needed directories as you go along.
>
>
> Done.
>
>
>> This should be enough to run matchit together with the standard plugins
>> and to enable its help. It should also work from then on ion other
>> filetypes, for instance in vimscript on if / elseif / else / endif
>> structures, or while / endwhile, for / endfor, try / catch / finally /
>> endtry...
>
>
> No luck - the cursor still jumps as previously described . .
>
>
>> Optionally (as a last flourish), you can also add the following to your
>> vimrc:
>>
>> au VimEnter * au FileType * if !exists(b:match_words)
>>       \ | let b:match_words =&matchpairs | endif
>>
>> so that 'matchpairs' will still work for filetypes whose ftplugin does
>> not define b:match_words. The double autocommand structure is to make it
>> the last Filetype autocommand, so that ftplugins take precedence, and
>> that any 'matchpairs' setting set by a non-matchit-aware ftplugin is used.
>
>
> No change . .
>
> Thanks anyway . .
>
> I can supply my .vimrc file if there is something in there that might be
> an issue.
>
> Phil.
> --
> Philip Rhoades
>
> GPO Box 3411
> Sydney NSW      2001
> Australia
> E-mail:  phil@pricom.com.au
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments: