Tuesday, November 27, 2012

Custom whitespace handling for cut and paste

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

No comments: