[vim/vim] syntax is disabled when bufdo (#4761)

21 views
Skip to first unread message

mattn

unread,
Aug 2, 2019, 4:42:33 AM8/2/19
to vim/vim, Subscribed

Describe the bug

syntax is disabled when bufdo

To Reproduce

  1. vim --clean /path/to/vim/src/if_*.c
  2. :bufdo tab split
  3. n

Expected behavior

All buffers is enabled syntax

As far as I looked code, this is doing intentionally.

diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index a275fb8b7..803a98229 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1427,9 +1427,6 @@ ex_listdo(exarg_T *eap)
     tabpage_T	*tp;
     buf_T	*buf = curbuf;
     int		next_fnum = 0;
-#if defined(FEAT_SYN_HL)
-    char_u	*save_ei = NULL;
-#endif
     char_u	*p_shm_save;
 #ifdef FEAT_QUICKFIX
     int		qf_size = 0;
@@ -1445,12 +1442,6 @@ ex_listdo(exarg_T *eap)
     }
 #endif
 
-#if defined(FEAT_SYN_HL)
-    if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo)
-	/* Don't do syntax HL autocommands.  Skipping the syntax file is a
-	 * great speed improvement. */
-	save_ei = au_event_disable(",Syntax");
-#endif
 #ifdef FEAT_CLIPBOARD
     start_global_changes();
 #endif
@@ -1638,14 +1629,6 @@ ex_listdo(exarg_T *eap)
 	listcmd_busy = FALSE;
     }
 
-#if defined(FEAT_SYN_HL)
-    if (save_ei != NULL)
-    {
-	au_event_restore(save_ei);
-	apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn,
-					       curbuf->b_fname, TRUE, curbuf);
-    }
-#endif
 #ifdef FEAT_CLIPBOARD
     end_global_changes();
 #endif


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

mattn

unread,
Aug 2, 2019, 4:49:05 AM8/2/19
to vim/vim, Subscribed

argdo also can reproduce.

Bram Moolenaar

unread,
Aug 2, 2019, 4:57:31 AM8/2/19
to vim...@googlegroups.com, mattn


> **Describe the bug**
>
> syntax is disabled when bufdo
>
> **To Reproduce**
>
> 1. `vim --clean /path/to/vim/src/if_*.c`
> 2. `:bufdo tab split`
> 3. `n`
>
> **Expected behavior**
>
> All buffers is enabled syntax
>
> As far as I looked code, this is doing intentionally.

Correct, syntax is intentionally skipped, because it's very slow to do
that for every buffer encountered. However, if a buffer remains visible
after the command is finished, then syntax should be applied. If that's
not happening, please provide a failing test.


--
hundred-and-one symptoms of being an internet addict:
1. You actually wore a blue ribbon to protest the Communications Decency Act.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

mattn

unread,
Aug 2, 2019, 10:18:32 AM8/2/19
to vim_dev
> vim --clean /path/to/vim/src/if_*.c
> :bufdo tab split
> n

This is all.

vim --clean /path/to/vim/src/if_*.c
:bufdo tab split

:ball

https://go-gyazo.appspot.com/ad695f8d81690638.png

First and last buffer has syntax. But middles are not.

Bram Moolenaar

unread,
Aug 3, 2019, 7:30:39 AM8/3/19
to vim/vim, Subscribed

Closed #4761 via c7f1e40.

Reply all
Reply to author
Forward
0 new messages