aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-14 20:52:49 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-14 20:52:49 +1200
commit720b6971850e636912737fe9bcb72fb0d566f344 (patch)
tree4311fd0fbb3a936021de33172804e16bd72816ef
parentMerge branch 'release/v1.29.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-720b6971850e636912737fe9bcb72fb0d566f344.tar.gz
dotfiles-720b6971850e636912737fe9bcb72fb0d566f344.zip
Merge branch 'release/v1.30.0'v1.30.0
* release/v1.30.0: Bump VERSION Revert "Remove :nohlsearch from vimrc" Spin off vimrc_reload_filetype.vim Add mail quote maps for gitcommit and markdown Expand and comment quoting functions Change mail quoting to generic autoload function Remove bell settings from .gvimrc
-rw-r--r--.gitmodules3
-rw-r--r--VERSION4
-rw-r--r--vim/after/ftplugin/gitcommit.vim13
-rw-r--r--vim/after/ftplugin/mail.vim6
-rw-r--r--vim/after/ftplugin/markdown.vim13
-rw-r--r--vim/autoload/mail.vim11
-rw-r--r--vim/autoload/quote.vim30
m---------vim/bundle/vimrc_reload_filetype0
-rw-r--r--vim/gvimrc5
-rw-r--r--vim/plugin/reload_vimrc_filetype.vim23
-rw-r--r--vim/vimrc3
11 files changed, 66 insertions, 45 deletions
diff --git a/.gitmodules b/.gitmodules
index e52d990e..4565f637 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -71,3 +71,6 @@
[submodule "vim/bundle/digraph_search"]
path = vim/bundle/digraph_search
url = https://sanctum.geek.nz/code/vim-digraph-search.git
+[submodule "vim/bundle/vimrc_reload_filetype"]
+ path = vim/bundle/vimrc_reload_filetype
+ url = https://sanctum.geek.nz/code/vim-vimrc-reload-filetype.git
diff --git a/VERSION b/VERSION
index 6e27dfbc..88dba5bf 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-tejr dotfiles v1.29.0
-Sat Jul 14 07:27:12 UTC 2018
+tejr dotfiles v1.30.0
+Sat Jul 14 08:52:21 UTC 2018
diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim
index 8e365d98..4f57a407 100644
--- a/vim/after/ftplugin/gitcommit.vim
+++ b/vim/after/ftplugin/gitcommit.vim
@@ -7,3 +7,16 @@ endif
setlocal comments+=n:>
setlocal formatoptions+=coqr
let b:undo_ftplugin .= '|setlocal comments< formatoptions<'
+
+" Stop here if the user doesn't want ftplugin mappings
+if exists('g:no_plugin_maps') || exists('g:no_gitcommit_maps')
+ finish
+endif
+
+" Mail quote mappings
+nnoremap <buffer> <expr> <LocalLeader>q quote#Quote()
+nnoremap <buffer> <expr> <LocalLeader>qq quote#Quote().'_'
+xnoremap <buffer> <expr> <LocalLeader>q quote#Quote()
+let b:undo_ftplugin .= '|nunmap <LocalLeader>q'
+ \ . '|nunmap <LocalLeader>qq'
+ \ . '|xunmap <LocalLeader>q'
diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim
index d22ec142..0867311a 100644
--- a/vim/after/ftplugin/mail.vim
+++ b/vim/after/ftplugin/mail.vim
@@ -21,9 +21,9 @@ 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()
+nnoremap <buffer> <expr> <LocalLeader>q quote#Quote()
+nnoremap <buffer> <expr> <LocalLeader>qq quote#Quote().'_'
+xnoremap <buffer> <expr> <LocalLeader>q quote#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 63f3f062..26b42849 100644
--- a/vim/after/ftplugin/markdown.vim
+++ b/vim/after/ftplugin/markdown.vim
@@ -20,3 +20,16 @@ if has('spell')
endif
endif
+
+" Stop here if the user doesn't want ftplugin mappings
+if exists('g:no_plugin_maps') || exists('g:no_markdown_maps')
+ finish
+endif
+
+" Mail quote mappings
+nnoremap <buffer> <expr> <LocalLeader>q quote#Quote()
+nnoremap <buffer> <expr> <LocalLeader>qq quote#Quote().'_'
+xnoremap <buffer> <expr> <LocalLeader>q quote#Quote()
+let b:undo_ftplugin .= '|nunmap <LocalLeader>q'
+ \ . '|nunmap <LocalLeader>qq'
+ \ . '|xunmap <LocalLeader>q'
diff --git a/vim/autoload/mail.vim b/vim/autoload/mail.vim
deleted file mode 100644
index 4c21ae38..00000000
--- a/vim/autoload/mail.vim
+++ /dev/null
@@ -1,11 +0,0 @@
-" 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/autoload/quote.vim b/vim/autoload/quote.vim
new file mode 100644
index 00000000..6e943091
--- /dev/null
+++ b/vim/autoload/quote.vim
@@ -0,0 +1,30 @@
+" Quote lines in mail and mail-based formats: Markdown, Git commits, etc
+
+" Operator function wrapper for the mapping to call
+function! quote#Quote() abort
+ set operatorfunc=quote#QuoteOpfunc
+ return 'g@'
+endfunction
+
+" Quoting operator function
+function! quote#QuoteOpfunc(type) abort
+
+ " May as well make this configurable
+ let l:char = exists('b:quote_char')
+ \ ? b:quote_char
+ \ : '>'
+
+ " Iterate over each matched line
+ for l:li in range(line('''['), line(''']'))
+
+ " Only add a space after the quote character if this line isn't already
+ " quoted with the same character
+ let l:cur = getline(l:li)
+ let l:new = stridx(l:cur, l:char) == 0
+ \ ? l:char.l:cur
+ \ : l:char.' '.l:cur
+ call setline(l:li, l:new)
+
+ endfor
+
+endfunction
diff --git a/vim/bundle/vimrc_reload_filetype b/vim/bundle/vimrc_reload_filetype
new file mode 160000
+Subproject 34f746015a76fda53b70dda91f81edf41f75d47
diff --git a/vim/gvimrc b/vim/gvimrc
index 1dca44e4..33301da8 100644
--- a/vim/gvimrc
+++ b/vim/gvimrc
@@ -13,8 +13,3 @@ set guioptions+=M " Don't load menu.vim (also set in .vimrc)
" Don't use the mouse
set mouse=
-
-" Stamp 'visualbell' back down again, if 'belloff' not available
-if !exists('+belloff')
- set visualbell t_vb=
-endif
diff --git a/vim/plugin/reload_vimrc_filetype.vim b/vim/plugin/reload_vimrc_filetype.vim
deleted file mode 100644
index d4f853b8..00000000
--- a/vim/plugin/reload_vimrc_filetype.vim
+++ /dev/null
@@ -1,23 +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 <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
diff --git a/vim/vimrc b/vim/vimrc
index e76fe85e..93b437d7 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -112,7 +112,8 @@ endif
" Highlight settings for search
if has('extra_search')
- set hlsearch " Highlight completed searches
+ set hlsearch " Highlight completed searches...
+ nohlsearch " ...but clear it on startup or after re-sourcing
set incsearch " Show matches as I type
endif