H Xu <[email protected]> wrote:
> On 2010/8/6 13:16, Dominique Pellé wrote:
>>
>> H Xu wrote:
>>
>>> On 2010/8/5 21:08, Ryan Williams wrote:
>>>>
>>>> % can't make cursor jump from one quote to its corresponding quote?
>>>
>>> You may be interested in the surround.vim plugin - it doesn't have the %
>>> behavior you want, but it has many commands that may accomplish what
>>> you're
>>> trying to do.
>>>
>>> http://www.vim.org/scripts/script.php?script_id=1697
>>> --
>>> 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
>>>
>>> Hello Ryan Williams,
>>>
>>> I already have this plugin installed, but this is really not
>>> what I need. What I need is a quick jump from one quote
>>> to another. But still thank you very much.
>>
>> You can try the SyntaxMotion plugin. It does something
>> close to what you need:
>>
>> http://www.vim.org/scripts/script.php?script_id=2965
>>
>> It moves the cursor to the beginning or end of the syntax group where
>> cursor is located (or more exactly, the the beginning of the syntax
>> highlighting color). So when cursor is inside a string "..._...",
>> pressing
>> <Leader><Left> (that's 2 keys, by default it's \ and<Left>) moves to
>> the beginning of the string (i.e. the start quote). It works for any
>> other syntax groups. For example, when in a comment, pressing
>> \<Left> will move to the beginning of the comment.
>>
>> -- Dominique
>>
> Hello,
>
> Thank you! This plugin is useful. Can I bind the command to other keys in
> my vimrc, such as
> \hh and \ll?
>
> Regards,
> Hong Xu
Hi
The plugin does not let configure it, but it's easy enough to edit
~/.vim/plugin/SyntaxMotion.vim and change the mappings.
To use \hh and \ll instead of \<left> an \<right> simply replace
the following lines....
nnoremap <silent> <Leader><left> :<c-u>call SyntaxMotion('B', 'n',
v:count1)<cr>
vnoremap <silent> <Leader><left> :<c-u>call SyntaxMotion('B', 'v',
v:count1)<cr>
nnoremap <silent> <Leader><right> :<c-u>call SyntaxMotion('F', 'n',
v:count1)<cr>
vnoremap <silent> <Leader><right> :<c-u>call SyntaxMotion('F', 'v',
v:count1)<cr>
...
vnoremap <silent> a<left> :<c-u>call SyntaxVisualSelect('b')<cr>
vnoremap <silent> a<right> :<c-u>call SyntaxVisualSelect('f')<cr>
... into...
nnoremap <silent> <Leader>hh :<c-u>call SyntaxMotion('B', 'n', v:count1)<cr>
vnoremap <silent> <Leader>hh :<c-u>call SyntaxMotion('B', 'v', v:count1)<cr>
nnoremap <silent> <Leader>ll :<c-u>call SyntaxMotion('F', 'n', v:count1)<cr>
vnoremap <silent> <Leader>ll :<c-u>call SyntaxMotion('F', 'v', v:count1)<cr>
...
vnoremap <silent> ahh :<c-u>call SyntaxVisualSelect('b')<cr>
vnoremap <silent> all :<c-u>call SyntaxVisualSelect('f')<cr>
-- Dominique
--
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