diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-01-07 09:48:46 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-01-07 09:48:46 +1300 |
commit | 5d56356e22b6ac6888051ac000f4542a41bc4ae2 (patch) | |
tree | 0bcec57a939388b27acaf1ee42033d6ad6cfecde | |
parent | Merge branch 'release/v4.8.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-5d56356e22b6ac6888051ac000f4542a41bc4ae2.tar.gz dotfiles-5d56356e22b6ac6888051ac000f4542a41bc4ae2.zip |
Merge branch 'release/v4.9.0'v4.9.0
* release/v4.9.0:
Bump VERSION
Return to vi as default visual editor
Remove superfluous unmappings for mail filetype
Clarify a comment for HTML indentation
Add test to 'keywordprg' setting for Vim help
Make name of autocmd group more specific
Clarify a comment
Refactor Vim mail header field shortcuts
Explain .bashrc $- 'r' flag problem fully
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | bash/bashrc | 5 | ||||
-rw-r--r-- | sh/profile.d/visual.sh | 9 | ||||
-rw-r--r-- | vim/after/ftplugin/c.vim | 2 | ||||
-rw-r--r-- | vim/after/ftplugin/gitcommit.vim | 8 | ||||
-rw-r--r-- | vim/after/ftplugin/help.vim | 9 | ||||
-rw-r--r-- | vim/after/ftplugin/html.vim | 5 | ||||
-rw-r--r-- | vim/after/ftplugin/mail.vim | 7 | ||||
-rw-r--r-- | vim/autoload/mail.vim | 34 |
9 files changed, 45 insertions, 38 deletions
@@ -1,2 +1,2 @@ -tejr dotfiles v4.8.0 -Fri Jan 4 09:32:57 UTC 2019 +tejr dotfiles v4.9.0 +Sun Jan 6 20:48:46 UTC 2019 diff --git a/bash/bashrc b/bash/bashrc index 0400e41d..6e4c31a9 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -4,8 +4,9 @@ case $- in *) return ;; esac -# Don't do anything if restricted, not even sourcing the ENV file -# Testing $- for "r" doesn't work +# Don't do anything if restricted, not even sourcing the ENV file; testing +# whether $- contains 'r' doesn't work, because Bash doesn't set that flag +# until after .bashrc has evaluated ! shopt -q restricted_shell 2>/dev/null || return # Clear away all aliases; we do this here rather than in the $ENV file shared diff --git a/sh/profile.d/visual.sh b/sh/profile.d/visual.sh index d5280abd..50b8b423 100644 --- a/sh/profile.d/visual.sh +++ b/sh/profile.d/visual.sh @@ -1,8 +1,3 @@ -# If my Emacs wrapper is installed, use emacs as the visual editor; otherwise, -# use the system's vi -if command -v emacsm >/dev/null 2>&1 ; then - VISUAL='emacsm' -else - VISUAL='vi' -fi +# For a visual editor, use whichever kind of vi we get when we invoke 'vi' +VISUAL='vi' export VISUAL diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim index ccc5b170..e3eeaede 100644 --- a/vim/after/ftplugin/c.vim +++ b/vim/after/ftplugin/c.vim @@ -4,7 +4,7 @@ setlocal complete+=d " Set include pattern setlocal include=^\\s*#\\s*include -" Include headers on UNIX +" Include system headers on UNIX if has('unix') setlocal path+=/usr/include endif diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim index 618b9324..465c0e81 100644 --- a/vim/after/ftplugin/gitcommit.vim +++ b/vim/after/ftplugin/gitcommit.vim @@ -5,12 +5,12 @@ let b:undo_ftplugin .= '|setlocal comments< formatoptions<' " Choose the color column depending on non-comment line count if has('autocmd') && exists('+cursorcolumn') - augroup gitcommit + augroup gitcommit_cursorcolumn autocmd CursorMoved,CursorMovedI <buffer> - \ let &l:colorcolumn = gitcommit#CursorColumn() + \ let &l:colorcolumn = gitcommit_cursorcolumn#CursorColumn() augroup END - let b:undo_ftplugin .= '|execute ''autocmd! gitcommit''' - \ . '|augroup! gitcommit' + let b:undo_ftplugin .= '|execute ''autocmd! gitcommit_cursorcolumn''' + \ . '|augroup! gitcommit_cursorcolumn' \ . '|setlocal colorcolumn<' endif diff --git a/vim/after/ftplugin/help.vim b/vim/after/ftplugin/help.vim index a0b637aa..a72dac8e 100644 --- a/vim/after/ftplugin/help.vim +++ b/vim/after/ftplugin/help.vim @@ -11,9 +11,12 @@ if has('conceal') && &modifiable && !&readonly let b:undo_ftplugin .= '|setlocal conceallevel<' endif -" Use :help for 'keywordprg'; odd that this isn't the default -setlocal keywordprg=:help -let b:undo_ftplugin .= '|setlocal keywordprg<' +" Use :help as 'keywordprg' if not already set; this is the default since Vim +" v8.1.0690 +if &keywordprg !=# ':help' + setlocal keywordprg=:help + let 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_help_maps') diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim index c4f2e35e..0dff879f 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -9,8 +9,9 @@ let b:undo_ftplugin .= '|unlet b:current_compiler' \ . '|setlocal errorformat< makeprg<' " tidy(1) copes fine with formatting an entire document, but not just part of -" it; we map \= to do the former, but don't actually set 'equalprg', falling -" back on the good-enough built-in Vim indentation behavior. +" it; we map \= to do the former, but don't actually set 'equalprg' for the +" latter, instead falling back on the good-enough built-in Vim indentation +" behavior nnoremap <buffer> <Leader>= :<C-U>call html#TidyBuffer()<CR> let b:undo_ftplugin .= '|nunmap <buffer> <Leader>=' diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index ffaa6709..898fd6a8 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -36,13 +36,6 @@ if exists('g:no_plugin_maps') || exists('g:no_mail_maps') finish endif -" Clear away the quoting maps that the stock mail.vim sets; they work fine, -" but we have nicer ones to define shortly -nunmap <buffer> <LocalLeader>q -vunmap <buffer> <LocalLeader>q -nunmap <buffer> <Plug>MailQuote -vunmap <buffer> <Plug>MailQuote - " Flag messages as important/unimportant nnoremap <buffer> <LocalLeader>h \ :<C-U>call mail#FlagImportant()<CR> diff --git a/vim/autoload/mail.vim b/vim/autoload/mail.vim index baff4bbf..f37a7865 100644 --- a/vim/autoload/mail.vim +++ b/vim/autoload/mail.vim @@ -1,19 +1,33 @@ +" Add a header to a mail message +function! mail#AddHeaderField(name, body) abort + let l:num = 0 + while l:num < line('$') && getline(l:num + 1) !=# '' + let l:num += 1 + endwhile + call append(l:num, a:name.': '.a:body) +endfunction + +" Add a set of headers to a mail message +function! mail#AddHeaderFields(fields) abort + for l:name in sort(keys(a:fields)) + call mail#AddHeaderField(l:name, a:fields[l:name]) + endfor +endfunction + " Flag a message as important function! mail#FlagImportant() abort - call cursor(1, 1) - call search('^$') - - - call append(line('.'), 'X-Priority: 1') - call append(line('.'), 'Importance: High') + call mail#AddHeaderFields({ + \ 'Importance': 'High', + \ 'X-Priority': 1 + \ }) endfunction " Flag a message as unimportant function! mail#FlagUnimportant() abort - call cursor(1, 1) - call search('^$') - - - call append(line('.'), 'X-Priority: 5') - call append(line('.'), 'Importance: Low') + call mail#AddHeaderFields({ + \ 'Importance': 'Low', + \ 'X-Priority': 5 + \ }) endfunction " Move through quoted paragraphs like normal-mode `{` and `}` |