Monday, June 17, 2013

Re: Indentation issue

Hi,

On Mon, Jun 17, 2013 at 05:24:36PM +0200, Steve wrote:
> While writing a mail in French, I would like that each first line of a
> paragraph is indented, like this:
>
> ksjdk ksjdkjsddsj kjsdksjd kjsdksdj
> kjhkasjhd kajshdkajsdk, kajshd kjahsd
> akshd kajsh kahsd hdkask.
>
> kjsdkf ksjdhfsdf kjdshf klsdjhksd
> khsdj ksdjf ksdjhf ksdjh ksdhf, lslsl,
> lslsosk sljs ls lllss llksd llksddlskd
> lsdklsd.
>
> I would like it to be automatic. For the time being, if I manually indent with
> two spaces, next lines will be automatically indented by two spaces, I guess
> it's the 'set autoindent' setting that does that, which is ok for writing code
> but not emails (at least in French).

I have written a plugin that does exactly that for mails. It's still
not perfect (I have a few bugs to tweak), but as you can see with this
mail it works. It's called yaposting, it's on my github and on
vimscript:

* http://www.vim.org/scripts/script.php?script_id=957
* https://github.com/guyzmo/vim-yaposting/

Basically, you write your paragraph without caring about the
indentation, and when you finish that paragraph, you just have to
execute <Leader>mr. When you want to use a '«' or a ':', you just need
to use a non-secable space ' ' before/after the character, so you don't
take any chance displaying it wrongly.

It supports having an alinea at the begining of your paragraphs (you
can set up how many spaces you want), setting a left/right margin,
and even reformat quoted text. You can also tell it to justify your
text, left align or right align your text.

Sadly, there are two bugs I have to take care of (that is getting
dust in my TODO list :-s):

* <Leader>mr does not work as it should, but vip<Leader>mr does.
* if you don't add a space at the end of the previous line or a
space at the begining of the current line, last word of previous
line and first word of current line gets joined.

BTW, I also wrote a python library that takes care of all
formatting, that supports perfectly unicode text!

HTH

--
Guyzmo

--
--
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:

Post a Comment