aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-18 11:35:54 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-18 11:35:54 +1200
commit9f7bebb200e3b67a5a3ae26bd2c6789a81f1a286 (patch)
treed2ba1b2243ed89b9b1fb91adf58ea68272e34499
parentContinue faffing around with vimrc conditionals (diff)
downloaddotfiles-9f7bebb200e3b67a5a3ae26bd2c6789a81f1a286.tar.gz
dotfiles-9f7bebb200e3b67a5a3ae26bd2c6789a81f1a286.zip
Add vic(1df)
-rw-r--r--.gitignore1
-rw-r--r--Makefile1
-rw-r--r--README.md1
-rw-r--r--bin/vic.sh6
-rw-r--r--man/man1/vic.1df11
5 files changed, 20 insertions, 0 deletions
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 <tom@sanctum.geek.nz>