Friday, February 7, 2014

Re: [plugin] targets.vim - adds many text objects in the spirit of Vim, including next and last text objects

2014-02-07 19:07, David Fishburn skrev:
>>
>> ...
>>
>
>
>>> FWIW I would like to be able to define text objects in terms of
>>> 'syntax objects' (yes I just made that term up, I mean primarily
>>> the piece of text seleced by a :syn match or :syn region as
>>> identified by the syntax group it is connected with).
>>
> ...
>
>> That's actually an interesting idea. I'm not sure how useful it would be
>> though. Looking at some local code files the regions with common syntax are
>> usually strings, comments or single words. All of which can be operated on
>> with default text objects.
>>
>> Do you see real world editing tasks where you would benefit from selecting
>> all text inside the current syntax region?
>
>
> I think a simple case might be when you are editing a HTML file.
>
> You can embedded different syntax objects within it, javascript, perl, php,
> ...
>
> Some of the html syntax files do this already. They can highlight
> Javascript as "javascript" and highlight the rest of the page as "html".
>
> So, I might like to highlight my "javascript" code using one of these text
> objects and hit = to format it.
>
> That was one of the first usages that came to mind to me.

The one most on my mind was Markdown links and link references,
which look like
either of these:

[link text](http://example.com)

[link text][label]

[link text, also label][]

where the contents of at least the second bracket/paren pair is
itself hilighted with its own highlight group; I'd like to
operate on the reference as a whole (both bracket pairs with
their contents) even though they are two ] objects and even
though the cursor is located on the label. Another case is a
Pandoc markdown extension which I use more than is good for me
:-) the inline note, which looks like this

^[note text]

which I'd like to capture from the caret to the right bracket.
Ideally also a way to jump to the beginning of the link/note text
from outside, jumping to the next note even if a link intervenes
or vice versa.

/bpj

--
--
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/groups/opt_out.

No comments: