Am 23.11.2011 16:26, schrieb Ben Fritz:
gvim -N -u NONE -i NONE

Enter text:
           a b c d e f g

:setl ai copyindent preserveindent noet list

Place cursor after a, press s to replace the space character, then
<Enter>  to get a new line. Note that 10 spaces are inserted at the
beginning of the line, as expected. Do it again between b and see, it
happens again. I.e. the text is now:

           a
           b
           c d e f g h i j

:setl noai indentexpr=10

Place cursor after the c. As before, replace with a newline. A tab is
inserted in place of the first 8 spaces!

Now we have:

           a
           b
           c
          d e f g h i j

Which Vim displays as:

           a$
           b$
           c$
^I  d e f g h i j$

I expected the indent to be copied for the new line, from the line
above, as documented in :help 'copyindent'.

I do note, in :help quickref, the following description of copyindent:

'copyindent'      'ci'      make 'autoindent' use existing indent
structure

Maybe this option is only intended for use with autoindent? If so, is
there any reason why it should not also apply to the other indent
methods?

Ah, now after a re-read of :help 'copyindent' I see that it probably
is only intended for 'autoindent':

        Copy the structure of the existing lines indent when autoindenting a
        new line.

I did not read "autoindenting" as "only with the 'autoindent' option",
but rather as "when Vim automatically determines the indentation using
any of the 4 supported methods".

I think 'copyindent' would be FAR more useful if it supported more
indent methods than just autoindent.

Didn't test anything, but:
Can't you just set 'indentexpr' while leaving 'autoindent' on?
Shouldn't make a difference for the amount of indent.

--
Andy

--
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui