aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-11-13 00:16:55 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-13 00:16:55 +1300
commit0a717e403db652ca602603617642d8bc7de7e9bb (patch)
treee2be9751fd22fe7cc3f19f44c48d20531fe66cdd /vim/plugin
parentMerge branch 'release/v0.14.0' (diff)
parentBump version number to 0.15.0 (diff)
downloaddotfiles-ee751bcd3c3fa19c41368f244c7fdb3851736491.tar.gz (sig)
dotfiles-ee751bcd3c3fa19c41368f244c7fdb3851736491.zip
Merge branch 'release/v0.15.0'v0.15.0
* release/v0.15.0: (24 commits) Bump version number to 0.15.0 Limit \f mapping to normal mode Move 'hlsearch' insert-mode suspension into plugin Separate g:loaded/&cp tests from feat tests Use :set not :setlocal for 'hlsearch'/'incsearch' Correct nonexistent 'wildmode' value in Vim config Document each 'backspace' flag in Vim config Mention req of toggle_option_flag.vim Adjust first sentence of format_option_toggle.txt Add help links to toggle_option_flag.vim interface Flesh out strip_trailing_whitespace.vim help Specify type of example in mail_mutt.vim doc Adjust layout of headings/links in Vim plugin help Flesh out fixed_join.vim interface documentation Add help tag for detect_background.vim function Flesh out copy_linebreak.vim interface docs Remove nonexistent keyword references from Vim doc Move Vim doc requirement to correct section Apply boilerplate to Vim plugin docs Update and correct detect_background.vim help ...
Diffstat (limited to 'vim/plugin')
-rw-r--r--vim/plugin/auto_undodir.vim5
-rw-r--r--vim/plugin/big_file_options.vim5
-rw-r--r--vim/plugin/command_typos.vim5
-rw-r--r--vim/plugin/copy_linebreak.vim5
-rw-r--r--vim/plugin/fixed_join.vim6
-rw-r--r--vim/plugin/insert_suspend_hlsearch.vim48
-rw-r--r--vim/plugin/mail_mutt.vim6
-rw-r--r--vim/plugin/toggle_option_flag.vim5
8 files changed, 78 insertions, 7 deletions
diff --git a/vim/plugin/auto_undodir.vim b/vim/plugin/auto_undodir.vim
index 9a686fb1..cf8d896a 100644
--- a/vim/plugin/auto_undodir.vim
+++ b/vim/plugin/auto_undodir.vim
@@ -5,7 +5,10 @@
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
-if exists('g:loaded_auto_undodir') || &compatible || !has('persistent_undo')
+if exists('g:loaded_auto_undodir') || &compatible
+ finish
+endif
+if !has('persistent_undo')
finish
endif
let g:loaded_auto_undodir = 1
diff --git a/vim/plugin/big_file_options.vim b/vim/plugin/big_file_options.vim
index cbbacc42..f7fa0281 100644
--- a/vim/plugin/big_file_options.vim
+++ b/vim/plugin/big_file_options.vim
@@ -5,7 +5,10 @@
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
-if exists('g:loaded_big_file_options') || &compatible || !has('autocmd')
+if exists('g:loaded_big_file_options') || &compatible
+ finish
+endif
+if !has('autocmd')
finish
endif
let g:loaded_big_file_options = 1
diff --git a/vim/plugin/command_typos.vim b/vim/plugin/command_typos.vim
index afc04ed3..6f34c680 100644
--- a/vim/plugin/command_typos.vim
+++ b/vim/plugin/command_typos.vim
@@ -7,7 +7,10 @@
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
-if exists('g:loaded_command_typos') || &compatible || !has('user_commands')
+if exists('g:loaded_command_typos') || &compatible
+ finish
+endif
+if !has('user_commands')
finish
endif
let g:loaded_command_typos = 1
diff --git a/vim/plugin/copy_linebreak.vim b/vim/plugin/copy_linebreak.vim
index 158282bf..9d241d5a 100644
--- a/vim/plugin/copy_linebreak.vim
+++ b/vim/plugin/copy_linebreak.vim
@@ -6,7 +6,10 @@
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
-if exists('g:loaded_copy_linebreak') || &compatible || !has('linebreak')
+if exists('g:loaded_copy_linebreak') || &compatible
+ finish
+endif
+if !has('linebreak')
finish
endif
let g:loaded_copy_linebreak = 1
diff --git a/vim/plugin/fixed_join.vim b/vim/plugin/fixed_join.vim
index 83977c2f..2e7f2abd 100644
--- a/vim/plugin/fixed_join.vim
+++ b/vim/plugin/fixed_join.vim
@@ -31,6 +31,12 @@ noremap <silent> <unique>
\ <Plug>FixedJoin
\ :<C-U>call <SID>FixedJoin()<CR>
+" If there's no mapping to it already, try to bind normal-mode J to it, to
+" simply replace the old functionality
+nmap <unique>
+ \ J
+ \ <Plug>FixedJoin
+
" Create a command as well in case it's useful
if has('user_commands')
command -nargs=0
diff --git a/vim/plugin/insert_suspend_hlsearch.vim b/vim/plugin/insert_suspend_hlsearch.vim
new file mode 100644
index 00000000..378febc8
--- /dev/null
+++ b/vim/plugin/insert_suspend_hlsearch.vim
@@ -0,0 +1,48 @@
+"
+" insert_suspend_hlsearch.vim: If 'hlsearch' is enabled, switch it off when
+" the user starts an insert mode operation, and back on again when they're
+" done.
+"
+" Author: Tom Ryder <tom@sanctum.geek.nz>
+" License: Same as Vim itself
+"
+if exists('g:loaded_insert_suspend_hlsearch') || &compatible
+ finish
+endif
+" InsertEnter isn't an autocmd event until 7.0
+if !has('autocmd') || v:version < 700
+ finish
+endif
+let g:loaded_insert_suspend_hlsearch = 1
+
+" When entering insert mode, copy the current value of the 'hlsearch' option
+" into a script variable; if it's enabled, suspend it
+function s:InsertEnter()
+ let s:hlsearch = &hlsearch
+ echo &hlsearch
+ if s:hlsearch
+ set nohlsearch
+ endif
+ return
+endfunction
+
+" When leaving insert mode, if 'hlsearch' was enabled when this operation
+" started, restore it
+function s:InsertLeave()
+ if s:hlsearch
+ set hlsearch
+ endif
+ return
+endfunction
+
+" Clear search highlighting as soon as I enter insert mode, and restore it
+" once I leave it
+augroup insert_suspend_hlsearch
+ autocmd!
+ autocmd InsertEnter
+ \ *
+ \ call <SID>InsertEnter()
+ autocmd InsertLeave
+ \ *
+ \ call <SID>InsertLeave()
+augroup END
diff --git a/vim/plugin/mail_mutt.vim b/vim/plugin/mail_mutt.vim
index 24ce01dd..5170fb52 100644
--- a/vim/plugin/mail_mutt.vim
+++ b/vim/plugin/mail_mutt.vim
@@ -5,7 +5,10 @@
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
-if exists('g:loaded_mail_mutt') || &compatible || !has('user_commands')
+if exists('g:loaded_mail_mutt') || &compatible
+ finish
+endif
+if !has('user_commands')
finish
endif
let g:loaded_mail_mutt = 1
@@ -27,7 +30,6 @@ function! s:MailMutt(start, end)
let l:command = 'write ' . fnameescape(l:tf)
execute l:range . l:command
-
" Run mutt(1) with that file as its input
execute '!mutt -i ' . shellescape(l:tf)
diff --git a/vim/plugin/toggle_option_flag.vim b/vim/plugin/toggle_option_flag.vim
index 5c848368..bc7ccd78 100644
--- a/vim/plugin/toggle_option_flag.vim
+++ b/vim/plugin/toggle_option_flag.vim
@@ -5,7 +5,10 @@
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
-if exists('g:loaded_toggle_option_flag') || &compatible || !has('user_commands')
+if exists('g:loaded_toggle_option_flag') || &compatible
+ finish
+endif
+if !has('user_commands')
finish
endif
let g:loaded_toggle_option_flag = 1