From ae3cae3a612ddf1a74b4d82c1b2f0441b37b1b6a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 12 Jul 2018 13:56:01 +1200 Subject: Add ftplugin for tmux Just with comment formatting rules--there's no stock ftplugin in Vim at the moment, just a syntax file. --- vim/ftplugin/tmux.vim | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 vim/ftplugin/tmux.vim diff --git a/vim/ftplugin/tmux.vim b/vim/ftplugin/tmux.vim new file mode 100644 index 00000000..ecbd3e85 --- /dev/null +++ b/vim/ftplugin/tmux.vim @@ -0,0 +1,9 @@ +" Only do this when not yet done for this buffer +if exists('b:did_ftplugin') + finish +endif + +" Set comment formats +setlocal comments=:# +setlocal formatoptions+=or +let b:undo_ftplugin = 'setlocal comments< formatoptions' -- cgit v1.2.3 From 473cc12cf68f9f63bd0d31b9ab9f17a49f2ea4fe Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 12 Jul 2018 22:23:12 +1200 Subject: Check for 'spell' feature in ftplugins --- vim/after/ftplugin/markdown.vim | 2 +- vim/after/ftplugin/text.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim index d2cf8918..d13bba8f 100644 --- a/vim/after/ftplugin/markdown.vim +++ b/vim/after/ftplugin/markdown.vim @@ -4,7 +4,7 @@ if &filetype !=# 'markdown' || v:version < 700 endif " Spellcheck documents we're actually editing (not just viewing) -if &modifiable && !&readonly +if has('spell') && &modifiable && !&readonly setlocal spell let b:undo_ftplugin .= '|setlocal spell<' endif diff --git a/vim/after/ftplugin/text.vim b/vim/after/ftplugin/text.vim index 67948706..8341f72d 100644 --- a/vim/after/ftplugin/text.vim +++ b/vim/after/ftplugin/text.vim @@ -4,7 +4,7 @@ if &filetype !=# 'text' || v:version < 700 endif " Spellcheck documents we're actually editing (not just viewing) -if &modifiable && !&readonly +if has('spell') && &modifiable && !&readonly setlocal spell let b:undo_ftplugin .= '|setlocal spell<' endif -- cgit v1.2.3 From 368143a5bdcdc9a8be51c6ecbad6b83f1e3e10a9 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 13 Jul 2018 09:02:32 +1200 Subject: Disable 'spellcapcheck' for README.md files This is because such files very often have headings or sentences that start with filenames. --- vim/after/ftplugin/markdown.vim | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim index d13bba8f..63f3f062 100644 --- a/vim/after/ftplugin/markdown.vim +++ b/vim/after/ftplugin/markdown.vim @@ -3,8 +3,20 @@ if &filetype !=# 'markdown' || v:version < 700 finish endif -" Spellcheck documents we're actually editing (not just viewing) -if has('spell') && &modifiable && !&readonly - setlocal spell - let b:undo_ftplugin .= '|setlocal spell<' +" Spellchecking features +if has('spell') + + " Spellcheck documents we're actually editing (not just viewing) + if &modifiable && !&readonly + setlocal spell + let b:undo_ftplugin .= '|setlocal spell<' + endif + + " Tolerate leading lowercase letters in README.md files, for things like + " headings being filenames + if expand('%:t') ==# 'README.md' + setlocal spellcapcheck= + let b:undo_ftplugin .= '|setlocal spellcapcheck<' + endif + endif -- cgit v1.2.3 From 50479150154d31cff24458f2a06c42b6ebf4992a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 13 Jul 2018 09:55:03 +1200 Subject: Simplify 'shortmess' settings Just to avoid solving problems I don't actually have. --- vim/vimrc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 53c524ea..f07f77e8 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -104,11 +104,8 @@ set nomodeline " Treat numbers with a leading zero as decimal, not octal set nrformats-=octal -" Abbreviate some more regularly displayed messages -set shortmess+=I " Don't show startup splash screen -set shortmess+=m " [Modified] -> [+] -set shortmess+=r " [readonly] -> [RO] -set shortmess+=w " written -> [w], appended -> [a] +" Don't show startup splash screen (I donated) +set shortmess+=I " Clear default 'comments' value, let the filetype handle it if has('comments') -- cgit v1.2.3 From 35ba8df810c204ac6c5c013f93d33feb2b4b9b6a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 13 Jul 2018 10:02:36 +1200 Subject: Remove bell disabling in Vim I just realised that all of my terminals are already configured to handle this in a useful way; in tmux, the window name goes red, and in PuTTY, the Windows taskbar icon flashes. --- vim/vimrc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index f07f77e8..92052ece 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -48,13 +48,6 @@ set backspace+=eol " Line breaks set backspace+=indent " Spaces from 'autoindent' set backspace+=start " The start of current insertion -" Never use any kind of bell, visual or not -if exists('+belloff') - set belloff=all -else - set visualbell t_vb= -endif - " 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 -- cgit v1.2.3 From 1bf71e686af4dd1a39afd2ce994771f8aca71110 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 13 Jul 2018 10:39:43 +1200 Subject: Add missing angle bracket for Vim ftplugin undo --- vim/after/ftplugin/vim.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim index 2b8ddbb9..ca6b01b0 100644 --- a/vim/after/ftplugin/vim.vim +++ b/vim/after/ftplugin/vim.vim @@ -6,7 +6,7 @@ endif " Use Vint as a syntax checker compiler vint let b:undo_ftplugin .= '|unlet b:current_compiler' - \ . '|setlocal errorformat< makeprg' + \ . '|setlocal errorformat< makeprg<' " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_vim_maps') -- cgit v1.2.3 From 4e44ad60ad22cef98e6b51bb43bf67c34343ac08 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 13 Jul 2018 10:41:45 +1200 Subject: Move .vimrc reloading stuff into custom plugin Not sure whether I'll bother packaging this one. --- vim/plugin/reload.vim | 28 ++++++++++++++++++++++++++++ vim/vimrc | 12 ------------ 2 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 vim/plugin/reload.vim diff --git a/vim/plugin/reload.vim b/vim/plugin/reload.vim new file mode 100644 index 00000000..d1493ad1 --- /dev/null +++ b/vim/plugin/reload.vim @@ -0,0 +1,28 @@ +" +" reload_vimrc_filetype.vim: Add hook to reload active buffer's filetype when +" vimrc reloaded, so that we don't end up indenting four spaces in an open +" VimL file, etc. Requires Vim 7.1 or 7.0 with patch 187 (SourceCmd event.) +" +" Author: Tom Ryder +" License: Same as Vim itself +" +if exists('g:loaded_reload_vimrc_filetype') || &compatible + finish +endif +if !has('autocmd') || v:version < 700 || v:version == 700 && !has('patch187') + finish +endif +let g:loaded_reload_vimrc_filetype = 1 + +function! s:Reload() + if &filetype !=# '' + doautocmd filetypedetect BufRead + endif + source $MYVIMRC + echomsg 'Reloaded vimrc: '.$MYVIMRC +endfunction + +augroup reload + autocmd SourceCmd $MYVIMRC + \ call s:Reload() +augroup END diff --git a/vim/vimrc b/vim/vimrc index 92052ece..fbe0f177 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -287,15 +287,3 @@ nnoremap :enew " Source any .vim files from ~/.vim/config runtime! config/*.vim - -" If we reloaded, reload filetype detection for the active buffer too, so that -" any local settings for it are restored -if exists('g:loaded_vimrc') - if &filetype !=# '' - doautocmd filetypedetect BufRead - endif - echomsg 'Reloaded vimrc: '.$MYVIMRC -endif -if 1 - let g:loaded_vimrc = 1 -endif -- cgit v1.2.3 From 942a9d81239516f7f318c37904108176a78e3098 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 13 Jul 2018 10:45:17 +1200 Subject: Remove visual mode space/backspace remap I'm not likely to use these. --- vim/vimrc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index fbe0f177..bb0a020f 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -168,13 +168,9 @@ vnoremap :nohlsearchgv inoremap (InsertCancel) u imap (InsertCancel) -" Remap normal/visual space to scroll down a page, backspace up +" Remap normal space to scroll down a page, backspace up a page nnoremap nnoremap -if v:version >= 700 - xnoremap - xnoremap -endif " Remap normal/visual & to preserve substitution flags nnoremap & :&& -- cgit v1.2.3 From 054f1b81d469dc8d153f03b04c2eee0bfc980414 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 13 Jul 2018 11:00:58 +1200 Subject: Rename and refine reload_vimrc_filetype.vim --- vim/plugin/reload.vim | 28 ---------------------------- vim/plugin/reload_vimrc_filetype.vim | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 28 deletions(-) delete mode 100644 vim/plugin/reload.vim create mode 100644 vim/plugin/reload_vimrc_filetype.vim diff --git a/vim/plugin/reload.vim b/vim/plugin/reload.vim deleted file mode 100644 index d1493ad1..00000000 --- a/vim/plugin/reload.vim +++ /dev/null @@ -1,28 +0,0 @@ -" -" reload_vimrc_filetype.vim: Add hook to reload active buffer's filetype when -" vimrc reloaded, so that we don't end up indenting four spaces in an open -" VimL file, etc. Requires Vim 7.1 or 7.0 with patch 187 (SourceCmd event.) -" -" Author: Tom Ryder -" License: Same as Vim itself -" -if exists('g:loaded_reload_vimrc_filetype') || &compatible - finish -endif -if !has('autocmd') || v:version < 700 || v:version == 700 && !has('patch187') - finish -endif -let g:loaded_reload_vimrc_filetype = 1 - -function! s:Reload() - if &filetype !=# '' - doautocmd filetypedetect BufRead - endif - source $MYVIMRC - echomsg 'Reloaded vimrc: '.$MYVIMRC -endfunction - -augroup reload - autocmd SourceCmd $MYVIMRC - \ call s:Reload() -augroup END diff --git a/vim/plugin/reload_vimrc_filetype.vim b/vim/plugin/reload_vimrc_filetype.vim new file mode 100644 index 00000000..d4f853b8 --- /dev/null +++ b/vim/plugin/reload_vimrc_filetype.vim @@ -0,0 +1,23 @@ +" +" reload_vimrc_filetype.vim: Add hook to reload active buffer's filetype when +" vimrc reloaded, so that we don't end up indenting four spaces in an open +" VimL file, etc. Requires Vim 7.1 or 7.0 with patch 187 (SourceCmd event.) +" +" Author: Tom Ryder +" License: Same as Vim itself +" +if exists('g:loaded_reload_vimrc_filetype') || &compatible + finish +endif +if !has('autocmd') || v:version < 700 || v:version == 700 && !has('patch187') + finish +endif +let g:loaded_reload_vimrc_filetype = 1 + +" This SourceCmd intercepts :source for .vimrc +augroup reload_vimrc_filetype + autocmd SourceCmd $MYVIMRC + \ source + \|doautocmd filetypedetect BufRead + \|echomsg 'Reloaded vimrc: '.expand('') +augroup END -- cgit v1.2.3 From 587de04765e69f3e32aa2067303322fa841c64b3 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 13 Jul 2018 13:25:13 +1200 Subject: Move to after headers when writing new mail --- vim/after/ftplugin/mail.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 3ecc0310..fa1b9443 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -3,6 +3,13 @@ if &filetype !=# 'mail' || v:version < 700 finish endif +" We will almost always want to start editing after the headers, so move to +" the first entirely blank line, if something hasn't already moved us from the +" start of the file +if line('.') == 1 && col('.') == 1 + call search('^$', 'c') +endif + " Add a space to the end of wrapped lines for format-flowed mail setlocal formatoptions+=w let b:undo_ftplugin .= '|setlocal formatoptions<' -- cgit v1.2.3 From 8640888fdfdee047e4f40df4a1a89510330f1fe4 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 13 Jul 2018 17:26:53 +1200 Subject: Remove :nohlsearch from vimrc This doesn't actually appear to be necessary. --- vim/vimrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index bb0a020f..5ae5421e 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -107,8 +107,7 @@ endif " Highlight settings for search if has('extra_search') - set hlsearch " Highlight completed searches... - nohlsearch " ...but clear it on startup or after re-sourcing + set hlsearch " Highlight completed searches set incsearch " Show matches as I type endif -- cgit v1.2.3 From 368a2dbab586406520b6693dad46ea90e718c8b1 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 13 Jul 2018 22:27:28 +1200 Subject: Upgrade put_blank_lines.vim plugin --- vim/bundle/put_blank_lines | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/bundle/put_blank_lines b/vim/bundle/put_blank_lines index a94f0e3c..206f8e15 160000 --- a/vim/bundle/put_blank_lines +++ b/vim/bundle/put_blank_lines @@ -1 +1 @@ -Subproject commit a94f0e3ceef7719d1f3baf2f381b6f8f009c646e +Subproject commit 206f8e15d4703fb8823d39ff99dcdaa61f2ee95c -- cgit v1.2.3 From 2e5f2b861b077193405684fe3c74de20f849ad5f Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 13 Jul 2018 23:53:55 +1200 Subject: Replace mail.vim quoting mappings --- vim/after/ftplugin/mail.vim | 16 +++++++++++++++- vim/autoload/mail.vim | 11 +++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 vim/autoload/mail.vim diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index fa1b9443..d22ec142 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -1,5 +1,5 @@ " Extra configuration for mail messages -if &filetype !=# 'mail' || v:version < 700 +if &filetype !=# 'mail' || &compatible || v:version < 700 finish endif @@ -13,3 +13,17 @@ endif " Add a space to the end of wrapped lines for format-flowed mail setlocal formatoptions+=w let b:undo_ftplugin .= '|setlocal formatoptions<' + +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_mail_maps') + finish +endif + +" The quote mapping in the stock plugin is a good idea, but I prefer it to +" work as a motion rather than quoting to the end of the buffer +nnoremap q mail#Quote() +nnoremap qq mail#Quote().'_' +xnoremap q mail#Quote() +let b:undo_ftplugin .= '|nunmap q' + \ . '|nunmap qq' + \ . '|xunmap q' diff --git a/vim/autoload/mail.vim b/vim/autoload/mail.vim new file mode 100644 index 00000000..4c21ae38 --- /dev/null +++ b/vim/autoload/mail.vim @@ -0,0 +1,11 @@ +" Quote lines in mail messages +function! mail#Quote() abort + set operatorfunc=mail#QuoteOpfunc + return 'g@' +endfunction +function! mail#QuoteOpfunc(type) abort + for l:li in range(line('''['), line(''']')) + let l:line = getline(l:li) + call setline(l:li, '>'.l:line) + endfor +endfunction -- cgit v1.2.3 From 03cb9550dbed17233f439b028c2dde885f111096 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 14 Jul 2018 00:39:58 +1200 Subject: Upgrade diff_prune.vim ftplugin --- vim/bundle/diff_prune | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/bundle/diff_prune b/vim/bundle/diff_prune index e015502f..50080840 160000 --- a/vim/bundle/diff_prune +++ b/vim/bundle/diff_prune @@ -1 +1 @@ -Subproject commit e015502fa63ff48ffb0493dd21106b0855f26364 +Subproject commit 50080840611c7111e10e71b0443d05b9ead76982 -- cgit v1.2.3 From ccb96bf4e5aaa737d945502360a426d74537c424 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 14 Jul 2018 01:16:00 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 530f7920..28d99f01 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v1.27.0 -Wed Jul 11 13:19:53 UTC 2018 +tejr dotfiles v1.28.0 +Fri Jul 13 13:15:52 UTC 2018 -- cgit v1.2.3