aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vim/autoload/vimrc.vim6
-rw-r--r--vim/vimrc9
2 files changed, 11 insertions, 4 deletions
diff --git a/vim/autoload/vimrc.vim b/vim/autoload/vimrc.vim
index 356861c6..de73720b 100644
--- a/vim/autoload/vimrc.vim
+++ b/vim/autoload/vimrc.vim
@@ -3,6 +3,12 @@ function! vimrc#EscapeSet(string) abort
return escape(a:string, '\ ,')
endfunction
+" Check that we have a plugin available, and will be loading it
+function! vimrc#PluginReady(filename) abort
+ return globpath(&runtimepath, 'plugin/'.a:filename.'.vim') !=# ''
+ \ && &loadplugins
+endfunction
+
" Split a string with a split character that can be escaped with another,
" e.g. &runtimepath with commas and backslashes respectively
function! vimrc#SplitEscaped(str, ...) abort
diff --git a/vim/vimrc b/vim/vimrc
index b32b7ca6..6c5552d4 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -216,15 +216,16 @@ catch
set nocursorline
endtry
-" Space bar scrolls down a page, :next if plugin available
-if &loadplugins
+" Space bar scrolls down a page, :next at buffer's end if plugin available
+if vimrc#PluginReady('scroll_next')
nmap <Space> <Plug>(ScrollNext)
else
nnoremap <Space> <PageDown>
endif
-" Remap insert Ctrl-C to undo the escaped insert operation
-if &loadplugins " Don't break the key if we won't be loading the plugin
+" Remap insert Ctrl-C to undo the escaped insert operation, but don't break
+" the key if the plugin isn't there
+if vimrc#PluginReady('insert_cancel')
imap <C-C> <Plug>(InsertCancel)
endif