Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improve mapping for Vim, using <Plug> maps>

Add redirection through <Plug>SparkupExecute and <Plug>SparkupNext and
check if mappings are defined for them before assigning default maps.
  • Loading branch information...
commit 72deab12279a9222ae586ade9acffcb442c71551 1 parent 7ab92a4
@blueyed authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 vim/ftplugin/html/sparkup.vim
View
11 vim/ftplugin/html/sparkup.vim
@@ -26,8 +26,15 @@ if !exists('g:sparkupNextMapping')
let g:sparkupNextMapping = '<c-n>'
endif
-exec 'imap <buffer> ' . g:sparkupExecuteMapping . ' <c-g>u<Esc>:call <SID>Sparkup()<cr>'
-exec 'imap <buffer> ' . g:sparkupNextMapping . ' <c-g>u<Esc>:call <SID>SparkupNext()<cr>'
+imap <buffer> <Plug>SparkupExecute <c-g>u<Esc>:call <SID>Sparkup()<cr>
+imap <buffer> <Plug>SparkupNext <c-g>u<Esc>:call <SID>SparkupNext()<cr>
+
+if ! hasmapto('<Plug>SparkupExecute', 'i')
+ exec 'imap <buffer> ' . g:sparkupExecuteMapping . ' <Plug>SparkupExecute'
+endif
+if ! hasmapto('<Plug>SparkupNext', 'i')
+ exec 'imap <buffer> ' . g:sparkupNextMapping . ' <Plug>SparkupNext'
+endif
if exists('*s:Sparkup')
finish
Please sign in to comment.
Something went wrong with that request. Please try again.