diff options
-rw-r--r-- | 3 | 219 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | vim/after/ftplugin/sh.vim | 3 | ||||
-rw-r--r-- | vim/after/syntax/sh.vim | 12 | ||||
m--------- | vim/bundle/juvenile | 0 | ||||
m--------- | vim/bundle/perl_version_bump | 0 | ||||
m--------- | vim/bundle/sahara | 0 | ||||
m--------- | vim/bundle/shebang_create_exec | 0 | ||||
-rw-r--r-- | vim/compiler/bash.vim | 3 | ||||
-rw-r--r-- | vim/compiler/ksh.vim | 3 | ||||
-rw-r--r-- | vim/compiler/perlcritic.vim | 3 | ||||
-rw-r--r-- | vim/compiler/php.vim | 16 | ||||
-rw-r--r-- | vim/compiler/sh.vim | 3 | ||||
-rw-r--r-- | vim/compiler/shellcheck.vim | 3 | ||||
-rw-r--r-- | vim/compiler/vint.vim | 3 | ||||
-rw-r--r-- | vim/compiler/zsh.vim | 3 | ||||
-rw-r--r-- | vim/vimrc | 10 | ||||
-rw-r--r-- | vim/vimrc.stub.vim | 7 |
19 files changed, 268 insertions, 26 deletions
@@ -0,0 +1,219 @@ +" Remove g:is_posix if we resorted to it in order to get correct POSIX sh +" highlighting with older Vim runtime files +if exists('is_posix') + unlet! is_posix is_kornshell +endif + +" If we know we have another shell type, clear away the others completely, now +" that core syntax/sh.vim is done prodding /bin/sh to determine the system +" shell type (which I don't care about). +if exists('b:is_bash') + unlet! b:is_sh b:is_posix b:is_kornshell +elseif exists('b:is_kornshell') + unlet! b:is_sh b:is_posix +elseif exists('b:is_posix') + unlet! b:is_sh +endif + +" The syntax highlighter seems to flag '/baz' in '"${foo:-"$bar"/baz}"' as an +" error, which it isn't, at least in POSIX sh, Bash, and Ksh. +syntax clear shDerefWordError + +" The syntax highlighter doesn't match parens for subshells for 'if' tests +" correctly if they're on separate lines. This happens enough that it's +" probably not worth keeping the error. +syntax clear shParenError + +" The syntax highlighter flags this code with an error on the final square +" bracket: `case $foo in [![:ascii:]]) ;; esac`, but that's all legal. I'm not +" yet sure how to fix it, so will just turn the error group for now. +syntax clear shTestError + +" Highlighting corrections specific to POSIX mode +if exists('b:is_posix') + + " Highlight some commands that are both defined by POSIX and builtin + " commands in dash, as a rough but useable proxy for 'shell builtins'. This + " list was mostly wrested from `man 1 dash`. Also include control structure + " keywords like `break`, `continue`, and `return`. + syntax clear shStatement + syntax cluster shCommandSubList add=shStatement + syntax cluster shCaseList add=shStatement + syntax keyword shStatement + \ alias + \ bg + \ break + \ cd + \ command + \ continue + \ echo + \ eval + \ exec + \ exit + \ export + \ fc + \ fg + \ getopts + \ hash + \ kill + \ printf + \ pwd + \ read + \ readonly + \ return + \ set + \ shift + \ test + \ times + \ trap + \ true + \ type + \ ulimit + \ umask + \ unalias + \ unset + \ wait + + " Core syntax/sh.vim puts IFS and other variables that affect shell function + " in another color, but a subset of them actually apply to POSIX shell too + " (and plain Bourne). These are selected by searching the POSIX manpages. I + " added NLSPATH too, which wasn't in the original. + syntax clear shShellVariables + syntax cluster shCommandSubList add=shShellVariables + syntax keyword shShellVariables + \ CDPATH + \ ENV + \ FCEDIT + \ HISTFILE + \ HISTSIZE + \ HISTTIMEFORMAT + \ HOME + \ IFS + \ LANG + \ LC_ALL + \ LC_COLLATE + \ LC_CTYPE + \ LC_MESSAGES + \ LC_NUMERIC + \ LINENO + \ MAIL + \ MAILCHECK + \ MAILPATH + \ NLSPATH + \ OLDPWD + \ OPTARG + \ OPTERR + \ OPTIND + \ PATH + \ PS1 + \ PS2 + \ PS3 + \ PS4 + \ PWD + + " Core syntax/sh.vim thinks 'until' is a POSIX control structure keyword, + " but it isn't. Reset shRepeat and rebuild it with just 'while'. I only + " sort-of understand what this does, but it works. + syntax clear shRepeat + syntax region shRepeat + \ matchgroup=shLoop + \ start='\<while\_s' end='\<do\>'me=e-2 + \ contains=@shLoopList + + " Run some clustering that core syntax/sh.vim thinks doesn't apply to POSIX; + " this fixes while loops so they can be within other blocks. + syntax cluster shCaseList add=shRepeat + syntax cluster shFunctionList add=shRepeat + + " ${foo%bar}, ${foo%%bar}, ${foo#bar}, and ${foo##bar} are all valid forms + " of parameter expansion in POSIX, but sh.vim makes them conditional on + " Bash or Korn shell. We reinstate them (slightly adapted) here. + syntax match shDerefOp contained + \ '##\|#\|%%\|%' + \ nextgroup=@shDerefPatternList + syntax match shDerefPattern contained + \ '[^{}]\+' + \ contains=shDeref,shDerefEscape,shDerefPattern,shDerefSimple,shDerefString + \,shDerefString,shCommandSub + \ nextgroup=shDerefPattern + syntax region shDerefPattern contained + \ start='{' end='}' + \ contains=shDeref,shDerefSimple,shDerefString,shCommandSub + \ nextgroup=shDerefPattern + +endif + +" Some corrections for highlighting specific to the Bash mode +if exists('b:is_bash') + + " I don't like bashAdminStatement; these are not keywords, they're just + " strings for init scripts. + syntax clear bashAdminStatement + + " Reduce bashStatement down to just builtins; highlighting 'grep' is not + " very useful. This list was taken from `compgen -A helptopic` on Bash + " 4.4.5. + syntax clear bashStatement + syntax keyword bashStatement + \ . + \ : + \ alias + \ bg + \ bind + \ break + \ builtin + \ caller + \ cd + \ command + \ compgen + \ complete + \ compopt + \ continue + \ coproc + \ dirs + \ disown + \ echo + \ enable + \ eval + \ exec + \ exit + \ false + \ fc + \ fg + \ function + \ getopts + \ hash + \ help + \ history + \ jobs + \ kill + \ let + \ logout + \ mapfile + \ popd + \ printf + \ pushd + \ pwd + \ read + \ readarray + \ readonly + \ return + \ select + \ set + \ shift + \ shopt + \ source + \ suspend + \ test + \ time + \ times + \ trap + \ true + \ type + \ ulimit + \ umask + \ unalias + \ until + \ variables + \ wait +endif @@ -110,7 +110,7 @@ Configuration is included for: the rxvt terminal emulator with Unicode support * [Subversion](https://subversion.apache.org/) -- Apache Subversion, a version control system -* [tidy](https://www.html-tidy.org/) -- HTML/XHTML linter and tidier +* [tidy](http://www.html-tidy.org/) -- HTML/XHTML linter and tidier * [tmux](https://tmux.github.io/) -- Terminal multiplexer similar to GNU Screen * [Vim](https://www.vim.org/) -- Vi IMproved, a text editor * [Neovim](https://neovim.io/) -- An "emphatic fork" of Vim @@ -1,2 +1,2 @@ -tejr dotfiles v4.29.0 -Thu May 16 12:25:40 UTC 2019 +tejr dotfiles v4.30.0 +Fri May 17 10:53:43 UTC 2019 diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim index 7ded5134..e7bd21dc 100644 --- a/vim/after/ftplugin/sh.vim +++ b/vim/after/ftplugin/sh.vim @@ -24,7 +24,8 @@ let b:undo_ftplugin .= '|unlet b:current_compiler b:sh_check_compiler' " Resort to g:is_posix for correct syntax on older runtime files " 8.1.257 updated the runtime files to include a fix for this if exists('b:is_posix') - \ && (v:version < 800 || v:version == 800 && !has('patch257')) + \ && (v:version < 800 + \ || v:version == 800 && !has('patch257')) let is_posix = 1 endif diff --git a/vim/after/syntax/sh.vim b/vim/after/syntax/sh.vim index 797bdab9..af7670d5 100644 --- a/vim/after/syntax/sh.vim +++ b/vim/after/syntax/sh.vim @@ -133,11 +133,19 @@ if exists('b:is_posix') \ nextgroup=@shDerefPatternList syntax match shDerefPattern contained \ '[^{}]\+' - \ contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape + \ contains=shDeref + \,shCommandSub + \,shDerefEscape + \,shDerefPattern + \,shDerefSimple + \,shDerefString \ nextgroup=shDerefPattern syntax region shDerefPattern contained \ start='{' end='}' - \ contains=shDeref,shDerefSimple,shDerefString,shCommandSub + \ contains=shDeref + \,shCommandSub + \,shDerefSimple + \,shDerefString \ nextgroup=shDerefPattern endif diff --git a/vim/bundle/juvenile b/vim/bundle/juvenile -Subproject 6ce5b57d15a26a42c7c5bbe1e7611485e43e4eb +Subproject d85fc3ea03a0ee3fbe2bde6bb3b61c8a9aa164c diff --git a/vim/bundle/perl_version_bump b/vim/bundle/perl_version_bump -Subproject 660609b99f6e82c769096f6bd3b6d0a615c3ebc +Subproject beb24fe380976121557e6935886afd4ea8f19af diff --git a/vim/bundle/sahara b/vim/bundle/sahara -Subproject 8323dbdf27870a0845987cfacb49950b23dbbee +Subproject 901fdb72c3fe74ee5f0aa49c2fda52af3cbde08 diff --git a/vim/bundle/shebang_create_exec b/vim/bundle/shebang_create_exec -Subproject 1d9d72c1bce46d7b88ea1b765d890e56dc91384 +Subproject 8cf225b3f1630ed2c44ced62112eb48ae70c15c diff --git a/vim/compiler/bash.vim b/vim/compiler/bash.vim index ca418c24..13271e2b 100644 --- a/vim/compiler/bash.vim +++ b/vim/compiler/bash.vim @@ -9,7 +9,8 @@ endif " 7.4.191 is the earliest version with the :S file name modifier, which we " really should use if we can -if v:version >= 704 || v:version == 704 && has('patch191') +if v:version >= 704 + \ || v:version == 704 && has('patch191') CompilerSet makeprg=bash\ -n\ --\ %:S else CompilerSet makeprg=bash\ -n\ --\ % diff --git a/vim/compiler/ksh.vim b/vim/compiler/ksh.vim index 759aae02..5dbff5a1 100644 --- a/vim/compiler/ksh.vim +++ b/vim/compiler/ksh.vim @@ -9,7 +9,8 @@ endif " 7.4.191 is the earliest version with the :S file name modifier, which we " really should use if we can -if v:version >= 704 || v:version == 704 && has('patch191') +if v:version >= 704 + \ || v:version == 704 && has('patch191') CompilerSet makeprg=ksh\ -n\ --\ %:S else CompilerSet makeprg=ksh\ -n\ --\ % diff --git a/vim/compiler/perlcritic.vim b/vim/compiler/perlcritic.vim index 341fc9c8..b89ee76b 100644 --- a/vim/compiler/perlcritic.vim +++ b/vim/compiler/perlcritic.vim @@ -9,7 +9,8 @@ endif " 7.4.191 is the earliest version with the :S file name modifier, which we " really should use if we can -if v:version >= 704 || v:version == 704 && has('patch191') +if v:version >= 704 + \ || v:version == 704 && has('patch191') CompilerSet makeprg=perlcritic\ --verbose\ 1\ --\ %:S else CompilerSet makeprg=perlcritic\ --verbose\ 1\ --\ % diff --git a/vim/compiler/php.vim b/vim/compiler/php.vim index 66313bba..be4283ef 100644 --- a/vim/compiler/php.vim +++ b/vim/compiler/php.vim @@ -9,15 +9,21 @@ endif " 7.4.191 is the earliest version with the :S file name modifier, which we " really should use if we can -if v:version >= 704 || v:version == 704 && has('patch191') +if v:version >= 704 + \ || v:version == 704 && has('patch191') CompilerSet makeprg=php\ -lq\ -f\ %:S else CompilerSet makeprg=php\ -lq\ -f\ % endif " Here be copy-pasted dragons -CompilerSet errorformat=%E<b>%.%#Parse\ error</b>:\ %m\ in\ <b>%f</b>\ on\ line\ <b>%l</b><br\ />, - \%W<b>%.%#Notice</b>:\ %m\ in\ <b>%f</b>\ on\ line\ <b>%l</b><br\ />, - \%E%.%#Parse\ error:\ %m\ in\ %f\ on\ line\ %l, - \%W%.%#Notice:\ %m\ in\ %f\ on\ line\ %l, +CompilerSet errorformat= + \%E<b>%.%#Parse\ error</b>: + \\ %m\ in\ <b>%f</b>\ on\ line\ <b>%l</b><br\ />, + \%W<b>%.%#Notice</b>: + \\ %m\ in\ <b>%f</b>\ on\ line\ <b>%l</b><br\ />, + \%E%.%#Parse\ error: + \\ %m\ in\ %f\ on\ line\ %l, + \%W%.%#Notice: + \\ %m\ in\ %f\ on\ line\ %l, \%-G%.%# diff --git a/vim/compiler/sh.vim b/vim/compiler/sh.vim index d4134e6e..5e7bc3ba 100644 --- a/vim/compiler/sh.vim +++ b/vim/compiler/sh.vim @@ -9,7 +9,8 @@ endif " 7.4.191 is the earliest version with the :S file name modifier, which we " really should use if we can -if v:version >= 704 || v:version == 704 && has('patch191') +if v:version >= 704 + \ || v:version == 704 && has('patch191') CompilerSet makeprg=sh\ -n\ --\ %:S else CompilerSet makeprg=sh\ -n\ --\ % diff --git a/vim/compiler/shellcheck.vim b/vim/compiler/shellcheck.vim index c2cf04de..fa5db235 100644 --- a/vim/compiler/shellcheck.vim +++ b/vim/compiler/shellcheck.vim @@ -19,7 +19,8 @@ endif " 7.4.191 is the earliest version with the :S file name modifier, which we " really should use if we can -if v:version >= 704 || v:version == 704 && has('patch191') +if v:version >= 704 + \ || v:version == 704 && has('patch191') execute s:set . '\ --\ %:S' else execute s:set . '\ --\ %' diff --git a/vim/compiler/vint.vim b/vim/compiler/vint.vim index e0d0b076..35819ae3 100644 --- a/vim/compiler/vint.vim +++ b/vim/compiler/vint.vim @@ -9,7 +9,8 @@ endif " 7.4.191 is the earliest version with the :S file name modifier, which we " really should use if we can -if v:version >= 704 || v:version == 704 && has('patch191') +if v:version >= 704 + \ || v:version == 704 && has('patch191') CompilerSet makeprg=vint\ --\ %:S else CompilerSet makeprg=vint\ --\ % diff --git a/vim/compiler/zsh.vim b/vim/compiler/zsh.vim index 4fc5f30e..ad82cc3b 100644 --- a/vim/compiler/zsh.vim +++ b/vim/compiler/zsh.vim @@ -9,7 +9,8 @@ endif " 7.4.191 is the earliest version with the :S file name modifier, which we " really should use if we can -if v:version >= 704 || v:version == 704 && has('patch191') +if v:version >= 704 + \ || v:version == 704 && has('patch191') CompilerSet makeprg=zsh\ -n\ --\ %:S else CompilerSet makeprg=zsh\ -n\ --\ % @@ -29,8 +29,8 @@ else endif " Let me backspace over pretty much anything -set backspace+=indent " Spaces from 'autoindent' set backspace+=eol " Line breaks +set backspace+=indent " Spaces from 'autoindent' set backspace+=start " The start of current insertion " Try to keep backups in one system-appropriate dir, including full encoded @@ -138,10 +138,10 @@ set linebreak " Define extra 'list' display characters set listchars+=extends:> " Unwrapped text to screen right +set listchars+=nbsp:+ " Non-breaking spaces set listchars+=precedes:< " Unwrapped text to screen left set listchars+=tab:>- " Tab characters, preserve width set listchars+=trail:_ " Trailing spaces -set listchars+=nbsp:+ " Non-breaking spaces " Don't allow setting options via buffer content set nomodeline @@ -288,7 +288,7 @@ nnoremap <Leader>f :<C-U>setlocal formatoptions?<CR> nnoremap <Leader>F :<C-U>doautocmd filetypedetect BufRead<CR> " \g changes directory to the current file's location -nnoremap <Leader>g :<C-U>cd %:h<CR>:pwd<CR> +nnoremap <Leader>g :<C-U>cd %:h<Bar>pwd<CR> " \h toggles highlighting search results nnoremap <Leader>h :<C-U>set hlsearch! hlsearch?<CR> @@ -309,6 +309,10 @@ nnoremap <Leader>k :<C-U>marks<CR> nnoremap <Leader>l :<C-U>setlocal list! list?<CR> xnoremap <Leader>l :<C-U>setlocal list! list?<CR>gv +" \L toggles 'colorcolumn' showing 'textwidth' +nnoremap <Leader>L :<C-U>ToggleFlagLocal colorcolumn +1<CR> +xnoremap <Leader>L :<C-U>ToggleFlagLocal colorcolumn +1<CR>gv + " \m shows normal maps nnoremap <Leader>m :<C-U>map<CR> " \M shows buffer-local normal maps diff --git a/vim/vimrc.stub.vim b/vim/vimrc.stub.vim index b7aa1deb..b2d8803a 100644 --- a/vim/vimrc.stub.vim +++ b/vim/vimrc.stub.vim @@ -5,10 +5,7 @@ if v:version >= 700 finish endif -" Otherwise, prevent Vim from using any part of our configuration +" Otherwise, prevent an old and/or tiny Vim from using any part of our +" configuration, because parts of it will break set runtimepath-=~/.vim set runtimepath-=~/.vim/after -if has('win32') || has('win64') - set runtimepath-=~/vimfiles - set runtimepath-=~/vimfiles/after -endif |