aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-14 19:42:02 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-14 19:42:02 +1200
commit2985baeea1e41f87eba6c695bed848493d3ac9c8 (patch)
tree6f8ef93f290c61c946008c3fe8b06e2d9cbb7f97 /vim
parentd367763e6a99e79debfc4c6ed52964e6f1f20b25 (diff)
downloaddotfiles-2985baeea1e41f87eba6c695bed848493d3ac9c8.tar.gz
dotfiles-2985baeea1e41f87eba6c695bed848493d3ac9c8.zip
Change mail quoting to generic autoload function
I intend to use it elsewhere.
Diffstat (limited to 'vim')
-rw-r--r--vim/after/ftplugin/mail.vim6
-rw-r--r--vim/autoload/mail.vim11
-rw-r--r--vim/autoload/quote.vim11
3 files changed, 14 insertions, 14 deletions
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/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..92de5035
--- /dev/null
+++ b/vim/autoload/quote.vim
@@ -0,0 +1,11 @@
+" Quote lines in mail and mail-based formats: Markdown, Git commits, etc
+function! quote#Quote() abort
+ set operatorfunc=quote#QuoteOpfunc
+ return 'g@'
+endfunction
+function! quote#QuoteOpfunc(type) abort
+ for l:li in range(line('''['), line(''']'))
+ let l:line = getline(l:li)
+ call setline(l:li, '>'.l:line)
+ endfor
+endfunction