Add 2 User events when mapping and unmapping

delimitMate has some nice logic for doing per-filetype mappings, but
this logic can't be used when users provide mappings directly. To remedy
this, add two User events `delimitMate_map` and `delimitMate_unmap` that
are fired at the appropriate times. Users can use these events to define
per-filetype mappings just as delimitMate does.
This commit is contained in:
Kevin Ballard
2014-12-29 18:39:12 -08:00
parent 6f4f1b06d3
commit 0739792d01
2 changed files with 44 additions and 8 deletions

View File

@@ -164,6 +164,7 @@ function! s:Map() "{{{
let save_cpo = &cpo
set keymap=
set cpo&vim
silent! doautocmd <nomodeline> User delimitMate_map
if s:g('autoclose')
call s:AutoClose()
else
@@ -200,6 +201,7 @@ function! s:Unmap() " {{{
exec 'silent! iunmap <buffer> ' . map
endif
endfor
silent! doautocmd <nomodeline> User delimitMate_unmap
let b:delimitMate_enabled = 0
endfunction " }}} s:Unmap()