Hi!

I have a general question: Is there a way to create custom text
objects in Vim (or to redefine the existing text objects)?

I have switched from Windows to Ubuntu recently. Under Windows, I was
using WinEdt to edit my LaTeX files. It has a nice feature that I miss
in Vim, namely, easy environment selection: the cursor being inside an
environment, you just hit F12 to select the environment (in fact, it
is even more clever: it selects the most inner block of the type (),
[], {}, \(\), \[\], \{\}, \begin{...}\end{...}, so that e.g. if the
cursor is within the word "document" of \begin{document}, then hitting
F12 selects {document}). I think a similar functionality in Vim could
be achieved using text objects. For example, it would be nice to have
something like a text object ae ("an environment") that would behave
similar to the text object at.

Another example: I use gwap to format my paragraphs manually (I don't
like neither to have paragraphs formatted automatically nor to wrap
lines). It would be nice to be able to redefine the ap text object to
make it understand LaTeX syntax (basically, I would like lines
starting with \\, \begin{...}, \end{...}, \[, \], and some other
commands to be treated as paragraph terminators; this would be easy if
the paragraph option could accept regexps).

Are you aware of any plugins that offer a similar functionality? I
have tried matchit.vim, however it doesn't work with LaTeX
environments as I would expect to (a% selects \begin{...}, the body of
an environment, and the first character of \end{...}), so I am
thinking about writing my own plugin, but I am confused: what are text
objects from the point of view of Vim script? Note that I want text
objects to be used both in Visual and Operator-pending mode.

Any help is appreciated!

Regards,
Oleksandr Manzyuk

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to