% doesn't jump between pairs of parenthesis in html

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

% doesn't jump between pairs of parenthesis in html

Peng Yu
Hi,

https://github.com/othree/html5.vim

I have the above plugin installed.

The key % can not help me jump between () pair and {} pair.

I'm wondering whether there is any fix to this problem?

--
Regards,
Peng

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: % doesn't jump between pairs of parenthesis in html

Gary Johnson-4
On 2012-01-07, Peng Yu wrote:
> Hi,
>
> https://github.com/othree/html5.vim
>
> I have the above plugin installed.
>
> The key % can not help me jump between () pair and {} pair.
>
> I'm wondering whether there is any fix to this problem?

What is the output from this command?

    :verbose set matchpairs?

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: % doesn't jump between pairs of parenthesis in html

Peng Yu
> What is the output from this command?
>
>    :verbose set matchpairs?

Here is the output.

:verbose set match
matchpairs  matchtime
  matchpairs=(:),{:},[:],<:>
        Last set from ~/.vimrc

--
Regards,
Peng

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: % doesn't jump between pairs of parenthesis in html

Gary Johnson-4
On 2012-01-07, Peng Yu wrote:

> > What is the output from this command?
> >
> >    :verbose set matchpairs?
>
> Here is the output.
>
> :verbose set match
> matchpairs  matchtime
>   matchpairs=(:),{:},[:],<:>
>         Last set from ~/.vimrc

That's not what I expected, but I think I understand the problem
because I now observe the same problem when I edit an HTML file.
You probably have the matchit.vim plugin enabled.  Execute this
command,

    :echo b:match_words

You will probably see this:

    <:>,<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>

Note that < and > are matched, but not any other bracket types.

If that is the cause of the problem you're seeing, too, then a
solution is to create an after file, ~/.vim/after/ftplugin/html.vim,
and put in it this line:

    let b:match_words .= ",(:),{:},[:]"

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: % doesn't jump between pairs of parenthesis in html

Gary Johnson-4
On 2012-01-07, Gary Johnson wrote:

> If that is the cause of the problem you're seeing, too, then a
> solution is to create an after file, ~/.vim/after/ftplugin/html.vim,
> and put in it this line:
>
>     let b:match_words .= ",(:),{:},[:]"

Correction:  That should be

    let b:match_words .= ",(:),{:},\\[:\\]"

To be on the safe side, you should probably use this:

    if exists("b:match_words")
        let b:match_words .= ",(:),{:},\\[:\\]"
    endif

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: % doesn't jump between pairs of parenthesis in html

Peng Yu
In reply to this post by Gary Johnson-4
On Sat, Jan 7, 2012 at 2:17 PM, Gary Johnson <[hidden email]> wrote:

> On 2012-01-07, Peng Yu wrote:
>> > What is the output from this command?
>> >
>> >    :verbose set matchpairs?
>>
>> Here is the output.
>>
>> :verbose set match
>> matchpairs  matchtime
>>   matchpairs=(:),{:},[:],<:>
>>         Last set from ~/.vimrc
>
> That's not what I expected, but I think I understand the problem
> because I now observe the same problem when I edit an HTML file.
> You probably have the matchit.vim plugin enabled.  Execute this
> command,

Right, I indeed have it installed. Just to make sure, this is a bug in
html.vim but not in matchit.vim, right?

"  matchit.vim: (global plugin) Extended "%" matching
"  Last Change: Fri Jan 25 10:00 AM 2008 EST
"  Maintainer:  Benji Fisher PhD   <[hidden email]>
"  Version:     1.13.2, for Vim 6.3+
"  URL:   http://www.vim.org/script.php?script_id=39

--
Regards,
Peng

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: % doesn't jump between pairs of parenthesis in html

Gary Johnson-4
On 2012-01-07, Peng Yu wrote:

> On Sat, Jan 7, 2012 at 2:17 PM, Gary Johnson wrote:
> > On 2012-01-07, Peng Yu wrote:
> >> > What is the output from this command?
> >> >
> >> >    :verbose set matchpairs?
> >>
> >> Here is the output.
> >>
> >> :verbose set match
> >> matchpairs  matchtime
> >>   matchpairs=(:),{:},[:],<:>
> >>         Last set from ~/.vimrc
> >
> > That's not what I expected, but I think I understand the problem
> > because I now observe the same problem when I edit an HTML file.
> > You probably have the matchit.vim plugin enabled.  Execute this
> > command,
>
> Right, I indeed have it installed. Just to make sure, this is a bug in
> html.vim but not in matchit.vim, right?

Yes, I believe it is a bug in $VIMRUNTIME/ftplugin/html.vim.  I have
cc'd the maintainer.

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: % doesn't jump between pairs of parenthesis in html

Tony Mechelynck
In reply to this post by Peng Yu
On 07/01/12 22:06, Peng Yu wrote:

> On Sat, Jan 7, 2012 at 2:17 PM, Gary Johnson<[hidden email]>  wrote:
>> On 2012-01-07, Peng Yu wrote:
>>>> What is the output from this command?
>>>>
>>>>     :verbose set matchpairs?
>>>
>>> Here is the output.
>>>
>>> :verbose set match
>>> matchpairs  matchtime
>>>    matchpairs=(:),{:},[:],<:>
>>>          Last set from ~/.vimrc
>>
>> That's not what I expected, but I think I understand the problem
>> because I now observe the same problem when I edit an HTML file.
>> You probably have the matchit.vim plugin enabled.  Execute this
>> command,
>
> Right, I indeed have it installed. Just to make sure, this is a bug in
> html.vim but not in matchit.vim, right?

Actually, IIUC it's a bug in neither — unless the HTML plugin has to
care for embedded Javascript and CSS.

() and {} have no meaning whatsoever in HTML (outside embedded scripts
in different languages, see below). [] has a meaning as part of a
<![CDATA[ ... ]]> pair in some HTML dialects, but IMHO these should be
handled as indivisible (possibly by adding ,<![CDATA[:]]> to
b:matchpairs) but not as a case of [:]

However, HTML may include CSS inside a <style> element, and CSS knows
about paired {}; and it may include JavaScript inside a <script>
element, and JavaScript knows about (), {}, and [].


Best regards,
Tony.
--
The temperature of Heaven can be rather accurately computed.  Our
authority is Isaiah 30:26, "Moreover, the light of the Moon shall be as
the light of the Sun and the light of the Sun shall be sevenfold, as
the light of seven days."  Thus Heaven receives from the Moon as much
radiation as we do from the Sun, and in addition 7*7 (49) times as much
as the Earth does from the Sun, or 50 times in all.  The light we
receive from the Moon is one 1/10,000 of the light we receive from the
Sun, so we can ignore that ... The radiation falling on Heaven will
heat it to the point where the heat lost by radiation is just equal to
the heat received by radiation, i.e., Heaven loses 50 times as much
heat as the Earth by radiation.  Using the Stefan-Boltzmann law for
radiation, (_ H/_ E)^4 = 50, where _ E is the absolute temperature of the
earth (~300K), gives _ H as 798K (525C).  The exact temperature of Hell
cannot be computed ... [However] Revelations 21:8 says "But the
fearful, and unbelieving ... shall have their part in the lake which
burneth with fire and brimstone."  A lake of molten brimstone means
that its temperature must be at or below the boiling point, 444.6C.  We
have, then, that Heaven, at 525C is hotter than Hell at 445C.
                -- From "Applied Optics" vol. 11, A14, 1972

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: % doesn't jump between pairs of parenthesis in html

Gary Johnson-4
On 2012-01-07, Tony Mechelynck wrote:

> On 07/01/12 22:06, Peng Yu wrote:
> >On Sat, Jan 7, 2012 at 2:17 PM, Gary Johnson wrote:
> >>On 2012-01-07, Peng Yu wrote:
> >>>>What is the output from this command?
> >>>>
> >>>>    :verbose set matchpairs?
> >>>
> >>>Here is the output.
> >>>
> >>>:verbose set match
> >>>matchpairs  matchtime
> >>>   matchpairs=(:),{:},[:],<:>
> >>>         Last set from ~/.vimrc
> >>
> >>That's not what I expected, but I think I understand the problem
> >>because I now observe the same problem when I edit an HTML file.
> >>You probably have the matchit.vim plugin enabled.  Execute this
> >>command,
> >
> >Right, I indeed have it installed. Just to make sure, this is a bug in
> >html.vim but not in matchit.vim, right?
>
> Actually, IIUC it's a bug in neither — unless the HTML plugin has to
> care for embedded Javascript and CSS.

My assessment of this as a bug has nothing to do with the use of
those pairs by any programming or markup language, but rather by
their use in ordinary text.  % is useful for moving the cursor
between those pairs regardless of the context.  If % works for (
and ) in plain text, it should continue to work for ( and ) in
text embedded in HTML.

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: % doesn't jump between pairs of parenthesis in html

Bee-16


On Jan 7, 2:48 pm, Gary Johnson <[hidden email]> wrote:

> On 2012-01-07, Tony Mechelynck wrote:
>
>
>
>
>
> > On 07/01/12 22:06, Peng Yu wrote:
> > >On Sat, Jan 7, 2012 at 2:17 PM, Gary Johnson wrote:
> > >>On 2012-01-07, Peng Yu wrote:
> > >>>>What is the output from this command?
>
> > >>>>    :verbose set matchpairs?
>
> > >>>Here is the output.
>
> > >>>:verbose set match
> > >>>matchpairs  matchtime
> > >>>   matchpairs=(:),{:},[:],<:>
> > >>>         Last set from ~/.vimrc
>
> > >>That's not what I expected, but I think I understand the problem
> > >>because I now observe the same problem when I edit an HTML file.
> > >>You probably have the matchit.vim plugin enabled.  Execute this
> > >>command,
>
> > >Right, I indeed have it installed. Just to make sure, this is a bug in
> > >html.vim but not in matchit.vim, right?
>
> > Actually, IIUC it's a bug in neither — unless the HTML plugin has to
> > care for embedded Javascript and CSS.
>
> My assessment of this as a bug has nothing to do with the use of
> those pairs by any programming or markup language, but rather by
> their use in ordinary text.  % is useful for moving the cursor
> between those pairs regardless of the context.  If % works for (
> and ) in plain text, it should continue to work for ( and ) in
> text embedded in HTML.
>
> Regards,
> Gary


Interesting, possibly related,
using % in the first fails but works in the second.

1) decimal \d\{1,}
   Remove the \ before the { and % works !
   Is that documented?

2) buttons {"OK"}

Bill

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: % doesn't jump between pairs of parenthesis in html

Bee-16
kindle4ever wrote:
> I think you should check whether you have
> ":let loaded_matchit = 1" in your vimrc.
> It will disable matchit function.
> You may have added it by mistake.

Thank you for the comment...
But no, that is not in the .vimrc
And evoking vim with:
  vim -N -i NONE -u NONE
results in the same.

Bill

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: % doesn't jump between pairs of parenthesis in html

Christian Brabandt
On Sun, January 8, 2012 6:00 pm, Bee wrote:

> kindle4ever wrote:
>> I think you should check whether you have
>> ":let loaded_matchit = 1" in your vimrc.
>> It will disable matchit function.
>> You may have added it by mistake.
>
> Thank you for the comment...
> But no, that is not in the .vimrc
> And evoking vim with:
>   vim -N -i NONE -u NONE
> results in the same.

:h cpo-M

regards,
Christian

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: % doesn't jump between pairs of parenthesis in html

Bee-16


On Jan 9, 2:38 am, "Christian Brabandt" <[hidden email]> wrote:

> On Sun, January 8, 2012 6:00 pm, Bee wrote:
> > kindle4ever wrote:
> >> I think you should check whether you have
> >> ":let loaded_matchit = 1" in your vimrc.
> >> It will disable matchit function.
> >> You may have added it by mistake.
>
> > Thank you for the comment...
> > But no, that is not in the .vimrc
> > And evoking vim with:
> >   vim -N -i NONE -u NONE
> > results in the same.
>
> :h cpo-M
>
> regards,
> Christian

Ah ha! Thank you (yet again) Christian.

set cpo?
cpoptions=aABceFs
(Vim default)

Now I know where+how if I need it.

Bill

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php