diff options
55 files changed, 421 insertions, 677 deletions
diff --git a/.gitmodules b/.gitmodules index 939eed66..0e03292a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,9 +5,6 @@ [submodule "vim/bundle/big_file_options"] path = vim/bundle/big_file_options url = https://sanctum.geek.nz/code/vim-big-file-options.git -[submodule "vim/bundle/clear_local_maps"] - path = vim/bundle/clear_local_maps - url = https://sanctum.geek.nz/code/vim-clear-local-maps.git [submodule "vim/bundle/copy_linebreak"] path = vim/bundle/copy_linebreak url = https://sanctum.geek.nz/code/vim-copy-linebreak.git @@ -510,10 +510,7 @@ install-vim-after: install-vim-after-ftplugin \ install-vim-after-ftplugin: mkdir -p $(VIMDIR)/after/ftplugin - for type in vim/after/ftplugin/* ; do \ - mkdir -p -- $(VIMDIR)/after/ftplugin/"$${type##*/}" ; \ - cp -p -- "$$type"/* $(VIMDIR)/after/ftplugin/"$${type##*/}" ; \ - done + cp -p -- vim/after/ftplugin/*.vim $(VIMDIR)/after/ftplugin install-vim-after-indent: mkdir -p $(VIMDIR)/after/indent @@ -548,7 +545,7 @@ install-vim-config: cp -p -- vim/vimrc $(VIMRC) install-vim-filetype: - cp -p -- vim/filemap.vim vim/filetype.vim vim/scripts.vim $(VIMDIR) + cp -p -- vim/filetype.vim vim/scripts.vim $(VIMDIR) install-vim-ftplugin: mkdir -p -- $(VIMDIR)/ftplugin @@ -1,2 +1,2 @@ -tejr dotfiles v1.9.0 -Fri Jun 29 02:08:43 UTC 2018 +tejr dotfiles v1.10.0 +Fri Jun 29 13:03:08 UTC 2018 diff --git a/bash/bashrc b/bash/bashrc index 7748b864..8462e5c2 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -42,7 +42,7 @@ HISTTIMEFORMAT='%F %T ' # Use a more compact format for the `time` builtin's output TIMEFORMAT='real:%lR user:%lU sys:%lS' -# Correct small errors in directory names given to the `cd` buildtin +# Correct small errors in directory names given to the `cd` builtin shopt -s cdspell # Check that hashed commands still exist before running them shopt -s checkhash @@ -95,6 +95,7 @@ fi # Load Bash-specific startup files for sh in "$HOME"/.bashrc.d/*.bash ; do - [[ -e $sh ]] && source "$sh" + [[ -e $sh ]] || continue + source "$sh" done unset -v sh diff --git a/bash/bashrc.d/completion.bash b/bash/bashrc.d/completion.bash index 901c55ec..d938275c 100644 --- a/bash/bashrc.d/completion.bash +++ b/bash/bashrc.d/completion.bash @@ -118,7 +118,8 @@ if ((BASH_VERSINFO[0] >= 4)) ; then # If not, load all of the completions up now else for sh in "$HOME"/.bash_completion.d/*.bash ; do - [[ -e $sh ]] && source "$sh" + [[ -e $sh ]] || continue + source "$sh" done unset -v sh fi diff --git a/bash/bashrc.d/keep.bash b/bash/bashrc.d/keep.bash index da7ff558..ab89288e 100644 --- a/bash/bashrc.d/keep.bash +++ b/bash/bashrc.d/keep.bash @@ -143,6 +143,7 @@ EOF # Load any existing scripts in bashkeep for bashkeep in "${BASHKEEP:-"$HOME"/.bashkeep.d}"/*.bash ; do - [[ -e $bashkeep ]] && source "$bashkeep" + [[ -e $bashkeep ]] || continue + source "$bashkeep" done unset -v bashkeep diff --git a/ksh/kshrc.d/keep.ksh b/ksh/kshrc.d/keep.ksh index 0451fa68..f6593c3d 100644 --- a/ksh/kshrc.d/keep.ksh +++ b/ksh/kshrc.d/keep.ksh @@ -153,6 +153,7 @@ EOF # Load any existing scripts in kshkeep for kshkeep in "${KSHKEEP:-"$HOME"/.kshkeep.d}"/*.ksh ; do - [[ -e $kshkeep ]] && source "$kshkeep" + [[ -e $kshkeep ]] || continue + source "$kshkeep" done unset -v kshkeep @@ -3,7 +3,8 @@ # Load all supplementary scripts in ~/.profile.d for sh in "$HOME"/.profile.d/*.sh ; do - [ -e "$sh" ] && . "$sh" + [ -e "$sh" ] || continue + . "$sh" done unset -v sh @@ -16,7 +16,8 @@ unset -v MAILCHECK # Load all the POSIX-compatible functions from ~/.shrc.d; more advanced shells # like bash will have their own functions for sh in "$HOME"/.shrc.d/*.sh ; do - [ -e "$sh" ] && . "$sh" + [ -e "$sh" ] || continue + . "$sh" done unset -v sh diff --git a/vim/after/ftplugin/awk.vim b/vim/after/ftplugin/awk.vim new file mode 100644 index 00000000..2051bd21 --- /dev/null +++ b/vim/after/ftplugin/awk.vim @@ -0,0 +1,16 @@ +" Extra configuration for 'awk' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'awk' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Set comment formats +setlocal comments=:# +setlocal formatoptions+=or +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal comments< formatoptions<' diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim new file mode 100644 index 00000000..8ddea387 --- /dev/null +++ b/vim/after/ftplugin/c.vim @@ -0,0 +1,16 @@ +" Extra configuration for 'c' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'c' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Set comment formats +setlocal include=^\\s*#\\s*include +setlocal path+=/usr/include +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal include< path<' diff --git a/vim/after/ftplugin/cpp.vim b/vim/after/ftplugin/cpp.vim new file mode 100644 index 00000000..1c834200 --- /dev/null +++ b/vim/after/ftplugin/cpp.vim @@ -0,0 +1,16 @@ +" Extra configuration for 'cpp' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'cpp' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Set comment formats +setlocal include=^\\s*#\\s*include +setlocal path+=/usr/include +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal include< path<' diff --git a/vim/after/ftplugin/diff.vim b/vim/after/ftplugin/diff.vim new file mode 100644 index 00000000..a6d45afe --- /dev/null +++ b/vim/after/ftplugin/diff.vim @@ -0,0 +1,22 @@ +" Extra configuration for 'diff' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'diff' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_diff_maps') + finish +endif + +" Set mappings +nmap <buffer> <LocalLeader>p <Plug>DiffPrune +xmap <buffer> <LocalLeader>p <Plug>DiffPrune +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>p' + \ . '|xunmap <buffer> <LocalLeader>p' diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim new file mode 100644 index 00000000..b53854be --- /dev/null +++ b/vim/after/ftplugin/gitcommit.vim @@ -0,0 +1,16 @@ +" Extra configuration for 'gitcommit' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'gitcommit' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Make angle brackets behave like mail quotes +setlocal comments+=n:> +setlocal formatoptions+=or +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal comments< formatoptions<' diff --git a/vim/after/ftplugin/gitcommit/quote.vim b/vim/after/ftplugin/gitcommit/quote.vim deleted file mode 100644 index 61fa0509..00000000 --- a/vim/after/ftplugin/gitcommit/quote.vim +++ /dev/null @@ -1,25 +0,0 @@ -" gitcommit/quote.vim: Make angle-bracket quote characters behave like they do -" in mail messages, inserting the comment leader automatically on new lines -" and auto-formatting them. - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_gitcommit_quote') - finish -endif - -" Flag as loaded -let b:did_ftplugin_gitcommit_quote = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_gitcommit_quote' - -" Use trailing whitespace to denote continued paragraph -setlocal comments+=n:> -setlocal formatoptions+=c -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal comments<' - \ . '|setlocal formatoptions<' diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim new file mode 100644 index 00000000..a8e9efcc --- /dev/null +++ b/vim/after/ftplugin/html.vim @@ -0,0 +1,27 @@ +" Extra configuration for 'html' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'html' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_html_maps') + finish +endif + +" Set mappings +nnoremap <buffer> <LocalLeader>l + \ :<C-U>call compiler#Make('tidy')<CR> +nnoremap <buffer> <LocalLeader>r + \ :<C-U>call html#UrlLink()<CR> +nnoremap <buffer> <LocalLeader>t + \ :<C-U>call filter#Stable('tidy -quiet')<CR> +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>l' + \ . '|nunmap <buffer> <LocalLeader>r' + \ . '|nunmap <buffer> <LocalLeader>t' diff --git a/vim/after/ftplugin/html/lint.vim b/vim/after/ftplugin/html/lint.vim deleted file mode 100644 index 9ab479c0..00000000 --- a/vim/after/ftplugin/html/lint.vim +++ /dev/null @@ -1,33 +0,0 @@ -" html/lint.vim: Use tidy(1) to lint HTML documents for errors - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_html_lint') - finish -endif - -" Don't load if the primary filetype isn't HTML -if &filetype !=# 'html' - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_html_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_html_lint = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_html_lint' - -" Define a mapping target -nnoremap <buffer> <silent> <unique> - \ <Plug>HtmlLint - \ :<C-U>call compiler#Make('tidy')<CR> -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <Plug>HtmlLint' diff --git a/vim/after/ftplugin/html/tidy.vim b/vim/after/ftplugin/html/tidy.vim deleted file mode 100644 index 9331486b..00000000 --- a/vim/after/ftplugin/html/tidy.vim +++ /dev/null @@ -1,33 +0,0 @@ -" html/tidy.vim: Use tidy(1) to filter HTML documents - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_html_tidy') - finish -endif - -" Don't load if the primary filetype isn't HTML -if &filetype !=# 'html' - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_html_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_html_tidy = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_html_tidy' - -" Define a mapping target -nnoremap <buffer> <silent> <unique> - \ <Plug>HtmlTidy - \ :<C-U>call filter#Stable('tidy -quiet')<CR> -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <Plug>HtmlTidy' diff --git a/vim/after/ftplugin/html/url_link.vim b/vim/after/ftplugin/html/url_link.vim deleted file mode 100644 index e7263e17..00000000 --- a/vim/after/ftplugin/html/url_link.vim +++ /dev/null @@ -1,49 +0,0 @@ -" html/url_link.vim: Make a URL into a link - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_html_url_link') - finish -endif - -" Don't load if the primary filetype isn't HTML -if &filetype !=# 'html' - finish -endif - -" Flag as loaded -let b:did_ftplugin_html_url_link = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_html_url_link' - -" Make a bare URL into a link to itself -function! s:HtmlUrlLink() - - " Yank this whole whitespace-separated word - normal! yiW - " Open a link tag - normal! i<a href=""> - " Paste the URL into the quotes - normal! hP - " Move to the end of the link text URL - normal! E - " Close the link tag - normal! a</a> - -endfunction - -" Stop here if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_html_maps') - finish -endif - -" Define a mapping target -nnoremap <buffer> <silent> <unique> - \ <Plug>HtmlUrlLink - \ :<C-U>call <SID>HtmlUrlLink()<CR> -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <Plug>HtmlUrlLink' diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim new file mode 100644 index 00000000..a25d55b7 --- /dev/null +++ b/vim/after/ftplugin/mail.vim @@ -0,0 +1,15 @@ +" Extra configuration for 'mail' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'mail' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Add a space to the end of wrapped lines for format-flowed mail +setlocal formatoptions+=w +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal formatoptions<' diff --git a/vim/after/ftplugin/mail/flowed.vim b/vim/after/ftplugin/mail/flowed.vim deleted file mode 100644 index 78353360..00000000 --- a/vim/after/ftplugin/mail/flowed.vim +++ /dev/null @@ -1,21 +0,0 @@ -" mail/flowed.vim: Add 'w' flag to 'formatoptions' for mail - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_mail_flowed') - finish -endif - -" Flag as loaded -let b:did_ftplugin_mail_flowed = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_mail_flowed' - -" Use trailing whitespace to denote continued paragraph -setlocal formatoptions+=w -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal formatoptions<' diff --git a/vim/after/ftplugin/make.vim b/vim/after/ftplugin/make.vim new file mode 100644 index 00000000..ca4e41a6 --- /dev/null +++ b/vim/after/ftplugin/make.vim @@ -0,0 +1,20 @@ +" Extra configuration for 'make' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'make' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_make_maps') + finish +endif + +" Set mappings +nmap <buffer> <LocalLeader>m <Plug>MakeTarget +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>m' diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim new file mode 100644 index 00000000..454e5c4c --- /dev/null +++ b/vim/after/ftplugin/markdown.vim @@ -0,0 +1,15 @@ +" Extra configuration for 'markdown' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'markdown' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Spellcheck documents +setlocal spell +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal spell<' diff --git a/vim/after/ftplugin/markdown/spell.vim b/vim/after/ftplugin/markdown/spell.vim deleted file mode 100644 index 873f9f93..00000000 --- a/vim/after/ftplugin/markdown/spell.vim +++ /dev/null @@ -1,21 +0,0 @@ -" markdown/spell.vim: Turn on spell checking for Markdown files - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_markdown_spell') - finish -endif - -" Flag as loaded -let b:did_ftplugin_markdown_spell = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_markdown_spell' - -" Spellcheck documents by default -setlocal spell -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal spell<' diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim new file mode 100644 index 00000000..b007af64 --- /dev/null +++ b/vim/after/ftplugin/perl.vim @@ -0,0 +1,24 @@ +" Extra configuration for 'perl' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'perl' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_perl_maps') + finish +endif + +" Set mappings +nmap <buffer> <LocalLeader>c :<C-U>call compiler#Make('perl')<CR> +nmap <buffer> <LocalLeader>l :<C-U>call compiler#Make('perlcritic')<CR> +nmap <buffer> <LocalLeader>t :<C-U>call filter#Stable('perltidy')<CR> +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>c' + \ . '|nunmap <buffer> <LocalLeader>l' + \ . '|nunmap <buffer> <LocalLeader>t' diff --git a/vim/after/ftplugin/perl/check.vim b/vim/after/ftplugin/perl/check.vim deleted file mode 100644 index c810c91f..00000000 --- a/vim/after/ftplugin/perl/check.vim +++ /dev/null @@ -1,28 +0,0 @@ -" perl/check.vim: Use Perl binary to check for errors - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_perl_check') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_perl_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_perl_check = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_perl_check' - -" Define a mapping target -nnoremap <buffer> <silent> <unique> - \ <Plug>PerlCheck - \ :<C-U>call compiler#Make('perl')<CR> -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <Plug>PerlCheck' diff --git a/vim/after/ftplugin/perl/lint.vim b/vim/after/ftplugin/perl/lint.vim deleted file mode 100644 index 86741f79..00000000 --- a/vim/after/ftplugin/perl/lint.vim +++ /dev/null @@ -1,28 +0,0 @@ -" perl/lint.vim: Use Perl::Critic to lint scripts - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_perl_lint') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_html_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_perl_lint = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_perl_lint' - -" Define a mapping target -nnoremap <buffer> <silent> <unique> - \ <Plug>PerlLint - \ :<C-U>call compiler#Make('perlcritic')<CR> -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <Plug>PerlLint' diff --git a/vim/after/ftplugin/perl/tidy.vim b/vim/after/ftplugin/perl/tidy.vim deleted file mode 100644 index c815aba9..00000000 --- a/vim/after/ftplugin/perl/tidy.vim +++ /dev/null @@ -1,28 +0,0 @@ -" perl/tidy.vim: Use Perl::Tidy to format and filter scripts - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_perl_tidy') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_perl_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_perl_tidy = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_perl_tidy' - -" Define a mapping target -nnoremap <buffer> <silent> <unique> - \ <Plug>PerlTidy - \ :<C-U>call filter#Stable('perltidy')<CR> -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <Plug>PerlTidy' diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim new file mode 100644 index 00000000..ee38ec3b --- /dev/null +++ b/vim/after/ftplugin/php.vim @@ -0,0 +1,39 @@ +" Extra configuration for 'php' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'php' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Set comment formats +setlocal comments=s1:/*,m:*,ex:*/,://,:# +setlocal formatoptions+=or +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal comments< formatoptions<' + +" Define keywords for matchit.vim +if exists('g:loaded_matchit') + let b:match_words = '<?php:?>' + \ . ',\<do\>:\<while\>' + \ . ',\<for\>:\<endfor\>' + \ . ',\<foreach\>:\<endforeach\>' + \ . ',\<if\>:\<elseif\>:\<else\>:\<endif\>' + \ . ',\<switch\>:\<endswitch\>' + \ . ',\<while\>:\<endwhile\>' + let b:undo_ftplugin = 'unlet b:match_words' +endif + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_php_maps') + finish +endif + +" Set mappings +nnoremap <buffer> <LocalLeader>c + \ :<C-U>call compiler#Make('php')<CR> +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>c' diff --git a/vim/after/ftplugin/php/check.vim b/vim/after/ftplugin/php/check.vim deleted file mode 100644 index ea88d39b..00000000 --- a/vim/after/ftplugin/php/check.vim +++ /dev/null @@ -1,28 +0,0 @@ -" php/check.vim: Use PHP binary to check scripts for errors - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_php_check') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_php_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_php_check = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_php_check' - -" Define a mapping target -nnoremap <buffer> <silent> <unique> - \ <Plug>PhpCheck - \ :<C-U>call compiler#Make('php')<CR> -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <Plug>PhpCheck' diff --git a/vim/after/ftplugin/sed.vim b/vim/after/ftplugin/sed.vim new file mode 100644 index 00000000..b3c3abc3 --- /dev/null +++ b/vim/after/ftplugin/sed.vim @@ -0,0 +1,16 @@ +" Extra configuration for 'sed' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'sed' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Set comment formats +setlocal comments=:# +setlocal formatoptions+=or +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal comments< formatoptions<' diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim new file mode 100644 index 00000000..5e4d9e99 --- /dev/null +++ b/vim/after/ftplugin/sh.vim @@ -0,0 +1,46 @@ +" Extra configuration for 'sh' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'sh' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Set comment formats +setlocal comments=:# +setlocal formatoptions+=or +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal comments< formatoptions<' + +" If subtype is Bash, set 'keywordprg' to han(1df) +if exists('b:is_bash') + setlocal keywordprg=han + let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal keywordprg<' +endif + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_sh_maps') + finish +endif + +" Choose check compiler based on file subtype +if exists('b:is_bash') + let b:sh_check_compiler = 'bash' +elseif exists('b:is_kornshell') + let b:sh_check_compiler = 'ksh' +else + let b:sh_check_compiler = 'sh' +endif + +" Set mappings +nnoremap <buffer> <LocalLeader>c + \ :<C-U>call compiler#Make(b:sh_check_compiler)<CR> +nnoremap <buffer> <LocalLeader>l + \ :<C-U>call compiler#Make('shellcheck')<CR> +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>c' + \ . '|nunmap <buffer> <LocalLeader>l' diff --git a/vim/after/ftplugin/sh/check.vim b/vim/after/ftplugin/sh/check.vim deleted file mode 100644 index 48bb72d0..00000000 --- a/vim/after/ftplugin/sh/check.vim +++ /dev/null @@ -1,37 +0,0 @@ -" sh/check.vim: Use appropriate shell binary to check scripts for errors - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_sh_check') - finish -endif - -" Stop here if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_sh_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_sh_check = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_sh_check' - -" Choose compiler based on file subtype -if exists('b:is_bash') - let b:sh_check_compiler = 'bash' -elseif exists('b:is_kornshell') - let b:sh_check_compiler = 'ksh' -else - let b:sh_check_compiler = 'sh' -endif - -" Define a mapping target -nnoremap <buffer> <silent> <unique> - \ <Plug>ShCheck - \ :<C-U>call compiler#Make(b:sh_check_compiler)<CR> -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <Plug>ShCheck' diff --git a/vim/after/ftplugin/sh/han.vim b/vim/after/ftplugin/sh/han.vim deleted file mode 100644 index 3aacdb7e..00000000 --- a/vim/after/ftplugin/sh/han.vim +++ /dev/null @@ -1,26 +0,0 @@ -" sh/han.vim: Use han(1df) as 'keywordprg' for Bash scripts - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_sh_han') - finish -endif - -" Don't load if this isn't Bash or if han(1df) isn't available -if !exists('b:is_bash') || !executable('han') - finish -endif - -" Flag as loaded -let b:did_ftplugin_sh_han = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_sh_han' - -" Set 'keywordprg' to han(1df) -setlocal keywordprg=han -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal keywordprg<' diff --git a/vim/after/ftplugin/sh/lint.vim b/vim/after/ftplugin/sh/lint.vim deleted file mode 100644 index a24ba369..00000000 --- a/vim/after/ftplugin/sh/lint.vim +++ /dev/null @@ -1,28 +0,0 @@ -" sh/lint.vim: Use appropriate shell binary to lint scripts for errors - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_sh_lint') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_sh_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_sh_lint = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_sh_lint' - -" Define a mapping target -nnoremap <buffer> <silent> <unique> - \ <Plug>ShLint - \ :<C-U>call compiler#Make('shellcheck')<CR> -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <Plug>ShLint' diff --git a/vim/after/ftplugin/text.vim b/vim/after/ftplugin/text.vim new file mode 100644 index 00000000..22b1c27b --- /dev/null +++ b/vim/after/ftplugin/text.vim @@ -0,0 +1,15 @@ +" Extra configuration for 'text' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'text' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Spellcheck documents +setlocal spell +let b:undo_ftplugin = b:undo_ftplugin + \ . '|setlocal spell<' diff --git a/vim/after/ftplugin/text/spell.vim b/vim/after/ftplugin/text/spell.vim deleted file mode 100644 index a9f5422b..00000000 --- a/vim/after/ftplugin/text/spell.vim +++ /dev/null @@ -1,21 +0,0 @@ -" text/spell.vim: Turn on spell checking for text files - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_text_spell') - finish -endif - -" Flag as loaded -let b:did_ftplugin_text_spell = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_text_spell' - -" Spellcheck documents by default -setlocal spell -let b:undo_ftplugin = b:undo_ftplugin - \ . '|setlocal spell<' diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim new file mode 100644 index 00000000..fa65a65a --- /dev/null +++ b/vim/after/ftplugin/vim.vim @@ -0,0 +1,37 @@ +" Extra configuration for 'vim' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'vim' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_vim_maps') + finish +endif + +" Set mappings +nnoremap <buffer> <LocalLeader>l + \ :<C-U>call compiler#Make('vint')<CR> +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>l' + +" Add undo commands to fix clearing buffer-local vim maps that the core +" ftplugin leaves in place +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> [[' + \ . '|vunmap <buffer> [[' + \ . '|nunmap <buffer> ]]' + \ . '|vunmap <buffer> ]]' + \ . '|nunmap <buffer> []' + \ . '|vunmap <buffer> []' + \ . '|nunmap <buffer> ][' + \ . '|vunmap <buffer> ][' + \ . '|nunmap <buffer> ]"' + \ . '|vunmap <buffer> ]"' + \ . '|nunmap <buffer> ["' + \ . '|vunmap <buffer> ["' diff --git a/vim/after/ftplugin/vim/clear_maps.vim b/vim/after/ftplugin/vim/clear_maps.vim deleted file mode 100644 index a84ca4b9..00000000 --- a/vim/after/ftplugin/vim/clear_maps.vim +++ /dev/null @@ -1,37 +0,0 @@ -" vim/clear_maps.vim: Fix clearing buffer-local vim maps that the core -" ftplugin leaves in place - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_vim_lint') - finish -endif - -" Don't load if the mappings probably weren't loaded in the first place -if exists('g:no_plugin_maps') || exists('g:no_vim_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_vim_clear_maps = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_vim_clear_maps' - -" Add undo commands -let b:undo_ftplugin = b:undo_ftplugin - \ . '|silent! nunmap <buffer> [[' - \ . '|silent! vunmap <buffer> [[' - \ . '|silent! nunmap <buffer> ]]' - \ . '|silent! vunmap <buffer> ]]' - \ . '|silent! nunmap <buffer> []' - \ . '|silent! vunmap <buffer> []' - \ . '|silent! nunmap <buffer> ][' - \ . '|silent! vunmap <buffer> ][' - \ . '|silent! nunmap <buffer> ]"' - \ . '|silent! vunmap <buffer> ]"' - \ . '|silent! nunmap <buffer> ["' - \ . '|silent! vunmap <buffer> ["' diff --git a/vim/after/ftplugin/vim/lint.vim b/vim/after/ftplugin/vim/lint.vim deleted file mode 100644 index b71a7275..00000000 --- a/vim/after/ftplugin/vim/lint.vim +++ /dev/null @@ -1,28 +0,0 @@ -" vim/lint.vim: Use Vint to lint VimL scripts - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_vim_lint') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_vim_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_vim_lint = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_vim_lint' - -" Define a mapping target -nnoremap <buffer> <silent> <unique> - \ <Plug>VimLint - \ :<C-U>call compiler#Make('vint')<CR> -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <Plug>VimLint' diff --git a/vim/after/ftplugin/zsh.vim b/vim/after/ftplugin/zsh.vim new file mode 100644 index 00000000..4e56f428 --- /dev/null +++ b/vim/after/ftplugin/zsh.vim @@ -0,0 +1,21 @@ +" Extra configuration for 'zsh' filetypes +if &compatible || v:version < 700 || exists('b:did_ftplugin_after') + finish +endif +if &filetype !=# 'zsh' + finish +endif +let b:did_ftplugin_after = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_after' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_zsh_maps') + finish +endif + +" Set mappings +nnoremap <buffer> <LocalLeader>c + \ :<C-U>call compiler#Make('zsh')<CR> +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>c' diff --git a/vim/after/ftplugin/zsh/check.vim b/vim/after/ftplugin/zsh/check.vim deleted file mode 100644 index a439ef8d..00000000 --- a/vim/after/ftplugin/zsh/check.vim +++ /dev/null @@ -1,28 +0,0 @@ -" zsh/check.vim: Use Z shell binary to check for errors - -" Don't load if running compatible or too old -if &compatible || v:version < 700 - finish -endif - -" Don't load if already loaded -if exists('b:did_ftplugin_zsh_check') - finish -endif - -" Don't load if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_zsh_maps') - finish -endif - -" Flag as loaded -let b:did_ftplugin_zsh_check = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_zsh_check' - -" Define a mapping target -nnoremap <buffer> <silent> <unique> - \ <Plug>ZshCheck - \ :<C-U>call compiler#Make('zsh')<CR> -let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap <buffer> <Plug>ZshCheck' diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim index bfd92aeb..e46aae54 100644 --- a/vim/after/indent/vim.vim +++ b/vim/after/indent/vim.vim @@ -1,7 +1,11 @@ " Observe VimL conventions for two-space indents setlocal shiftwidth=2 -setlocal softtabstop=2 -if exists('b:undo_indent') - let s:ui = '|setlocal shiftwidth< softtabstop<' - let b:undo_indent = b:undo_indent . s:ui +let b:undo_indent = b:undo_indent . '|setlocal shiftwidth<' + +" If we need to set 'softtabstop' too, do it +if &softtabstop == -1 + setlocal softtabstop=2 + if exists('b:undo_indent') + let b:undo_indent = b:undo_indent . '|setlocal softtabstop<' + endif endif diff --git a/vim/autoload/html.vim b/vim/autoload/html.vim new file mode 100644 index 00000000..f46b323f --- /dev/null +++ b/vim/autoload/html.vim @@ -0,0 +1,15 @@ +" Make a bare URL into a link to itself +function! html#UrlLink() abort + + " Yank this whole whitespace-separated word + normal! yiW + " Open a link tag + normal! i<a href=""> + " Paste the URL into the quotes + normal! hP + " Move to the end of the link text URL + normal! E + " Close the link tag + normal! a</a> + +endfunction diff --git a/vim/autoload/vimrc.vim b/vim/autoload/vimrc.vim deleted file mode 100644 index eaeefd5d..00000000 --- a/vim/autoload/vimrc.vim +++ /dev/null @@ -1,39 +0,0 @@ -" Get all buffer-local mappings into a string variable -function! vimrc#GetBufferLocalMaps() abort - redir => l:out - map <buffer> - redir END - let g:vimrc#buffer_local_maps = l:out -endfunction - -" Clear all buffer-local mappings beginning with <LocalLeader> -function! vimrc#ClearLocalLeaderMaps() abort - - " Do nothing if there isn't a defined local leader - if !exists('g:maplocalleader') - return - endif - - " Get all the buffer-local mappings into a list - silent call vimrc#GetBufferLocalMaps() - let l:mappings = split(g:vimrc#buffer_local_maps, '\n') - - " Iterate through the mappings - for l:mapping in l:mappings - - " Match the list mapping and mode; skip if no match - let l:matchlist = matchlist(l:mapping, '\m\C^\(.\)\s\+\(\S\+\)') - if !len(l:matchlist) - continue - endif - let l:mode = l:matchlist[1] - let l:sequence = l:matchlist[2] - - " If the mapping starts with our local leader, clear it - if stridx(l:sequence, g:maplocalleader) == 0 - execute l:mode.'unmap <buffer> '.l:sequence - endif - - endfor - -endfunction diff --git a/vim/bundle/clear_local_maps b/vim/bundle/clear_local_maps deleted file mode 160000 -Subproject 61fb4c0926d4f26014e1765bf6d22c1d968c6f8 diff --git a/vim/bundle/strip_trailing_whitespace b/vim/bundle/strip_trailing_whitespace -Subproject f434572d4e99700d2dac5c5c0b78aac7601dd02 +Subproject ddf61eb54415c7cb308a2600b963f6579011214 diff --git a/vim/filemap.vim b/vim/filemap.vim deleted file mode 100644 index d20a2037..00000000 --- a/vim/filemap.vim +++ /dev/null @@ -1,55 +0,0 @@ -" Filetype-specific mappings -if &compatible || v:version < 700 || !has('autocmd') - finish -endif - -" No 'loaded' guard; this file is an extension of our .vimrc, and we do want -" to reload it if the .vimrc is re-sourced. - -" Set up filetype mapping hooks -augroup filetypemap - autocmd! - - " Clear existing local leader maps if possible - autocmd FileType * - \ silent! call clear_local_maps#Clear() - - " Diff: prune sections - autocmd FileType diff - \ nmap <buffer> <LocalLeader>p <Plug>DiffPrune - \|xmap <buffer> <LocalLeader>p <Plug>DiffPrune - - " HTML: lint, URL-to-link, tidy - autocmd FileType html - \ nmap <buffer> <LocalLeader>l <Plug>HtmlLint - \|nmap <buffer> <LocalLeader>r <Plug>HtmlUrlLink - \|nmap <buffer> <LocalLeader>t <Plug>HtmlTidy - - " Makefile: make target - autocmd FileType make - \ nmap <buffer> <LocalLeader>m <Plug>MakeTarget - - " Perl: check, lint, and tidy - autocmd FileType perl - \ nmap <buffer> <LocalLeader>c <Plug>PerlCheck - \|nmap <buffer> <LocalLeader>l <Plug>PerlLint - \|nmap <buffer> <LocalLeader>t <Plug>PerlTidy - - " PHP: check - autocmd FileType php - \ nmap <buffer> <LocalLeader>c <Plug>PhpCheck - - " Shell: check and lint - autocmd FileType sh - \ nmap <buffer> <LocalLeader>c <Plug>ShCheck - \|nmap <buffer> <LocalLeader>l <Plug>ShLint - - " VimL: lint - autocmd FileType vim - \ nmap <buffer> <LocalLeader>l <Plug>VimLint - - " Zsh: check - autocmd FileType zsh - \ nmap <buffer> <LocalLeader>c <Plug>ZshCheck - -augroup END diff --git a/vim/ftplugin/markdown.vim b/vim/ftplugin/markdown.vim index e1787df5..1e40c0ef 100644 --- a/vim/ftplugin/markdown.vim +++ b/vim/ftplugin/markdown.vim @@ -1,33 +1,5 @@ -" -" Replace Vim's stock Markdown filetype plugin, reimplementing only the part I -" actually need: the options settings. I don't use the folding, anyway. -" -" This is mostly because the stock file pulls in HTML's filetype plugins too, -" without providing a variable check to stop it. That causes absurd problems -" with defining HTML checkers/linters in the rest of my files. -" +" Block system ftplugin from loading to avoid HTML ftplugin load if exists('b:did_ftplugin') || &compatible finish endif let b:did_ftplugin = 1 - -" Set comment/quote patterns -setlocal comments=fb:*,fb:-,fb:+,n:> -setlocal commentstring=>\ %s - -" Set format options -setlocal formatoptions+=tcqln -setlocal formatoptions-=ro - -" Set list format patterns -if exists('+formatlistpat') - let &l:formatlistpat = '^\s*\d\+\.\s\+' - \ .'\|^[-*+]\s\+' - \ .'\|^\[^\ze[^\]]\+\]:' -endif - -" Define how to undo this plugin's settings -let b:undo_ftplugin = 'setlocal comments<' - \ . '|setlocal commentstring<' - \ . '|setlocal formatoptions<' - \ . '|setlocal formatlistpat<' diff --git a/vim/ftplugin/php.vim b/vim/ftplugin/php.vim index 35292e15..1e40c0ef 100644 --- a/vim/ftplugin/php.vim +++ b/vim/ftplugin/php.vim @@ -1,26 +1,5 @@ -" -" Replace Vim's stock PHP filetype plugin, reimplementing only the part I -" actually need: the matchit.vim keyword pairs. -" -" This is mostly because the stock file pulls in HTML's filetype plugins too, -" without providing a variable check to stop it. That causes absurd problems -" with defining HTML checkers/linters in the rest of my files. -" +" Block system ftplugin from loading to avoid HTML ftplugin load if exists('b:did_ftplugin') || &compatible finish endif let b:did_ftplugin = 1 - -" Define keywords for matchit.vim -if exists('g:loaded_matchit') - let b:match_words = '<?php:?>' - \ . ',\<do\>:\<while\>' - \ . ',\<for\>:\<endfor\>' - \ . ',\<foreach\>:\<endforeach\>' - \ . ',\<if\>:\<elseif\>:\<else\>:\<endif\>' - \ . ',\<switch\>:\<endswitch\>' - \ . ',\<while\>:\<endwhile\>' -endif - -" Define how to undo this plugin's settings -let b:undo_ftplugin = 'unlet b:match_words' diff --git a/vim/indent/password.vim b/vim/indent/password.vim index e633fe05..e37d0387 100644 --- a/vim/indent/password.vim +++ b/vim/indent/password.vim @@ -4,7 +4,7 @@ if exists('b:did_indent') endif let b:did_indent = 1 -" Manual indenting and literal tabs +" Manual indenting and literal tabs for passwords setlocal noautoindent setlocal noexpandtab setlocal softtabstop=0 diff --git a/vim/indent/php.vim b/vim/indent/php.vim index 6a61f105..7747d77e 100644 --- a/vim/indent/php.vim +++ b/vim/indent/php.vim @@ -1,10 +1,10 @@ -" Replace Vim's stock PHP indent rules. They're very complicated and don't -" work in a predictable way. +" Only do this when not done yet for this buffer if exists('b:did_indent') finish endif let b:did_indent = 1 -" Easier just to use 'autoindent'; not perfect, but predictable. +" Replace Vim's stock PHP indent rules. They're very complicated and don't +" work in a predictable way. Just use 'autoindent'. setlocal autoindent let b:undo_indent = 'setlocal autoindent<' @@ -8,7 +8,6 @@ if has('autocmd') let g:maplocalleader = '_' filetype plugin indent on - runtime filemap.vim endif " Options dependent on the syntax feature @@ -54,9 +53,6 @@ else set visualbell t_vb= endif -" Clear default comment string, let the filetype handle it -set comments= - " How to deal with lines wrapping beyond the last screen row if v:version > 704 || v:version == 704 && has('patch2109') set display=truncate " Show '@@@' on the last line, if supported @@ -74,6 +70,9 @@ if v:version > 703 || v:version == 703 && has('patch541') set formatoptions+=j endif +" Don't assume I'm editing C; let the filetype set this +set include= + " Don't join lines with two spaces at the end of sentences set nojoinspaces @@ -117,6 +116,11 @@ if has('cmdline_info') set ruler endif +" Clear default 'comment' value, let the filetype handle it +if has('comments') + set comments= +endif + " Highlight settings for search if has('extra_search') set hlsearch " Highlight completed searches... @@ -124,9 +128,9 @@ if has('extra_search') set incsearch " Show matches as I type endif -" Use whole tree from current directory for :find +" More sensible language-agnostic setting for gf/:find if has('file_in_path') - set path+=** + set path=.,,** endif " Don't load GUI menus; set here before GUI starts @@ -17,6 +17,7 @@ SAVEHIST=$((1 << 12)) # Load Zsh-specific startup files for sh in "$HOME"/.zshrc.d/*.zsh ; do - [[ -e $sh ]] && source "$sh" + [[ -e $sh ]] || continue + source "$sh" done unset -v sh diff --git a/zsh/zshrc.d/keep.zsh b/zsh/zshrc.d/keep.zsh index 8dfc5f29..59696301 100644 --- a/zsh/zshrc.d/keep.zsh +++ b/zsh/zshrc.d/keep.zsh @@ -142,6 +142,7 @@ EOF # Load any existing scripts in zshkeep for zshkeep in "${ZSHKEEP:-"$HOME"/.zshkeep.d}"/*.zsh(N) ; do - [[ -e $zshkeep ]] && source "$zshkeep" + [[ -e $zshkeep ]] || continue + source "$zshkeep" done unset -v zshkeep |