-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
Description
Steps to reproduce
- Start vim as follows. The first
-cmakes the command'formatprg'generates (e.g.,:.,.+2!sed…) span multiple lines in the command window. The second-ccreates an arbitrarily named mark in the document; the mark is required. The+is merely for convenience:
seq 1 40 | vim - -u 'NONE' \
-c "let &l:formatprg='sed$(printf '%500s' '')p'" \
-c 'normal! 20Gmz' \
+10- Run
gq2jin normal mode on line 10, or anygqcommand over a range that includes at least 3 lines (so that, e.g.,3 lines filteredappears in:messages) before the mark but does not include the mark. Note that passing-c 'normal! gq2j'on the command line does not result in the bug. - The cursor moves to the mark after running
gq.
Expected behaviour
Running gq in any way other than specified keeps the cursor either at the beginning or the end of the filtered text.
Version of Vim
9.1 (2024 Jan 02, compiled Sep 05 2025 19:44:46) patches: 1-16, 647, 678, 697 (shipped with Ubuntu)
Environment
Operating system: Ubuntu 24.04.3 LTS on WSL 2.6.2.0 (Windows 11 Home 25H2)
Terminal: Windows Terminal 1.23.12811.0
Value of $TERM: xterm-256color
Shell: GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
Logs and stack traces
Reactions are currently unavailable