aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin
diff options
context:
space:
mode:
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