Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Greg Wooledge Newsgroups: gnu.bash.bug Subject: Re: Vi mode and g commands Date: Mon, 8 Jun 2020 09:34:34 -0400 Lines: 30 Approved: bug-bash@gnu.org Message-ID: References: <20200608133434.GA4133@eeg.ccf.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1591623279 28478 209.51.188.17 (8 Jun 2020 13:34:39 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Dan Shearer Envelope-to: bug-bash@gnu.org Mail-Followup-To: Dan Shearer , bug-bash@gnu.org Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Received-SPF: none client-ip=139.137.100.1; envelope-from=wooledg@eeg.ccf.org; helo=mail.eeg.ccf.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 09:34:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20200608133434.GA4133@eeg.ccf.org> X-Mailman-Original-References: Xref: csiph.com gnu.bash.bug:16367 On Mon, Jun 08, 2020 at 02:28:05AM +0100, Dan Shearer wrote: > Some g commands are implemented, but incorrectly. Examples: > * g0 is equivalent to 0, rather than 'beginning of screen line when wrapped' > * g$ is equivalent to $, rather than 'end of screen line when wrapped' > > Other g commands are not implemented, just ignored. Examples: > * gM is ignored, rather than going to the middle of the line > * gE is ignored, rather than going to the end of the last word Those are not standard vi commands, as far as I can tell. They appear to be vim extensions. I opened /usr/bin/vi on HP-UX 11i and typed a line that was longer than my terminal's width, and then tried these commands. They do not do what you describe. In real vi, in an 80-wide terminal, with a single line of 120 or so characters, and the cursor at position 40, g$ acts just like $. With the cursor now at the end of the line, g0 acts just like 0. gE acts just like E (moves to the end of the current word). gM acts just like M (moves to the start of the middle line, which happens to be the first line, because there's only one line). I see no evidence that 'g' is even a meaningful keystroke in real vi. Maybe that's why vim chose it as the prefix for so many of their extension commands.