From: Job Snijders Subject: usr.bin/vi: add showfilename option To: tech@openbsd.org Date: Mon, 12 Feb 2024 15:33:10 +0000 Dear all, I usually have a few instances of vi open next to each other (using a window manager), and found pressing control-G all the time to understand 'what file is in what window' to be tedious. Instead, offer a configurable option (default off) to display the file name in the lower left corner. OK? Thoughts? Kind regards, Job Index: vi/common/options.c =================================================================== RCS file: /cvs/src/usr.bin/vi/common/options.c,v diff -u -p -r1.29 options.c --- vi/common/options.c 13 Apr 2021 15:39:21 -0000 1.29 +++ vi/common/options.c 12 Feb 2024 15:02:03 -0000 @@ -149,6 +149,8 @@ OPTLIST const optlist[] = { {"showmatch", NULL, OPT_0BOOL, 0}, /* O_SHOWMODE 4.4BSD */ {"showmode", NULL, OPT_0BOOL, 0}, +/* O_SHOWFILENAME */ + {"showfilename",NULL, OPT_0BOOL, 0}, /* O_SIDESCROLL 4.4BSD */ {"sidescroll", NULL, OPT_NUM, OPT_NOZERO}, /* O_TABSTOP 4BSD */ Index: vi/docs/USD.doc/vi.man/vi.1 =================================================================== RCS file: /cvs/src/usr.bin/vi/docs/USD.doc/vi.man/vi.1,v diff -u -p -r1.83 vi.1 --- vi/docs/USD.doc/vi.man/vi.1 29 Jan 2023 09:28:57 -0000 1.83 +++ vi/docs/USD.doc/vi.man/vi.1 12 Feb 2024 15:02:03 -0000 @@ -2500,6 +2500,10 @@ for and .Sq )\& characters. +.It Cm showfilename Bq off +.Nm vi +only. +Display the file name on the colon command line. .It Cm showmode , smd Bq off .Nm vi only. Index: vi/vi/vs_refresh.c =================================================================== RCS file: /cvs/src/usr.bin/vi/vi/vs_refresh.c,v diff -u -p -r1.22 vs_refresh.c --- vi/vi/vs_refresh.c 30 Jan 2016 21:31:08 -0000 1.22 +++ vi/vi/vs_refresh.c 12 Feb 2024 15:02:03 -0000 @@ -810,7 +810,7 @@ vs_modeline(SCR *sp) /* If more than one screen in the display, show the file name. */ curlen = 0; - if (IS_SPLIT(sp)) { + if (IS_SPLIT(sp) || O_ISSET(sp, O_SHOWFILENAME)) { for (p = sp->frp->name; *p != '\0'; ++p); for (ellipsis = 0, cols = sp->cols / 2; --p > sp->frp->name;) { if (*p == '/') {