From 0953bec8bded7e94a8de3fa8c35a6731bfea34d8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 17 Jun 2019 10:46:38 +1200 Subject: Update vim-quickfix-auto-open to v2.1.0 --- vim/bundle/quickfix_auto_open | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/bundle/quickfix_auto_open b/vim/bundle/quickfix_auto_open index b3b13854..eabaee82 160000 --- a/vim/bundle/quickfix_auto_open +++ b/vim/bundle/quickfix_auto_open @@ -1 +1 @@ -Subproject commit b3b1385490c60ad624d631b4cf99f84e058637b1 +Subproject commit eabaee82018c26c9e4ef4bd0f95ed55a7ef1c9d5 -- cgit v1.2.3 From 72bd527b9db0d370786153f542810e46cb5c3789 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 17 Jun 2019 16:15:51 +1200 Subject: Correct grec(1df) and gred(1df) manual pages --- man/man1/grec.1df | 2 +- man/man1/gred.1df | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man1/grec.1df b/man/man1/grec.1df index b1f70193..9916c6d5 100644 --- a/man/man1/grec.1df +++ b/man/man1/grec.1df @@ -8,7 +8,7 @@ PATTERN [FILE...] .br .SH DESCRIPTION .B grec -is the same as grep(1) when run with a a -c option, because the name always +is the same as grep(1) when run with its -c option, because the name always bugged me a bit--"g/re/p, except don't print it, count it"? .SH AUTHOR Tom Ryder diff --git a/man/man1/gred.1df b/man/man1/gred.1df index e3dbce87..74eb8561 100644 --- a/man/man1/gred.1df +++ b/man/man1/gred.1df @@ -8,7 +8,7 @@ PATTERN [FILE...] .br .SH DESCRIPTION .B gred -is the same as grep(1) when run with a a -v option, because the name always +is the same as grep(1) when run with its -v option, because the name always bugged me a bit--"g/re/p, except don't print it, delete it"? .SH AUTHOR Tom Ryder -- cgit v1.2.3 From 0d9e5ceab0835819cff27a348691c07b341557d7 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 17 Jun 2019 17:51:16 +1200 Subject: Simplify a vimrc compound conditional with get() --- vim/vimrc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 0fc9d24b..c0729408 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1009,10 +1009,7 @@ autocmd vimrc ColorScheme sahara " environment variable COLORFGBG or a response in v:termrbgresp that would set " it specifically. " -if !exists('$COLORFGBG') && ( - \ !exists('v:termrbgresp') - \ || v:termrbgresp ==# '' - \ ) +if !exists('$COLORFGBG') && get(v:, 'termrbgresp', '') ==# '' set background=dark endif -- cgit v1.2.3 From 7eedee00cadb3293f7c29e888b0afabe53340c41 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 17 Jun 2019 18:18:35 +1200 Subject: Use slightly more readable quoting for regexes --- vim/autoload/spellfile_local.vim | 4 ++-- vim/vimrc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vim/autoload/spellfile_local.vim b/vim/autoload/spellfile_local.vim index 081b2970..e4759737 100644 --- a/vim/autoload/spellfile_local.vim +++ b/vim/autoload/spellfile_local.vim @@ -1,14 +1,14 @@ function! s:SplitOption(string) abort return map( \ split(a:string, '\\\@ Date: Mon, 17 Jun 2019 23:24:12 +1200 Subject: Correct variable reference --- vim/autoload/spellfile_local.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/autoload/spellfile_local.vim b/vim/autoload/spellfile_local.vim index e4759737..f3d9b987 100644 --- a/vim/autoload/spellfile_local.vim +++ b/vim/autoload/spellfile_local.vim @@ -22,7 +22,7 @@ function! spellfile_local#() abort set spellfile< let spelllangs = s:SplitOption(&spelllang) - if !len(spelllangs) || &spelllang[0] ==# '' + if !len(spelllangs) || spelllangs[0] ==# '' echoerr 'Blank ''spelllang''' endif let spelllang = substitute(spelllangs[0], '_.*', '', '') -- cgit v1.2.3 From f08628015d664700b03812962540f01f2d1bc643 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 17 Jun 2019 23:31:49 +1200 Subject: Adjust comment --- vim/vimrc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 557df575..69bf6e3d 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -93,14 +93,13 @@ scriptencoding utf-8 " a map() over substitute(), string-eval style to accommodate older Vim before " Funcref variables were added. " -" We don't, however, have to deal with escaped backslashes, or any other -" character; you can read the source code for the ad-hoc tokenizer in -" copy_option_part() in src/misc2.c in Vim's source code and test it with some -" values of your own if you want to understand why. +" We don't, however, have to deal with backslashes before other backslashes, +" nor before any other character. You can read the source code for the ad-hoc +" tokenizer in copy_option_part() in src/misc2.c in Vim's source code, and +" test it with some values of your own, if you want to understand why. " -" I'll factor this out into a global function if I ever need it anywhere else. -" -" Vim, I love you, but you are really weird. +" I'll factor all of this mess out into a global function if I ever need it +" anywhere else. Vim, I love you, but you are really weird. " let s:runtimepath = map( \ split(&runtimepath, '\\\@ Date: Mon, 17 Jun 2019 23:58:43 +1200 Subject: Check for sahara.vim suitability more carefully --- vim/vimrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 69bf6e3d..10a3aafb 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1012,10 +1012,12 @@ if !exists('$COLORFGBG') && get(v:, 'termrbgresp', '') ==# '' set background=dark endif -" If the background seems to be dark, and my custom sahara.vim color scheme -" looks to be available, load it. +" If the background seems to be dark, and I have either the GUI or a 256 color +" terminal, and my custom sahara.vim color scheme looks to be available, load +" it. " if &background ==# 'dark' + \ && (has('gui_running') || &t_Co >= 256) \ && globpath(&runtimepath, 'colors/sahara.vim') !=# '' colorscheme sahara endif -- cgit v1.2.3 From 568a09a4f1c8948dbcb4f07f4f7fc5b59f6db9bc Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 18 Jun 2019 10:26:46 +1200 Subject: Continue faffing around with vimrc conditionals --- vim/vimrc | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 10a3aafb..68d30b59 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -118,7 +118,7 @@ endif " Firstly, MYVIM can't be an empty string. We need a real path. " -if $MYVIM ==# '' +if !strlen($MYVIM) echoerr 'Blank user runtime path' finish endif @@ -130,7 +130,7 @@ endif " :execute abstraction, but it's not really worth the extra complexity for " such a niche situation. " -if $MYVIM =~# ',' +if stridx($MYVIM, ',') != -1 echoerr 'Illegal comma in user runtime path' finish endif @@ -149,10 +149,8 @@ endif " " " -if $MYVIM =~# '\\' && ( - \ v:version < 701 - \ || v:version == 701 && !has('patch55') - \ ) +if stridx($MYVIM, '\') != -1 + \ && (v:version < 701 || v:version == 701 && !has('patch55')) echoerr 'Illegal backslash in user runtime path on Vim < v7.1.055' finish endif @@ -825,8 +823,7 @@ set shortmess+=I " plugin doesn't look like it's going to load, whether because plugins have " been disabled, or it's not in any of the plugin directories. " -if !&loadplugins - \ && globpath(&runtimepath, 'plugin/matchparen.vim') !=# '' +if !&loadplugins || !strlen(globpath(&runtimepath, 'plugin/matchparen.vim')) set showmatch matchtime=3 endif @@ -1008,7 +1005,7 @@ autocmd vimrc ColorScheme sahara " environment variable COLORFGBG or a response in v:termrbgresp that would set " it specifically. " -if !exists('$COLORFGBG') && get(v:, 'termrbgresp', '') ==# '' +if !exists('$COLORFGBG') && !strlen(get(v:, 'termrbgresp', '')) set background=dark endif @@ -1018,7 +1015,7 @@ endif " if &background ==# 'dark' \ && (has('gui_running') || &t_Co >= 256) - \ && globpath(&runtimepath, 'colors/sahara.vim') !=# '' + \ && strlen(globpath(&runtimepath, 'colors/sahara.vim')) colorscheme sahara endif @@ -1111,8 +1108,7 @@ nnoremap " If the plugin isn't available, I just abandon CTRL-C to continue its " uselessness. " -if &loadplugins - \ && globpath(&runtimepath, 'plugin/insert_cancel.vim') !=# '' +if &loadplugins && strlen(globpath(&runtimepath, 'plugin/insert_cancel.vim')) imap (InsertCancel) endif -- cgit v1.2.3 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 From fb68ccf09e53f0f639db243259d3a3f1db64644d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 18 Jun 2019 11:37:36 +1200 Subject: Have Vim respect POSIXLY_CORRECT --- vim/vimrc.stub.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vim/vimrc.stub.vim b/vim/vimrc.stub.vim index 1d8d3d9a..b5763f16 100644 --- a/vim/vimrc.stub.vim +++ b/vim/vimrc.stub.vim @@ -1,3 +1,9 @@ +" If POSIXLY_CORRECT is defined in the environment, we'll start compatible if +" we're not already planning to do so. +if exists('$POSIXLY_CORRECT') && !&compatible + set compatible +endif + " If we have non-tiny Vim version >=7, source real vimrc; this works because " tiny and/or ancient builds of Vim quietly ignore all code in :if blocks if v:version >= 700 && !&compatible -- cgit v1.2.3 From ade176cf6016bc909437ad242fb817f3d056688e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 18 Jun 2019 13:16:19 +1200 Subject: Don't spellcheck stuff that isn't actually HTML --- vim/after/ftplugin/html.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim index 93845a80..d9c0149c 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -1,5 +1,6 @@ -" Spellcheck documents we're actually editing (not just viewing) -if &modifiable && !&readonly +" Spellcheck documents we're actually editing (not just viewing), as long as +" they're actually HTML buffers and not just dotting this in +if &modifiable && !&readonly && &filetype ==# 'html' setlocal spell let b:undo_ftplugin .= '|setlocal spell<' endif -- cgit v1.2.3 From 9f4bcd834498004c5d0d17c4277f39dd64d2ea4d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 18 Jun 2019 13:16:26 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 439f4c34..35fc6507 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v6.23.0 -Sun, 16 Jun 2019 21:03:48 +0000 +tejr dotfiles v6.24.0 +Tue, 18 Jun 2019 01:16:26 +0000 -- cgit v1.2.3 From 6562b0986bb21e767ccd0bcda5d2418898591380 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 18 Jun 2019 13:16:28 +1200 Subject: Update dotfiles(7) manual page --- man/man7/dotfiles.7df | 2 ++ 1 file changed, 2 insertions(+) diff --git a/man/man7/dotfiles.7df b/man/man7/dotfiles.7df index e43c4f38..5eb551e7 100644 --- a/man/man7/dotfiles.7df +++ b/man/man7/dotfiles.7df @@ -927,6 +927,8 @@ via \f[C]vex(1df)\f[]. \f[C]vex(1df)\f[] runs a command and prints \f[C]true\f[] or \f[C]false\f[] explicitly to \f[C]stdout\f[] based on the exit value. .IP \[bu] 2 +\f[C]vic(1df)\f[] tries to run a POSIX\-compliant \f[C]vi(1)\f[]. +.IP \[bu] 2 \f[C]xrbg(1df)\f[] applies the same randomly\-selected background to each X screen. .IP \[bu] 2 -- cgit v1.2.3