aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2019-12-14 17:53:55 +0100
committerTeddy Wing2019-12-14 17:53:55 +0100
commit92067a48d822307a9167908648f87c1f370612c5 (patch)
tree69c991007fe6c961ec1ffb12dc2bc21bb1b10d4b
parent6d86b086fd480c2403eb93775f72ac67aea41ca1 (diff)
downloadvim-nohai-92067a48d822307a9167908648f87c1f370612c5.tar.bz2
plugin/nohai.vim: Add a load guard
In addition to the default, don't load the plugin if the `CmdlineEnter` and `CmdlineLeave` autocmd events don't exist. Learned that these events were introduced in Vim 8.0.1206: https://vi.stackexchange.com/questions/15875/how-to-test-if-certain-event-is-supported
-rw-r--r--plugin/nohai.vim7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugin/nohai.vim b/plugin/nohai.vim
index f5c42aa..13a4d27 100644
--- a/plugin/nohai.vim
+++ b/plugin/nohai.vim
@@ -1,3 +1,10 @@
+if exists('g:loaded_nohai')
+ \ || !exists('##CmdlineEnter')
+ \ || !exists('##CmdlineLeave')
+ finish
+endif
+let g:loaded_nohai = 1
+
nnoremap <expr> <Plug>(nohai-search-backward) nohai#Search('?')
nnoremap <expr> <Plug>(nohai-search) nohai#Search('/')