Expansion functions are global now.

This could help when creating custom mappings for <CR> and <Space>.
This commit is contained in:
Israel Chauca Fuentes
2010-03-29 21:08:59 -05:00
parent 4c8f55722d
commit 5e8f9eacac

View File

@@ -410,7 +410,7 @@ function! s:VisualMaps() " {{{
endfor endfor
endfunction "}}} endfunction "}}}
function! s:ExpandReturn() "{{{ function! DelimitMate_ExpandReturn() "{{{
if DelimitMate_WithinEmptyPair() if DelimitMate_WithinEmptyPair()
" Expand: " Expand:
return "\<esc>a\<CR>x\<CR>\<esc>k$\"_xa" return "\<esc>a\<CR>x\<CR>\<esc>k$\"_xa"
@@ -420,7 +420,7 @@ function! s:ExpandReturn() "{{{
endif endif
endfunction "}}} endfunction "}}}
function! s:ExpandSpace() "{{{ function! DelimitMate_ExpandSpace() "{{{
if DelimitMate_WithinEmptyPair() if DelimitMate_WithinEmptyPair()
" Expand: " Expand:
return s:WriteAfter(' ')."\<Space>" return s:WriteAfter(' ')."\<Space>"
@@ -439,12 +439,12 @@ function! s:ExtraMappings() "{{{
" Expand return if inside an empty pair: " Expand return if inside an empty pair:
if b:delimitMate_expand_cr != 0 if b:delimitMate_expand_cr != 0
inoremap <buffer> <CR> <C-R>=<SID>ExpandReturn()<CR> inoremap <buffer> <CR> <C-R>=DelimitMate_ExpandReturn()<CR>
endif endif
" Expand space if inside an empty pair: " Expand space if inside an empty pair:
if b:delimitMate_expand_space != 0 if b:delimitMate_expand_space != 0
inoremap <buffer> <Space> <C-R>=<SID>ExpandSpace()<CR> inoremap <buffer> <Space> <C-R>=DelimitMate_ExpandSpace()<CR>
endif endif
" Jump out ot any empty pair: " Jump out ot any empty pair:
@@ -563,11 +563,11 @@ function! s:UnMap() " {{{
silent! iunmap <buffer> <BS> silent! iunmap <buffer> <BS>
"echomsg "silent! iunmap <buffer> <BS>" "echomsg "silent! iunmap <buffer> <BS>"
endif endif
if maparg('<CR>',"i") =~? 'ExpandReturn' if maparg('<CR>',"i") =~? 'DelimitMate_ExpandReturn'
silent! iunmap <buffer> <CR> silent! iunmap <buffer> <CR>
"echomsg "silent! iunmap <buffer> <CR>" "echomsg "silent! iunmap <buffer> <CR>"
endif endif
if maparg('<Space>',"i") =~? 'ExpandSpace' if maparg('<Space>',"i") =~? 'DelimitMate_ExpandSpace'
silent! iunmap <buffer> <Space> silent! iunmap <buffer> <Space>
"echomsg "silent! iunmap <buffer> <Space>" "echomsg "silent! iunmap <buffer> <Space>"
endif endif