NetBSD Problem Report #59983

From www@netbsd.org  Sun Feb  8 16:10:35 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.netbsd.org", Issuer "R13" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B72941A923F
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  8 Feb 2026 16:10:35 +0000 (UTC)
Message-Id: <20260208161034.AC49C1A9242@mollari.NetBSD.org>
Date: Sun,  8 Feb 2026 16:10:34 +0000 (UTC)
From: thorpej@me.com
Reply-To: thorpej@me.com
To: gnats-bugs@NetBSD.org
Subject: "expandtab" behaves counter-intuitively (and different from vim)
X-Send-Pr-Version: www-1.0
X-From4GNATS: "thorpej@me.com via gnats" <gnats-admin@NetBSD.org>

>Number:         59983
>Category:       bin
>Synopsis:       "expandtab" behaves counter-intuitively (and different from vim)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 08 16:15:01 +0000 2026
>Last-Modified:  Tue Feb 17 06:45:02 +0000 2026
>Originator:     Jason Thorpe
>Release:        NetBSD 10.99.10 (but 11 is the same)
>Organization:
Formatting Fanatics Anonymous
>Environment:
NetBSD the-ripe-vessel 10.99.10 NetBSD 10.99.10 (GENERIC) #68: Fri Nov 17 14:40:27 PST 2023  thorpej@the-ripe-vessel:/space/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
"expandtab" is documented as:

       expandtab, et [off]
              Prevent the use of <tab> characters in leading whitespace when
              shifting text, autoindenting, indenting with <control-T>, or
              outdenting with <control-D>.

This is different behavior from vim, for which <control-I> (i.e. <tab>) also applies.  As you know, vim is shipped as the "vi" on a pretty large number of systems, thus making NetBSD's behavior in this regard an outlier.

I think the documented behavior is counter-intuitive and "correct" only in the sense that it matches the documentation.  It leads to inconsistent indenting within a source file because <tab> is an easy (and natural) character to type, whereas <control-T> is not.  Furthermore, the setting is called "expandtab" and the key on the keyboard labeled "TAB" does not get the "expand" treatment.
>How-To-Repeat:
Edit a file.  Set "ts=2", "et", and "ai".  Create a line with a leading <tab> character and some text.  Hit return and let the editor auto-indent the next line and type some additional text.  Now, set "ts=8" and observe.

  oink
  snort

        oink
  snort

>Fix:
Yes please!

>Audit-Trail:
From: RVP <rvp@SDF.ORG>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/59983: "expandtab" behaves counter-intuitively (and different
 from vim)
Date: Tue, 17 Feb 2026 06:44:29 +0000 (UTC)

 Dup of PR bin/60010.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.