diff options
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | vim/after/ftplugin/mail.vim | 23 | ||||
-rw-r--r-- | vim/after/ftplugin/markdown.vim | 20 | ||||
-rw-r--r-- | vim/after/ftplugin/text.vim | 2 | ||||
-rw-r--r-- | vim/after/ftplugin/vim.vim | 2 | ||||
-rw-r--r-- | vim/autoload/mail.vim | 11 | ||||
m--------- | vim/bundle/diff_prune | 0 | ||||
m--------- | vim/bundle/put_blank_lines | 0 | ||||
-rw-r--r-- | vim/ftplugin/tmux.vim | 9 | ||||
-rw-r--r-- | vim/plugin/reload_vimrc_filetype.vim | 23 | ||||
-rw-r--r-- | vim/vimrc | 35 |
11 files changed, 89 insertions, 40 deletions
@@ -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 diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim index 3ecc0310..d22ec142 100644 --- a/vim/after/ftplugin/mail.vim +++ b/vim/after/ftplugin/mail.vim @@ -1,8 +1,29 @@ " Extra configuration for mail messages -if &filetype !=# 'mail' || v:version < 700 +if &filetype !=# 'mail' || &compatible || 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<' + +" 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 <buffer> <expr> <LocalLeader>q mail#Quote() +nnoremap <buffer> <expr> <LocalLeader>qq mail#Quote().'_' +xnoremap <buffer> <expr> <LocalLeader>q mail#Quote() +let b:undo_ftplugin .= '|nunmap <LocalLeader>q' + \ . '|nunmap <LocalLeader>qq' + \ . '|xunmap <LocalLeader>q' diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim index d2cf8918..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 &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 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 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') 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 diff --git a/vim/bundle/diff_prune b/vim/bundle/diff_prune -Subproject e015502fa63ff48ffb0493dd21106b0855f2636 +Subproject 50080840611c7111e10e71b0443d05b9ead7698 diff --git a/vim/bundle/put_blank_lines b/vim/bundle/put_blank_lines -Subproject a94f0e3ceef7719d1f3baf2f381b6f8f009c646 +Subproject 206f8e15d4703fb8823d39ff99dcdaa61f2ee95 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' 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 <tom@sanctum.geek.nz> +" 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 <afile> + \|doautocmd filetypedetect BufRead + \|echomsg 'Reloaded vimrc: '.expand('<afile>') +augroup END @@ -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 @@ -104,11 +97,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') @@ -117,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 @@ -178,13 +167,9 @@ vnoremap <silent> <C-L> :<C-U>nohlsearch<CR>gv<C-L> inoremap <Plug>(InsertCancel) <Esc>u imap <C-C> <Plug>(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 <Space> <C-F> nnoremap <BS> <C-B> -if v:version >= 700 - xnoremap <Space> <C-F> - xnoremap <BS> <C-B> -endif " Remap normal/visual & to preserve substitution flags nnoremap <silent> & :&&<CR> @@ -297,15 +282,3 @@ nnoremap <Bslash><Insert> :<C-U>enew<CR> " 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 |