On 06:26 Tue 27 Nov , KamilS wrote:
> I primarily use Vim for LaTeX, i.e. for editing text rather than code, and I was wondering if it's possible to make Vim handle whitespace in a smarter way when cutting and pasting in in .tex files.
>
> In particular, I would like to see the kind of behaviour I know and love from Adobe InDesign. Let me give you an example:
>
> Sentence one. Sentence two. Sentence three.
>
> Now, if I select "Sentence two." (just this much, without the surrounding spaces) and cut it, InDesign will automatically delete one of the two remaining subsequent spaces. If I then paste it between "Sentence" and "three", never mind on which side of the space between them, InDesign will automatically add the missing space before or after it.
>
> The same happens with single words. Which makes sense because when you write text, you want to cut and paste words most of the time, not just bits of words.
>
> Is it possible to implement this kind of behaviour in Vim and limit it to .tex files? Or is there perhaps a plugin for it already, only I couldn't find it?
>
> --
> 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
Yes and no. You can make a sentence text object which will add the
missing spaces to the yanked text, but if you will paste it will add it
even if it was already there. Alternatively, you could make your own
p command which checks for the space (and call it \p or something
a like), since even in LaTeX you might need to paste LaTeX commands
(like in math) and some times you might not want to add extra spaces.
In ATP (http://atp-vim.sf.net LaTeX plugin for Vim) I just added good
sentence motions, which avoid \begin and \end and I am thinking how to
make them work nicely in the visual mode ...
Cheers,
Marcin
--
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
No comments:
Post a Comment