Loading ...
Sorry, an error occurred while loading the content.

Indentation issue

Expand Messages
  • Steve
    Hi, 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
    Message 1 of 8 , Jun 17, 2013
    • 0 Attachment
      Hi,

      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).


      How could I do this?

      Thank you,
      steve

      --
      --
      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@....
      For more options, visit https://groups.google.com/groups/opt_out.
    •  Dhénin Jean-Jacques
      2013/6/17 Steve ... http://svnweb.freebsd.org/ports/head/textproc/par/ Par is similar but superiour to the fmt(1) command included in the
      Message 2 of 8 , Jun 17, 2013
      • 0 Attachment
        2013/6/17 Steve <dlist@...>
        Hi,

        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).


        How could I do this?

        Thank you,
        steve



        Par is similar but superiour to the fmt(1) command included in the
            base system.
        
            Par is a filter that copies its input to its output, changing all
            white characters (except newlines) to spaces, and reformatting
            each paragraph.  Paragraphs are separated by protected, blank, and
            bodiless lines (see the Terminology section for definitions), and
            optionally delimited by indentation (see the d option in the Options
            section).
        
            Each output paragraph is generated from the corresponding input
            paragraph as follows:
        
             1) An optional prefix and/or suffix is removed from each input line.
             2) The remainder is divided into words (separated by spaces).
             3) The words are joined into lines to make an eye-pleasing paragraph.
             4) The prefixes and suffixes are reattached.
        
             If there are suffixes, spaces are inserted before them so that they
             all end in the same column.
        
        WWW: http://www.nicemice.net/par/
        
         
        Hope this help
        ---------------------------------------------------------
        (°>   Dhénin Jean-Jacques
        / )     48, rue de la Justice 78300 Poissy
        ^^   dhenin@...
        ---------------------------------------------------------

        --
        --
        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@....
        For more options, visit https://groups.google.com/groups/opt_out.
         
         
      • Guyzmo
        Hi, ... 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
        Message 3 of 8 , Jun 17, 2013
        • 0 Attachment
          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@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Ben Fritz
          ... set fo+=2 and maybe set fo+=a You must still manually add two spaces indent to the first line, but after that the rest of the paragraph aligns as you want.
          Message 4 of 8 , Jun 17, 2013
          • 0 Attachment
            On Monday, June 17, 2013 10:24:36 AM UTC-5, Steve wrote:
            > Hi,
            >
            >
            >
            > 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).
            >

            set fo+=2

            and maybe

            set fo+=a

            You must still manually add two spaces indent to the first line, but after that the rest of the paragraph aligns as you want.

            You could probably make some mappings to automatically enter the two spaces. Maybe:

            inoremap <CR><CR> <CR><CR><Space><Space>

            or

            inoremap <CR><CR> <CR><CR><C-T>

            And similar for pressing 'o' in normal mode. Consider buffer-local mappings so it only happens for plaintext files.

            --
            --
            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@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • Guyzmo
            Hello, ... well I have hoovered my todo list, and now these bugs are fixed! -- Guyzmo -- -- You received this message from the vim_use maillist. Do not
            Message 5 of 8 , Jun 18, 2013
            • 0 Attachment
              Hello,

              On Mon, Jun 17, 2013 at 05:52:01PM +0200, Guyzmo wrote:
              > 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.
              > * http://www.vim.org/scripts/script.php?script_id=957
              > * https://github.com/guyzmo/vim-yaposting/

              well I have hoovered my todo list, and now these bugs are fixed!

              --
              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@....
              For more options, visit https://groups.google.com/groups/opt_out.
            • Steve
              Hi, ... Thanks, that s exactly what I was looking for. ... Not required but very useful. ... Yes and the same for the next paragraphs. ... Very nice, thank
              Message 6 of 8 , Jun 21, 2013
              • 0 Attachment
                Hi,


                Le 17-06-2013, à 10:02:19 -0700, Ben Fritz a écrit :

                > On Monday, June 17, 2013 10:24:36 AM UTC-5, Steve wrote:
                > > Hi,
                > > 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).
                > >
                >
                > set fo+=2

                Thanks, that's exactly what I was looking for.

                > and maybe
                >
                > set fo+=a

                Not required but very useful.

                > You must still manually add two spaces indent to the first line, but after
                > that the rest of the paragraph aligns as you want.

                Yes and the same for the next paragraphs.

                > You could probably make some mappings to automatically enter the two spaces.
                > Maybe:
                >
                > inoremap <CR><CR> <CR><CR><Space><Space>
                >
                > or
                >
                > inoremap <CR><CR> <CR><CR><C-T>

                Very nice, thank you.

                > And similar for pressing 'o' in normal mode. Consider buffer-local mappings
                > so it only happens for plaintext files.


                Thank you for your answer, it helped me a lot looking at the right place in the
                help.

                Regards,
                steve

                --
                --
                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@....
                For more options, visit https://groups.google.com/groups/opt_out.
              • Steve
                Hi Guyzmo, I tried your plugin, but for an unknown reason I didn t manage to make it work. So I concentrated on Ben s suggestion because I m still learning
                Message 7 of 8 , Jun 21, 2013
                • 0 Attachment
                  Hi Guyzmo,

                  I tried your plugin, but for an unknown reason I didn't manage to make it work.
                  So I concentrated on Ben's suggestion because I'm still learning vim's basics
                  and I thought it would be better for me to understand those than a plugin full
                  of code :)

                  But thanks a lot for your answer, and once I'm a bit more comfortable with vim,
                  I'll try your plugin.

                  Regards,
                  Steve

                  --
                  --
                  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@....
                  For more options, visit https://groups.google.com/groups/opt_out.
                • Steve
                  Hi, Just for the record, maybe someone will need this one day. For the fo+=2 option to work well, one needs to turn autoindenting off. I tried putting set
                  Message 8 of 8 , Jun 25, 2013
                  • 0 Attachment
                    Hi,

                    Just for the record, maybe someone will need this one day. For the
                    fo+=2 option to work well, one needs to turn autoindenting off. I tried
                    putting 'set noautoindent' in several files but it didn't work
                    (something somewhere just activated it back on). So I finally found how
                    to do it properly. Create a file called ~/.vim/indent/mail.vim (if you
                    don't want this for writing emails, for html, it would be html.vim for
                    ex.) with this one line:

                    let b:did_indent = 1

                    and you're done. The reason it works is given here:

                    http://vim.wikia.com/wiki/How_to_stop_auto_indenting

                    Have a nice day,
                    steve


                    --
                    --
                    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@....
                    For more options, visit https://groups.google.com/groups/opt_out.
                  Your message has been successfully submitted and would be delivered to recipients shortly.