Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jan 2020 10:59:16 +0100
From:      Polytropon <freebsd@edvax.de>
To:        "Ronald F. Guilmette" <rfg@tristatelogic.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Substituting horizontal tab characters in vi
Message-ID:  <20200102105916.67956873.freebsd@edvax.de>
In-Reply-To: <61189.1577922242@segfault.tristatelogic.com>
References:  <61189.1577922242@segfault.tristatelogic.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Wed, 01 Jan 2020 15:44:02 -0800, Ronald F. Guilmette wrote:
> Yes, I'm a holdout.  After all these years I still use vi.  Why not?
> It works!
> 
> But ever since "upgraded" to 12.0-RELEASE (from 9.1) I have been hitting
> my head on one annoying little problem with vi, and I wonder if anyone
> can tell me what the fix or workaround is.
> 
> Quiet simply, it used to be possible to use vi to make substitutions for
> horizontal tab characters, say for example in the current line, by just
> typing : (colon) to get to the vi "command prompt" and then typing "s"
> (substitute command) followed by some delimiter, e.g. forward slash,
> and then just hitting the tab key on my keyboard, followed by a closing
> delimiter and then my substitution text followed by yet another closing
> delimiter.
> 
> Now this doesn't work anymore.  Now, vi, while in "command mode" won't
> even allow me to hit the tab key anymore!  It just sits there and blinks
> at me as if I hadn't touched the keyboard at all.  Funny thing though,
> I just now checked and realized that I *can* still get it to perform
> substitutions for horizontal tab characters, but I have to go through
> some rather silly gyrations in order to even enter the horizontal tab
> character.  Specifically, I have to type in cntrl-v followed by cntrl-i.

I can confirm this on FreeBSD 12.0-p7. Additionally, you can
use :s/<Ctrl+v><TAB>/something/ (i. e., use TAB key instead of
Ctrl+I).

However, when I use vim or gvim, the old input method (using
the _actual_ TAB key without ^V) works as expected, even though
the tab "character" itself is displayed as ^I in the replacement
rule, which then looks like :s/^I/something/.

As I have access to an older FreeBSD system, I can confirm
that stock vi of that time supports directly inputting the
TAB, which on 12.0 doesn't seem to work anymore. The replacement
rule looks like :s/        /something/ (using the TAB key advances
the cursor to the next tabstop in the command input area).

Sidenote: Both tested in X terminals (classic xterm).



> So anyway, is there some way of restoring the old behavior so that I can
> go back to just using the tab key in a straiightforward and intutive
> fashion?

Is using vim an option for you?



> P.S.  This is not a big problem, but I really do wish that people wouldn't
> break standard tools like vi as they are "upgrading" them.

Lots of things disimprove or break during upgrading... ;-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20200102105916.67956873.freebsd>