Wednesday, November 4, 2015

Re: Jumping to matching braces

On Wed, Nov 4, 2015 at 11:01 AM, nrolf0016 <rolf.nick@flowcad.de> wrote:
> Hi experts,
>
>
> jumping to matching braces using % is a nice feature.
>
> But obviously it does not work, if unmatchec braces had been entered after a comment.
>
> Refer to Lisp code attached:
>
> procedure( test()
> let( ( a )
> loop = t
> while( loop
> when( something
> loop = nil
> ); end when (
> )
> );let
> );proc
>
> I assume that this behaviour is not specific to Lisp only.
>
> Any idea how make it working even in these situations??

IIUC, matchit can match whatever it is set to match even inside
comments, but it won't match between inside and outside of comments.
For that:

1. Enable matchit. On Unix/Linux, if you haven't yet done it, you can
do it by setting the following symlinks (in a shell called from within
Vim, e.g. with the :shell command):
mkdir -pv ~/.vim/plugin ~/.vim/doc
cd ~/.vim/plugin
ln -sv $VIMRUNTIME/macros/matchit.vim
cd ../doc
ln -sv $VIMRUNTIME/macros/matchit.txt
followed by
:helptags ~/.vim/doc
This must be done from within Vim in order for the $VIMRUNTIME
variable to be correctly substituted by the shell. These symlinks are
valid for as long as you will be using Vim 7.4 but they will need to
be regenerated for every new version after that, if there are any.

2. Enable matchit on files which don't set b:match_words in their
filetype-plugin, by adding this to your vimrc:
au BufWinEnter * if !exists('b:match_words') | let b:match_words =
&matchpairs | endif


Best regards,
Tony.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: