VI Stuff needed...

Nifty Hat Mitch mitch48 at sbcglobal.net
Wed Jan 5 03:26:09 UTC 2005


On Thu, Dec 30, 2004 at 11:11:18AM +0530, mnikhil m wrote:

> Hi All,
> 
> Wishing you all a Happy and Prosperous New Year 2005 coming
> 
> I have a query ,   in VI , when I write a code , I  use '%' to jump to
> the next '}' or '{' , but when I am writing an HTML code , I simply
> want is jump to '<' and '>' when I press <Esc>% , I think it should
> happen ,even I tried to install matchit plugin in my VIM , but canot
> get it,
> Could any one please show me how could I set '%' key to jump to next
> '>' or '<' , when I edit an *HTML*  file .

Hmmmm... look to setting  something like in your own .vimrc file

     set matchpairs=(:),{:},[:],<:>

You may wish to wrap this inside a test for syntax
    syn=html
or some such hook to keep the change only for html files.

More  '%' stuff is setup in matchit.
In vim type 

   :help matchit

I see this hint in /usr/share/vim/vim62/macros/matchit.txt 

    "In Vim, as in plain vi, the percent key, |%|, jumps the cursor from a
    brace, bracket, or paren to its match.  This can be configured with
    the 'matchpairs' option.  The matchit plugin extends this in several
    ways:..."

AND....
    "Examples:
        Suppose you

                :let b:match_words = '<:>,<tag>:</tag>'
 
       and hit "%" with the cursor on or before the "<" in "a <tag> is
       born".  The pattern '<' comes first, so it is preferred over
       '<tag>', which also matches.  If the cursor is on the "t",
       however, then '<tag>' is preferred, because this matches a bit
       of text containing the cursor.  If the two groups of patterns
       were reversed then '<' would never be preferred.
 




-- 
	T o m  M i t c h e l l 
	spam unwanted email.
	SPAM, good eats, and a trademark of  Hormel Foods.




More information about the fedora-list mailing list