On 03/14/12 14:07, Dotan Cohen wrote:
On Tue, Mar 13, 2012 at 17:05, Tim Chase<[email protected]> wrote:
This expression will go back to one of the character pairs:
?\({}\|[]\|()\|""\|''\)
However, is there any way to restrict it to the current line?
Your mapping could include the line, something like (untested)
:nnoremap<f4> ?<bslash>%<c-r>=line('.')<cr>l\({}\|[]\|()\|""\|''\)<cr>
I have been wandering helplessly through the fine manual. Perhaps you
could suggest what parts of the manual I should be concentrating on
for this endeavour? I did read the help section that you mentioned,
and those around it, but I still cannot get the pattern to even match
at all in a scripted solution!
I tested a bit and came up with
:nnoremap Q
?\%<c-r>=line('.')<cr>l\({}\\|\[]\\|()\\|""\\|''\\|><lt>\)?s+1<cr>
which seems to do what you intend. Or you can use the line-noise of
nnoremap Q
?<bslash>%<c-r>=line('.')<cr>l\({}<bslash><bar><bslash>[]<bslash><bar>()<bslash><bar>""<bslash><bar>''<bslash><bar>><lt><bslash>)?s+1<cr>
as I think there are various escaping issues on the backslashes,
pipes and square-brackets.
I like the "?s+1" to position the cursor because I could then use
i_CTRL-O to launch the mapping and end up where I intend:
:imap <f4> <c-o><f4>
And obviously if you want, you can still use "ii" for your
mapping instead of <f4> (or whatever other single key you might
want).
-tim
--
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