diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | bin/vic.sh | 6 | ||||
-rw-r--r-- | man/man1/grec.1df | 2 | ||||
-rw-r--r-- | man/man1/gred.1df | 2 | ||||
-rw-r--r-- | man/man1/vic.1df | 11 | ||||
-rw-r--r-- | man/man7/dotfiles.7df | 2 | ||||
-rw-r--r-- | vim/after/ftplugin/html.vim | 5 | ||||
-rw-r--r-- | vim/autoload/spellfile_local.vim | 6 | ||||
m--------- | vim/bundle/quickfix_auto_open | 0 | ||||
-rw-r--r-- | vim/vimrc | 44 | ||||
-rw-r--r-- | vim/vimrc.stub.vim | 6 |
14 files changed, 57 insertions, 34 deletions
@@ -145,6 +145,7 @@ /bin/uts /bin/vest /bin/vex +/bin/vic /bin/wro /bin/xgo /bin/xgoc @@ -220,6 +220,7 @@ BINS = bin/ap \ bin/uts \ bin/vest \ bin/vex \ + bin/vic \ bin/wro \ bin/xgo \ bin/xgoc \ @@ -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. @@ -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 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/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 <tom@sanctum.geek.nz> 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 <tom@sanctum.geek.nz> 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> 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 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 diff --git a/vim/autoload/spellfile_local.vim b/vim/autoload/spellfile_local.vim index 081b2970..f3d9b987 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, '\\\@<!,[, ]*') - \,"substitute(v:val, '\\\\,', '', 'g')" + \,'substitute(v:val, ''\\,'', '''', ''g'')' \) endfunction function! s:JoinOption(list) abort return join(map( \ a:list - \,"substitute(v:val, '\\\\\\@<!,', '\\\\,', 'g')" + \,'substitute(v:val, ''\\\@<!,'', ''\\,'', ''g'')' \), ',') endfunction @@ -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], '_.*', '', '') diff --git a/vim/bundle/quickfix_auto_open b/vim/bundle/quickfix_auto_open -Subproject b3b1385490c60ad624d631b4cf99f84e058637b +Subproject eabaee82018c26c9e4ef4bd0f95ed55a7ef1c9d @@ -93,18 +93,17 @@ 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, '\\\@<!,[, ]*') - \,"substitute(v:val, '\\\\,', '', 'g')" + \,'substitute(v:val, ''\\,'', '''', ''g'')' \) if !exists('$MYVIM') let $MYVIM = s:runtimepath[0] @@ -119,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 @@ -131,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 @@ -150,10 +149,8 @@ endif " " <https://github.com/vim/vim/releases/tag/v7.1.055> " -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 @@ -826,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 @@ -1009,18 +1005,17 @@ 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') && !strlen(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' - \ && globpath(&runtimepath, 'colors/sahara.vim') !=# '' + \ && (has('gui_running') || &t_Co >= 256) + \ && strlen(globpath(&runtimepath, 'colors/sahara.vim')) colorscheme sahara endif @@ -1113,8 +1108,7 @@ nnoremap <expr> <Space> " 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 <C-C> <Plug>(InsertCancel) endif 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 |