Skip to content
Browse files

Add `g:endwise_no_mappings` to allow skipping maps

This allows to work around issues like issue #22
(#22)
  • Loading branch information...
1 parent 2a61d25 commit 33f9ee05b7e62ba85a20ea38095820cf091b35e3 @blueyed blueyed committed with Sep 19, 2012
Showing with 17 additions and 14 deletions.
  1. +17 −14 plugin/endwise.vim
View
31 plugin/endwise.vim
@@ -45,21 +45,24 @@ if maparg("<Plug>DiscretionaryEnd") == ""
imap <script> <Plug>DiscretionaryEnd <SID>DiscretionaryEnd
imap <script> <Plug>AlwaysEnd <SID>AlwaysEnd
endif
-if maparg('<CR>','i') =~# '<C-R>=.*crend(.)<CR>\|<\%(Plug\|SNR\)>.*End'
- " Already mapped
-elseif maparg('<CR>','i') =~ '<CR>'
- exe "imap <script> <C-X><CR> ".maparg('<CR>','i')."<SID>AlwaysEnd"
- exe "imap <script> <CR> ".maparg('<CR>','i')."<SID>DiscretionaryEnd"
-elseif maparg('<CR>','i') =~ '<Plug>delimitMateCR'
- exe "imap <C-X><CR> ".maparg('<CR>', 'i')."<Plug>AlwaysEnd"
- exe "imap <CR> ".maparg('<CR>', 'i')."<Plug>DiscretionaryEnd"
-else
- imap <C-X><CR> <CR><Plug>AlwaysEnd
- imap <CR> <CR><Plug>DiscretionaryEnd
-endif
-if maparg('<M-o>','i') == ''
- inoremap <M-o> <C-O>o
+if !exists('g:endwise_no_mappings')
+ if maparg('<CR>','i') =~# '<C-R>=.*crend(.)<CR>\|<\%(Plug\|SNR\)>.*End'
+ " Already mapped
+ elseif maparg('<CR>','i') =~ '<CR>'
+ exe "imap <script> <C-X><CR> ".maparg('<CR>','i')."<SID>AlwaysEnd"
+ exe "imap <script> <CR> ".maparg('<CR>','i')."<SID>DiscretionaryEnd"
+ elseif maparg('<CR>','i') =~ '<Plug>delimitMateCR'
+ exe "imap <C-X><CR> ".maparg('<CR>', 'i')."<Plug>AlwaysEnd"
+ exe "imap <CR> ".maparg('<CR>', 'i')."<Plug>DiscretionaryEnd"
+ else
+ imap <C-X><CR> <CR><Plug>AlwaysEnd
+ imap <CR> <CR><Plug>DiscretionaryEnd
+ endif
+
+ if maparg('<M-o>','i') == ''
+ inoremap <M-o> <C-O>o
+ endif
endif
" }}}1

0 comments on commit 33f9ee0

Please sign in to comment.
Something went wrong with that request. Please try again.