On So, 28 Aug 2011, Yukihiro Nakadaira wrote:

> expandtab doesn't work properly when smartindent and copyindent are set.
> When indent is inserted by smartindent, Vim always uses <Tab> for it.
> 
> $ vim -u NONE
> :set expandtab smartindent copyindent
> :execute "normal! i{\<CR>x"
> 
> Then, second line is "<Tab>x".

Here is a patch, including a test.

regards,
Christian
-- 

-- 
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
diff --git a/src/misc1.c b/src/misc1.c
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -363,7 +363,7 @@
 
 	/* Fill to next tabstop with a tab, if possible */
 	tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts);
-	if (todo >= tab_pad)
+	if (todo >= tab_pad && !curbuf->b_p_et)
 	{
 	    todo -= tab_pad;
 	    ++ind_len;
@@ -372,7 +372,7 @@
 	}
 
 	/* Add tabs required for indent */
-	while (todo >= (int)curbuf->b_p_ts)
+	while (todo >= (int)curbuf->b_p_ts && !curbuf->b_p_et)
 	{
 	    todo -= (int)curbuf->b_p_ts;
 	    ++ind_len;
diff --git a/src/testdir/test19.in b/src/testdir/test19.in
--- a/src/testdir/test19.in
+++ b/src/testdir/test19.in
@@ -12,6 +12,9 @@
 0wR			
 :" Test replacing with Tabs
 0wR			
+:" Test that copyindent works with expandtab ist set
+:set expandtab smartindent copyindent ts=8 sw=8 sts=8
+:exe "norm! o{\<cr>x"
 :?^start?,$w! test.out
 :qa!
 ENDTEST
diff --git a/src/testdir/test19.ok b/src/testdir/test19.ok
--- a/src/testdir/test19.ok
+++ b/src/testdir/test19.ok
@@ -5,3 +5,5 @@
     a cde
     		hi
 test text
+{
+        x

Raspunde prin e-mail lui