mirror of
https://git.freebsd.org/src.git
synced 2026-01-11 19:57:22 +00:00
nvi: import version 2.2.1-52c07e8
This commit is contained in:
commit
4087ffdbce
7 changed files with 69 additions and 55 deletions
|
|
@ -37,7 +37,6 @@ if (NOT APPLE)
|
|||
endif()
|
||||
add_compile_options($<$<CONFIG:Release>:-Wuninitialized>)
|
||||
add_compile_options($<$<CONFIG:Release>:-Wno-dangling-else>)
|
||||
add_compile_options(-Wno-string-compare)
|
||||
add_compile_options(-Wstack-protector -fstack-protector)
|
||||
add_compile_options(-Wstrict-aliasing -fstrict-aliasing)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include <db.h>
|
||||
#endif
|
||||
#include <regex.h> /* May refer to the bundled regex. */
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Forward structure declarations. Not pretty, but the include files
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
#include <fcntl.h>
|
||||
#include <libgen.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
|
|||
|
|
@ -181,6 +181,8 @@ OPTLIST const optlist[] = {
|
|||
{L("shellmeta"), NULL, OPT_STR, 0},
|
||||
/* O_SHIFTWIDTH 4BSD */
|
||||
{L("shiftwidth"), NULL, OPT_NUM, OPT_NOZERO},
|
||||
/* O_SHOWFILENAME */
|
||||
{L("showfilename"), NULL, OPT_0BOOL, 0},
|
||||
/* O_SHOWMATCH 4BSD */
|
||||
{L("showmatch"), NULL, OPT_0BOOL, 0},
|
||||
/* O_SHOWMODE 4.4BSD */
|
||||
|
|
@ -317,7 +319,7 @@ opts_init(SCR *sp, int *oargs)
|
|||
/* Set numeric and string default values. */
|
||||
#define OI(indx, str) do { \
|
||||
a.len = STRLEN(str); \
|
||||
if ((CHAR_T*)str != b2) /* GCC puts strings in text-space. */ \
|
||||
if (STRCMP((CHAR_T*)str, b2) != 0) \
|
||||
(void)MEMCPY(b2, str, a.len+1); \
|
||||
if (opts_set(sp, argv, NULL)) { \
|
||||
optindx = indx; \
|
||||
|
|
|
|||
|
|
@ -12,11 +12,13 @@
|
|||
.\" that you would have purchased it, or if any company wishes to
|
||||
.\" redistribute it, contributions to the authors would be appreciated.
|
||||
.\"
|
||||
.Dd September 25, 2020
|
||||
.Dd April 18, 2024
|
||||
.Dt VI 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm ex , vi , view
|
||||
.Nm ex ,
|
||||
.Nm vi ,
|
||||
.Nm view
|
||||
.Nd text editors
|
||||
.Sh SYNOPSIS
|
||||
.Nm ex
|
||||
|
|
@ -302,7 +304,7 @@ Quit editing and leave
|
|||
(if you've modified the file, but not saved your changes,
|
||||
.Nm vi
|
||||
will refuse to quit).
|
||||
.It Cm :q!
|
||||
.It Cm :q\&!
|
||||
Quit, discarding any modifications that you may have made.
|
||||
.El
|
||||
.Pp
|
||||
|
|
@ -706,7 +708,7 @@ Execute the
|
|||
.Nm ex
|
||||
command being entered, or cancel it if it is only partial.
|
||||
.Pp
|
||||
.It Aq Cm control-]
|
||||
.It Aq Cm control-\(rB
|
||||
Push a tag reference onto the tag stack.
|
||||
.Pp
|
||||
.It Aq Cm control-\(ha
|
||||
|
|
@ -830,7 +832,7 @@ or
|
|||
to the position of the cursor before the last of the following commands:
|
||||
.Aq Cm control-A ,
|
||||
.Aq Cm control-T ,
|
||||
.Aq Cm control-] ,
|
||||
.Aq Cm control-\(rB ,
|
||||
.Cm % ,
|
||||
.Cm \(aq ,
|
||||
.Cm \` ,
|
||||
|
|
@ -1809,8 +1811,8 @@ Display buffers, Cscope connections, screens or tags.
|
|||
.Op Ar +cmd
|
||||
.Op Ar file
|
||||
.Xc
|
||||
Edit a different file. The capitalized command opens a new screen below the
|
||||
current screen.
|
||||
Edit a different file.
|
||||
The capitalized command opens a new screen below the current screen.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Cm exu Ns Op Cm sage
|
||||
|
|
@ -1833,8 +1835,8 @@ Display and optionally change the file name.
|
|||
.Xc
|
||||
.Nm vi
|
||||
mode only.
|
||||
Foreground the specified screen. The capitalized command opens a new screen
|
||||
below the current screen.
|
||||
Foreground the specified screen.
|
||||
The capitalized command opens a new screen below the current screen.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Op Ar range
|
||||
|
|
@ -1921,8 +1923,8 @@ Write the abbreviations, editor options and maps to the specified
|
|||
.Op Cm !\&
|
||||
.Op Ar
|
||||
.Xc
|
||||
Edit the next file from the argument list. The capitalized command opens a
|
||||
new screen below the current screen.
|
||||
Edit the next file from the argument list.
|
||||
The capitalized command opens a new screen below the current screen.
|
||||
.\" .Pp
|
||||
.\" .It Xo
|
||||
.\" .Op Ar line
|
||||
|
|
@ -1943,8 +1945,8 @@ option.
|
|||
.Cm rev Ns Op Cm ious Ns
|
||||
.Op Cm !\&
|
||||
.Xc
|
||||
Edit the previous file from the argument list. The capitalized command opens
|
||||
a new screen below the current screen.
|
||||
Edit the previous file from the argument list.
|
||||
The capitalized command opens a new screen below the current screen.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Op Ar range
|
||||
|
|
@ -2107,8 +2109,8 @@ character is usually
|
|||
.Op Cm !\&
|
||||
.Ar tagstring
|
||||
.Xc
|
||||
Edit the file containing the specified tag. The capitalized command opens a
|
||||
new screen below the current screen.
|
||||
Edit the file containing the specified tag.
|
||||
The capitalized command opens a new screen below the current screen.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Cm tagn Ns Op Cm ext Ns
|
||||
|
|
@ -2178,8 +2180,8 @@ Enter
|
|||
.Op Ar file
|
||||
.Xc
|
||||
.Nm vi
|
||||
mode only. Edit a different file by opening a new screen below the current
|
||||
screen.
|
||||
mode only.
|
||||
Edit a different file by opening a new screen below the current screen.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Cm viu Ns Op Cm sage
|
||||
|
|
@ -2226,7 +2228,8 @@ Write the entire file, or
|
|||
.Sq !\&
|
||||
overwrites a different, preexisting file.
|
||||
.Sq >>
|
||||
appends to a file that may preexist. Whitespace followed by
|
||||
appends to a file that may preexist.
|
||||
Whitespace followed by
|
||||
.Sq !\&
|
||||
pipes the file to
|
||||
.Ar shell-command .
|
||||
|
|
@ -2479,7 +2482,7 @@ Set the number of lines about which the editor reports changes or yanks.
|
|||
.It Cm ruler Bq off
|
||||
.Nm vi
|
||||
only.
|
||||
Display a row/column ruler on the colon command line.
|
||||
Display a row/column/percentage ruler on the colon command line.
|
||||
.It Cm scroll , scr Bq "window size / 2"
|
||||
Set the number of lines scrolled.
|
||||
.It Cm searchincr Bq off
|
||||
|
|
@ -2505,6 +2508,10 @@ Set the meta characters checked to determine if file name expansion
|
|||
is necessary.
|
||||
.It Cm shiftwidth , sw Bq 8
|
||||
Set the autoindent and shift command indentation width.
|
||||
.It Cm showfilename Bq off
|
||||
.Nm vi
|
||||
only.
|
||||
Display the file name on the colon command line.
|
||||
.It Cm showmatch , sm Bq off
|
||||
.Nm vi
|
||||
only.
|
||||
|
|
@ -2773,10 +2780,8 @@ and \*(Gt0 if an error occurs.
|
|||
.Xr ctags 1 ,
|
||||
.Xr iconv 1 ,
|
||||
.Xr re_format 7
|
||||
.Rs
|
||||
.%T vi/ex reference manual
|
||||
.%U https://docs.freebsd.org/44doc/usd/13.viref/paper.pdf
|
||||
.Re
|
||||
.Pp
|
||||
.Lk https://docs.freebsd.org/44doc/usd/13.viref/paper.pdf "Vi/Ex Reference Manual"
|
||||
.Sh STANDARDS
|
||||
.Nm nex Ns / Ns Nm nvi
|
||||
is close to
|
||||
|
|
|
|||
|
|
@ -774,7 +774,8 @@ vs_modeline(SCR *sp)
|
|||
size_t cols, curcol, curlen, endpoint, len, midpoint;
|
||||
const char *t = NULL;
|
||||
int ellipsis;
|
||||
char buf[20];
|
||||
char buf[30];
|
||||
recno_t last;
|
||||
|
||||
gp = sp->gp;
|
||||
|
||||
|
|
@ -795,7 +796,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)) {
|
||||
CHAR_T *wp, *p;
|
||||
size_t l;
|
||||
|
||||
|
|
@ -846,8 +847,14 @@ vs_modeline(SCR *sp)
|
|||
cols = sp->cols - 1;
|
||||
if (O_ISSET(sp, O_RULER)) {
|
||||
vs_column(sp, &curcol);
|
||||
len = snprintf(buf, sizeof(buf), "%lu,%lu",
|
||||
(u_long)sp->lno, (u_long)(curcol + 1));
|
||||
|
||||
if (db_last(sp, &last) || last == 0)
|
||||
len = snprintf(buf, sizeof(buf), "%lu,%zu",
|
||||
(u_long)sp->lno, curcol + 1);
|
||||
else
|
||||
len = snprintf(buf, sizeof(buf), "%lu,%zu %lu%%",
|
||||
(u_long)sp->lno, curcol + 1,
|
||||
(u_long)(sp->lno * 100) / last);
|
||||
|
||||
midpoint = (cols - ((len + 1) / 2)) / 2;
|
||||
if (curlen < midpoint) {
|
||||
|
|
|
|||
|
|
@ -58,28 +58,29 @@
|
|||
#define O_SHELL 57
|
||||
#define O_SHELLMETA 58
|
||||
#define O_SHIFTWIDTH 59
|
||||
#define O_SHOWMATCH 60
|
||||
#define O_SHOWMODE 61
|
||||
#define O_SIDESCROLL 62
|
||||
#define O_SLOWOPEN 63
|
||||
#define O_SOURCEANY 64
|
||||
#define O_TABSTOP 65
|
||||
#define O_TAGLENGTH 66
|
||||
#define O_TAGS 67
|
||||
#define O_TERM 68
|
||||
#define O_TERSE 69
|
||||
#define O_TILDEOP 70
|
||||
#define O_TIMEOUT 71
|
||||
#define O_TTYWERASE 72
|
||||
#define O_VERBOSE 73
|
||||
#define O_W1200 74
|
||||
#define O_W300 75
|
||||
#define O_W9600 76
|
||||
#define O_WARN 77
|
||||
#define O_WINDOW 78
|
||||
#define O_WINDOWNAME 79
|
||||
#define O_WRAPLEN 80
|
||||
#define O_WRAPMARGIN 81
|
||||
#define O_WRAPSCAN 82
|
||||
#define O_WRITEANY 83
|
||||
#define O_OPTIONCOUNT 84
|
||||
#define O_SHOWFILENAME 60
|
||||
#define O_SHOWMATCH 61
|
||||
#define O_SHOWMODE 62
|
||||
#define O_SIDESCROLL 63
|
||||
#define O_SLOWOPEN 64
|
||||
#define O_SOURCEANY 65
|
||||
#define O_TABSTOP 66
|
||||
#define O_TAGLENGTH 67
|
||||
#define O_TAGS 68
|
||||
#define O_TERM 69
|
||||
#define O_TERSE 70
|
||||
#define O_TILDEOP 71
|
||||
#define O_TIMEOUT 72
|
||||
#define O_TTYWERASE 73
|
||||
#define O_VERBOSE 74
|
||||
#define O_W1200 75
|
||||
#define O_W300 76
|
||||
#define O_W9600 77
|
||||
#define O_WARN 78
|
||||
#define O_WINDOW 79
|
||||
#define O_WINDOWNAME 80
|
||||
#define O_WRAPLEN 81
|
||||
#define O_WRAPMARGIN 82
|
||||
#define O_WRAPSCAN 83
|
||||
#define O_WRITEANY 84
|
||||
#define O_OPTIONCOUNT 85
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue