From 9f7bebb200e3b67a5a3ae26bd2c6789a81f1a286 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 18 Jun 2019 11:35:54 +1200 Subject: Add vic(1df) --- .gitignore | 1 + Makefile | 1 + README.md | 1 + bin/vic.sh | 6 ++++++ man/man1/vic.1df | 11 +++++++++++ 5 files changed, 20 insertions(+) create mode 100644 bin/vic.sh create mode 100644 man/man1/vic.1df diff --git a/.gitignore b/.gitignore index 67cae516..825395b3 100644 --- a/.gitignore +++ b/.gitignore @@ -145,6 +145,7 @@ /bin/uts /bin/vest /bin/vex +/bin/vic /bin/wro /bin/xgo /bin/xgoc diff --git a/Makefile b/Makefile index 4be00a3a..889a780c 100644 --- a/Makefile +++ b/Makefile @@ -220,6 +220,7 @@ BINS = bin/ap \ bin/uts \ bin/vest \ bin/vex \ + bin/vic \ bin/wro \ bin/xgo \ bin/xgoc \ diff --git a/README.md b/README.md index 6b3b5dad..bb095c3c 100644 --- a/README.md +++ b/README.md @@ -584,6 +584,7 @@ Installed by the `install-bin` target: * `vest(1df)` runs `test(1)` but fails with explicit output via `vex(1df)`. * `vex(1df)` runs a command and prints `true` or `false` explicitly to `stdout` based on the exit value. +* `vic(1df)` tries to run a POSIX-compliant `vi(1)`. * `xrbg(1df)` applies the same randomly-selected background to each X screen. * `xrq(1df)` gets the values of specific resources out of `xrdb -query` output. diff --git a/bin/vic.sh b/bin/vic.sh new file mode 100644 index 00000000..c1967ef1 --- /dev/null +++ b/bin/vic.sh @@ -0,0 +1,6 @@ +# If the system vi is Vim, start it with -C for 'compatible' +ver=$(vim --version 2>/dev/null | awk '{print $1;exit}') +case $ver in + (VIM) vim -C "$@" ;; + (*) vi "$@" ;; +esac diff --git a/man/man1/vic.1df b/man/man1/vic.1df new file mode 100644 index 00000000..e7aae6e2 --- /dev/null +++ b/man/man1/vic.1df @@ -0,0 +1,11 @@ +.TH VIC 1df "June 2019" "Manual page for vic" +.SH NAME +.B vic +\- run a compatible vi +.SH DESCRIPTION +.B vic +checks the system implementation of vi(1) to see whether it's Vim. If it is, +it starts it with `vim -C` to turn the 'compatible' option on. If it isn't, it +just runs `vi`. +.SH AUTHOR +Tom Ryder -- cgit v1.2.3