Discussion:
new nvi option: expandtab
(too old to reply)
Luke Mewburn
2008-12-10 00:35:40 UTC
Permalink
--vAr1W/eR4LdSeo08
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi folks.

I've been experimenting with a new option to nvi:

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>.

I find this more useful than prefiltering with expand(1) and
then setting tabstop to a large value to avoid the "optimization"
to tabs that ^T, ^D, < or > perform.
I would rather not have to change tabstop like this; for a variety of
reasons I find that leaving tabstop at 8 is sensible practice.

Currently, my modification doesn't alter the behaviour of <tab>
in insert mode; it still inserts \t. Changing this is a fair bit
trickier; I don't use <tab> anyway, since I have shiftwidth
set to a different value to tabstop.

(I originally called it "expandtabs", then noticed that vim(1)
has an "expandtab" option that sets similar behaviour.)


thoughts?

Luke.

--vAr1W/eR4LdSeo08
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (NetBSD)

iEYEARECAAYFAkk/DrkACgkQpBhtmn8zJHLDaACgkxGoaldcWk+l8wJxeAmbkcd9
W1kAn2d3IhKyBHt9sDkWWbl5zv+FNzQq
=TBzu
-----END PGP SIGNATURE-----

--vAr1W/eR4LdSeo08--
Arnaud Lacombe
2008-12-10 01:25:19 UTC
Permalink
Post by Luke Mewburn
(I originally called it "expandtabs", then noticed that vim(1)
has an "expandtab" option that sets similar behaviour.)
thoughts?
is it needed to add bloat to the base system ? I mean, if someone
want's to expand tab or other fancy stuff, he can always install
vim(1).

The underlying question would be "Do we want nvi to concurrence vim(1)
feature-wise or do we want to keep something minimal, enough for
everyday administration task ?"

- Arnaud
Martin S. Weber
2008-12-10 02:32:06 UTC
Permalink
Post by Arnaud Lacombe
Post by Luke Mewburn
(I originally called it "expandtabs", then noticed that vim(1)
has an "expandtab" option that sets similar behaviour.)
thoughts?
is it needed to add bloat to the base system ? I mean, if someone
want's to expand tab or other fancy stuff, he can always install
vim(1).
I like NetBSD's base vi for its slim featurefulness. It feels very
much superior to vim (although I'm aware that technically it's not.
Had I split windows in nvi though I'd not use vim at all) to me.
Post by Arnaud Lacombe
The underlying question would be "Do we want nvi to concurrence vim(1)
feature-wise or do we want to keep something minimal, enough for
everyday administration task ?"
Imo it's not just bare bones/minimal but 'good enough' and sufficient for
everyday use (not only administration).

Regards,

-Martin
Luke Mewburn
2008-12-10 02:50:15 UTC
Permalink
--yoJ+tVrWAGi8fpuI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Dec 09, 2008 at 09:31:50PM -0500, Martin S. Weber wrote:
| Had I split windows in nvi though I'd not use vim at all

nvi has had split screen functionality for at least 15 years.

--yoJ+tVrWAGi8fpuI
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (NetBSD)

iEYEARECAAYFAkk/Ll0ACgkQpBhtmn8zJHImdgCdGzQEGgfva/iGNwk+umLpyXtR
PW8AniRKwAm06R6Fa0Aa7zRGiAnYf1DT
=R+2S
-----END PGP SIGNATURE-----

--yoJ+tVrWAGi8fpuI--
Martin S. Weber
2008-12-10 03:03:47 UTC
Permalink
Post by Luke Mewburn
| Had I split windows in nvi though I'd not use vim at all
nvi has had split screen functionality for at least 15 years.
Okay, I'm overreading how to invoke it in its documentation for
at least half of that time, then. *embarrassed*

-Martin
Luke Mewburn
2008-12-10 06:29:44 UTC
Permalink
--crFW2+mWrWMXeHsA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Dec 09, 2008 at 08:25:07PM -0500, Arnaud Lacombe wrote:
| On Tue, Dec 9, 2008 at 7:35 PM, Luke Mewburn <***@netbsd.org> wrote:
| > (I originally called it "expandtabs", then noticed that vim(1)
| > has an "expandtab" option that sets similar behaviour.)
| >
| > thoughts?
|
| is it needed to add bloat to the base system ?

Just over 2 KiB extra isn't "bloat":

size /usr/bin/vi build/vi
text data bss dec hex filename
328630 2780 2848 334258 519b2 /usr/bin/vi
330831 2788 2848 336467 52253 build/vi

(As a comparison, vim on a Linux FC8 i386 box is 1725578 bytes)

| always install vim(1).

That sort of claim --
"don't add [small yet useful] features to a base tool inspired by
a third-party product; install third-party product instead"
could be used for most changes made to NetBSD.
It serves as a good emotive diversion, no more.

Many of the features I've added over the years to NetBSD have been
inspired from elsewhere. In general, I've received nothing but
overwhelming support for adding such features.


| The underlying question would be "Do we want nvi to concurrence vim(1)
| feature-wise or do we want to keep something minimal, enough for
| everyday administration task ?"

"Real men edit files with ed(1) [cat(1). toggle switches] ?"

nvi has many features over "traditional" vi, including split screen editing.
Are they mandatory? Arguably no.
Are they useful? Yes.
Did they increase the code size? Yes.


This was a feature that I've wanted for a long time.
I solicited private feedback, and only got "yes please" responses.
I implemented a proof of concept.
I then checked elsewhere and discovered that vim implemented a similar
feature; hence my reference to vim's name of a similar feature.
(I don't use vim myself.)

--crFW2+mWrWMXeHsA
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (NetBSD)

iEYEARECAAYFAkk/YcwACgkQpBhtmn8zJHJJOwCfZ54yInU/sjjpVoBYsXdO4SGv
HKoAn3KxVUsseBeU4H43dXfk92BbWfX9
=1zCV
-----END PGP SIGNATURE-----

--crFW2+mWrWMXeHsA--
Arnaud Lacombe
2008-12-10 07:10:17 UTC
Permalink
Post by Luke Mewburn
| > (I originally called it "expandtabs", then noticed that vim(1)
| > has an "expandtab" option that sets similar behaviour.)
| >
| > thoughts?
|
| is it needed to add bloat to the base system ?
keep adding KiB and you get MiB ...
Post by Luke Mewburn
size /usr/bin/vi build/vi
text data bss dec hex filename
328630 2780 2848 334258 519b2 /usr/bin/vi
330831 2788 2848 336467 52253 build/vi
(As a comparison, vim on a Linux FC8 i386 box is 1725578 bytes)
| always install vim(1).
That sort of claim --
"don't add [small yet useful] features to a base tool inspired by
the "[small yet useful]" is purely subjective and emotive diversion too :)
Post by Luke Mewburn
a third-party product; install third-party product instead"
could be used for most changes made to NetBSD.
It serves as a good emotive diversion, no more.
I don't like to reinvent the wheel, or at least, try not to.
Post by Luke Mewburn
Many of the features I've added over the years to NetBSD have been
inspired from elsewhere. In general, I've received nothing but
overwhelming support for adding such features.
| The underlying question would be "Do we want nvi to concurrence vim(1)
| feature-wise or do we want to keep something minimal, enough for
| everyday administration task ?"
"Real men edit files with ed(1) [cat(1). toggle switches] ?"
Then I'm not.
Post by Luke Mewburn
nvi has many features over "traditional" vi, including split screen editing.
Are they mandatory? Arguably no.
Are they useful? Yes.
Did they increase the code size? Yes.
Is there a switch to build a *minimal* vi(1), AFAIK, no, so it makes
those features mandatory, not optional. If there is a compile-time
switch to get a minimal vi, and that added code have no cost on the
mandatory part, then fine.
Post by Luke Mewburn
This was a feature that I've wanted for a long time.
I solicited private feedback, and only got "yes please" responses.
Sorry for not following the crowd :/ you asked for thoughts, I gave
you mine, period.

I'll stop feeding the editor troll here ;-)

- Arnaud
Roy Marples
2008-12-10 08:02:17 UTC
Permalink
--=-7fbLpogvE528Mtkmp50O
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Post by Arnaud Lacombe
Post by Luke Mewburn
(I originally called it "expandtabs", then noticed that vim(1)
has an "expandtab" option that sets similar behaviour.)
thoughts?
is it needed to add bloat to the base system ? I mean, if someone
want's to expand tab or other fancy stuff, he can always install
vim(1).
I would argue that text editior features a lot of people find useful
out-weigh a few K increase for something in base system.
Post by Arnaud Lacombe
=20
The underlying question would be "Do we want nvi to concurrence vim(1)
feature-wise or do we want to keep something minimal, enough for
everyday administration task ?"
Once nvi has vim's visual mode editing so I can trivially move chunks
text around or run a regex on a specific block easily then I'd say it's
good enough for everyday administrative tasks.

I use vim extensively and can live without syntax highlighting and a
nice status bar telling me what line/col I'm at but I just can't work
without visual mode. It's just too useful :)

On another note - will we ever see a nvi that works with a
missing/invalid/broken $TERM setting?

Thanks

Roy

--=-7fbLpogvE528Mtkmp50O
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (NetBSD)

iQEcBAABAgAGBQJJP3dpAAoJEFl/l+qa1FVJNVYH/R1UBU9cUoA4EEmzhcg4NUKB
jMUPeGNA7YWFPuEqAzZ9630AK0+/f4h3JZl7+CvZSIuPSZkfTCCGtdOyapyAh/41
nnACl1OlE1BlCbc1hYpu2Uu69f8thwIAkqWotHdPgGK0YtV2Y1pr2nog4bN8GD3d
Pb3U7JcVp+bTFT/cOr5mW1VjtOMPY0bAbvLh1TLZlyi/71Z9GHkkQs558SfIgcvh
T+r+UJ2eLe2yCOeUI6QgIMXbFgvL+ZbrylqPcAde/SlH7xlapy+dfIr41VEKxaQc
iX3z+yuRyDbKkn41Gw7IkHc61XQGtAx4JZ0LH23L8f91okgKyRKhue3/LpnVAew=
=pjJF
-----END PGP SIGNATURE-----

--=-7fbLpogvE528Mtkmp50O--
Alan Barrett
2008-12-10 08:15:32 UTC
Permalink
Post by Luke Mewburn
expandtab, et [off]
Yes please!
Post by Luke Mewburn
Currently, my modification doesn't alter the behaviour of <tab>
in insert mode; it still inserts \t. Changing this is a fair bit
trickier; I don't use <tab> anyway, since I have shiftwidth
set to a different value to tabstop.
I think it would be more useful if <tab> inserted the correct number of
spaces to get to the next multiple of tabstop columns, but the feature
is useful even without that.
Post by Luke Mewburn
(I originally called it "expandtabs", then noticed that vim(1)
has an "expandtab" option that sets similar behaviour.)
"expandtabs" or "tabexpand" would be better names than "expandtab", but
compatibility with other implementations trumps that.

--apb (Alan Barrett)
Peter Bex
2008-12-10 08:31:27 UTC
Permalink
--veXX9dWIonWZEC6h
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Post by Roy Marples
Once nvi has vim's visual mode editing so I can trivially move chunks
text around or run a regex on a specific block easily then I'd say it's
good enough for everyday administrative tasks.
I'd argue against this feature because it's already in nvi: you can go
to line A, press "m" followed by "a", then go to line B and press "m"
followed by "b" and enter the following ex command:

:'a,'bs/foo/bar/

The step of marking B isn't even required; you can mark point A and then
set your cursor to line B and enter the command

:'a,s/foo/bar/

By leaving the location empty in the range specification, vi will know
you mean the current cursor position.
Post by Roy Marples
I use vim extensively and can live without syntax highlighting and a
nice status bar telling me what line/col I'm at
The "status bar" is also there in nvi, use :set ruler
Post by Roy Marples
but I just can't work without visual mode. It's just too useful :)
I think it's a reasonably nice convenience function, but not essential,
as everything's there as I described above.
The only thing that vim can do with visual mode that I don't know how
to do with nvi is "rectangular select", but I suppose that's one of those
"fancy features" that shouldn't go into nvi. I don't think it's needed
very often, either.
Post by Roy Marples
On another note - will we ever see a nvi that works with a
missing/invalid/broken $TERM setting?
Does vim work with missing/broken $TERM? How does it know what terminal
type you're on? Does it make a guess?

A useful addition to nvi that would really work would be to fall back to
ex mode when TERM is not set, with a warning.

Cheers,
Peter
--=20
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth

--veXX9dWIonWZEC6h
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (NetBSD)

iQEVAwUBST9/ItOrBFwYag3gAQKMIwf/V+MAg2S0sSr5e+LOW6/rcRQPnUqAX85j
Nb7A5CiNuwdtlbOQTLVBEchdq4MiQBu8qj1pcfkwFs74nRRHlBe6C6wbECQ79ImU
OaodGF2IHEf7XkCrBJc7awRplHyh0k+P4LsIjEAx6s2L/U97ZXgYNrmV2YJilrNt
J7OrM0woaEsMM27X0T/SSJ3eJ1sKOWzmp9A6jJ4PulqkObQevzeykpKD86/248J/
DuxYUU2dN1cJWLZp5LX8iRP3tcCWMrsbwRz1+cDTg9pNmrvUqWg5C1kOTkFGbgfT
6kvwei4q0A4JIEDpnNRvNnNxd55oeqe6OAtGGda9uifKV/8Blt/pwg==
=FMC1
-----END PGP SIGNATURE-----

--veXX9dWIonWZEC6h--
Thomas Dickey
2008-12-10 11:55:40 UTC
Permalink
--ReaqsoxgOBHFXBhH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Post by Peter Bex
Does vim work with missing/broken $TERM? How does it know what terminal
type you're on? Does it make a guess?
it has (part of the bloat) a built-in set of termcaps.

--=20
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net

--ReaqsoxgOBHFXBhH
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (SunOS)
Comment: For info see http://www.gnupg.org

iD8DBQFJP64ttIqByHxlDocRAo1BAJ4hYnboImeMkZqvFl5HPbGVgQRg0wCeNBmw
9pubP6P1+RsZupIbKxFTLoY=
=T1Q7
-----END PGP SIGNATURE-----

--ReaqsoxgOBHFXBhH--
Peter Bex
2008-12-10 12:06:01 UTC
Permalink
--+JUInw4efm7IfTNU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Post by Thomas Dickey
Post by Peter Bex
Does vim work with missing/broken $TERM? How does it know what terminal
type you're on? Does it make a guess?
=20
it has (part of the bloat) a built-in set of termcaps.
Knowing the capabilities of different terminals doesn't mean it knows
which capabilities to make use of, right? (that would be selected
by $TERM)

Cheers,
Peter
--=20
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth

--+JUInw4efm7IfTNU
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (NetBSD)

iQEVAwUBST+xhNOrBFwYag3gAQI+Qgf/Tg4apMQG+ioCLPjoLG79yN6VPqHms4Tg
sjR1hyQauGZ6++ppnrC1vj3dyKvCxRg8lVNQ4m4x8sBx4EZOTqIBrT55sa+ws+A6
7i5kLHu6Z2dtklR4kLORmz6dR9yLT5x8L6RYvyrybcvfVe9TJ8h+3fNEjbgBwopU
/rcxm+NqZPtkggAI7EIzfko1mHERviN9YMOfU5RrD4/gXbE9pnxZPMddiEGCp+Hh
WA7gman1f9oKXg/DGLiCjYRkUEk9Wqfhm9Ty+wMwMbmlxg4JxD55lD8o1LwT3MWK
LD540iAOukJQlDdqq367hfxArxFi+jv6NFR4iRJ4W+oZl9KnL78jAQ==
=zUU8
-----END PGP SIGNATURE-----

--+JUInw4efm7IfTNU--
der Mouse
2008-12-10 16:56:08 UTC
Permalink
Post by Thomas Dickey
Post by Peter Bex
Does vim work with missing/broken $TERM?
it has (part of the bloat) a built-in set of termcaps.
That sounds to me more like a patchover for a missing/broken $TERMCAP.
With a missing/broken $TERM, how does it know which one to use?

/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML ***@rodents-montreal.org
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B

Loading...