Indent with spaces.

This commit is contained in:
Israel Chauca Fuentes
2015-01-04 20:25:50 -05:00
parent c23ef684e3
commit ac792c01b6
2 changed files with 852 additions and 852 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -9,354 +9,354 @@
" Initialization: {{{ " Initialization: {{{
if exists("g:loaded_delimitMate") || &cp if exists("g:loaded_delimitMate") || &cp
" User doesn't want this plugin or compatible is set, let's get out! " User doesn't want this plugin or compatible is set, let's get out!
finish finish
endif endif
let g:loaded_delimitMate = 1 let g:loaded_delimitMate = 1
let save_cpo = &cpo let save_cpo = &cpo
set cpo&vim set cpo&vim
if v:version < 700 if v:version < 700
echoerr "delimitMate: this plugin requires vim >= 7!" echoerr "delimitMate: this plugin requires vim >= 7!"
finish finish
endif endif
let s:loaded_delimitMate = 1 let s:loaded_delimitMate = 1
let delimitMate_version = "2.7" let delimitMate_version = "2.8"
"}}} "}}}
" Functions: {{{ " Functions: {{{
function! s:option_init(name, default) "{{{ function! s:option_init(name, default) "{{{
let b = exists("b:delimitMate_" . a:name) let b = exists("b:delimitMate_" . a:name)
let g = exists("g:delimitMate_" . a:name) let g = exists("g:delimitMate_" . a:name)
" Find value to use. " Find value to use.
if !b && !g if !b && !g
let value = a:default let value = a:default
elseif b elseif b
exec "let value = b:delimitMate_" . a:name exec "let value = b:delimitMate_" . a:name
else else
exec "let value = g:delimitMate_" . a:name exec "let value = g:delimitMate_" . a:name
endif endif
call s:s(a:name, value) call s:s(a:name, value)
endfunction "}}} endfunction "}}}
function! s:init() "{{{ function! s:init() "{{{
" Initialize variables: " Initialize variables:
" autoclose " autoclose
call s:option_init("autoclose", 1) call s:option_init("autoclose", 1)
" matchpairs " matchpairs
call s:option_init("matchpairs", string(&matchpairs)[1:-2]) call s:option_init("matchpairs", string(&matchpairs)[1:-2])
call s:option_init("matchpairs_list", map(split(s:g('matchpairs'), ','), 'split(v:val, '':'')')) call s:option_init("matchpairs_list", map(split(s:g('matchpairs'), ','), 'split(v:val, '':'')'))
let pairs = s:g('matchpairs_list') let pairs = s:g('matchpairs_list')
if len(filter(pairs, 'v:val[0] ==# v:val[1]')) if len(filter(pairs, 'v:val[0] ==# v:val[1]'))
echohl ErrorMsg echohl ErrorMsg
echom 'delimitMate: each member of a pair in delimitMate_matchpairs must be different from each other.' echom 'delimitMate: each member of a pair in delimitMate_matchpairs must be different from each other.'
echom 'delimitMate: invalid pairs: ' . join(map(pairs, 'join(v:val, ":")'), ', ') echom 'delimitMate: invalid pairs: ' . join(map(pairs, 'join(v:val, ":")'), ', ')
echohl Normal echohl Normal
return 0 return 0
endif endif
call s:option_init("left_delims", map(copy(s:g('matchpairs_list')), 'v:val[0]')) call s:option_init("left_delims", map(copy(s:g('matchpairs_list')), 'v:val[0]'))
call s:option_init("right_delims", map(copy(s:g('matchpairs_list')), 'v:val[1]')) call s:option_init("right_delims", map(copy(s:g('matchpairs_list')), 'v:val[1]'))
" quotes " quotes
call s:option_init("quotes", "\" ' `") call s:option_init("quotes", "\" ' `")
call s:option_init("quotes_list",split(s:g('quotes'), '\s\+')) call s:option_init("quotes_list",split(s:g('quotes'), '\s\+'))
" nesting_quotes " nesting_quotes
call s:option_init("nesting_quotes", []) call s:option_init("nesting_quotes", [])
" excluded_regions " excluded_regions
call s:option_init("excluded_regions", "Comment") call s:option_init("excluded_regions", "Comment")
call s:option_init("excluded_regions_list", split(s:g('excluded_regions'), ',\s*')) call s:option_init("excluded_regions_list", split(s:g('excluded_regions'), ',\s*'))
let enabled = len(s:g('excluded_regions_list')) > 0 let enabled = len(s:g('excluded_regions_list')) > 0
call s:option_init("excluded_regions_enabled", enabled) call s:option_init("excluded_regions_enabled", enabled)
" expand_space " expand_space
if exists("b:delimitMate_expand_space") && type(b:delimitMate_expand_space) == type("") if exists("b:delimitMate_expand_space") && type(b:delimitMate_expand_space) == type("")
echom "b:delimitMate_expand_space is '".b:delimitMate_expand_space."' but it must be either 1 or 0!" echom "b:delimitMate_expand_space is '".b:delimitMate_expand_space."' but it must be either 1 or 0!"
echom "Read :help 'delimitMate_expand_space' for more details." echom "Read :help 'delimitMate_expand_space' for more details."
unlet b:delimitMate_expand_space unlet b:delimitMate_expand_space
let b:delimitMate_expand_space = 1 let b:delimitMate_expand_space = 1
endif endif
if exists("g:delimitMate_expand_space") && type(g:delimitMate_expand_space) == type("") if exists("g:delimitMate_expand_space") && type(g:delimitMate_expand_space) == type("")
echom "delimitMate_expand_space is '".g:delimitMate_expand_space."' but it must be either 1 or 0!" echom "delimitMate_expand_space is '".g:delimitMate_expand_space."' but it must be either 1 or 0!"
echom "Read :help 'delimitMate_expand_space' for more details." echom "Read :help 'delimitMate_expand_space' for more details."
unlet g:delimitMate_expand_space unlet g:delimitMate_expand_space
let g:delimitMate_expand_space = 1 let g:delimitMate_expand_space = 1
endif endif
call s:option_init("expand_space", 0) call s:option_init("expand_space", 0)
" expand_cr " expand_cr
if exists("b:delimitMate_expand_cr") && type(b:delimitMate_expand_cr) == type("") if exists("b:delimitMate_expand_cr") && type(b:delimitMate_expand_cr) == type("")
echom "b:delimitMate_expand_cr is '".b:delimitMate_expand_cr."' but it must be either 1 or 0!" echom "b:delimitMate_expand_cr is '".b:delimitMate_expand_cr."' but it must be either 1 or 0!"
echom "Read :help 'delimitMate_expand_cr' for more details." echom "Read :help 'delimitMate_expand_cr' for more details."
unlet b:delimitMate_expand_cr unlet b:delimitMate_expand_cr
let b:delimitMate_expand_cr = 1 let b:delimitMate_expand_cr = 1
endif endif
if exists("g:delimitMate_expand_cr") && type(g:delimitMate_expand_cr) == type("") if exists("g:delimitMate_expand_cr") && type(g:delimitMate_expand_cr) == type("")
echom "delimitMate_expand_cr is '".g:delimitMate_expand_cr."' but it must be either 1 or 0!" echom "delimitMate_expand_cr is '".g:delimitMate_expand_cr."' but it must be either 1 or 0!"
echom "Read :help 'delimitMate_expand_cr' for more details." echom "Read :help 'delimitMate_expand_cr' for more details."
unlet g:delimitMate_expand_cr unlet g:delimitMate_expand_cr
let g:delimitMate_expand_cr = 1 let g:delimitMate_expand_cr = 1
endif endif
if ((&backspace !~ 'eol' || &backspace !~ 'start') && &backspace != 2) && if ((&backspace !~ 'eol' || &backspace !~ 'start') && &backspace != 2) &&
\ ((exists('b:delimitMate_expand_cr') && b:delimitMate_expand_cr == 1) || \ ((exists('b:delimitMate_expand_cr') && b:delimitMate_expand_cr == 1) ||
\ (exists('g:delimitMate_expand_cr') && g:delimitMate_expand_cr == 1)) \ (exists('g:delimitMate_expand_cr') && g:delimitMate_expand_cr == 1))
echom "delimitMate: There seems to be some incompatibility with your settings that may interfer with the expansion of <CR>. See :help 'delimitMate_expand_cr' for details." echom "delimitMate: There seems to be some incompatibility with your settings that may interfer with the expansion of <CR>. See :help 'delimitMate_expand_cr' for details."
endif endif
call s:option_init("expand_cr", 0) call s:option_init("expand_cr", 0)
" expand_in_quotes " expand_in_quotes
call s:option_init('expand_inside_quotes', 0) call s:option_init('expand_inside_quotes', 0)
" jump_expansion " jump_expansion
call s:option_init("jump_expansion", 0) call s:option_init("jump_expansion", 0)
" smart_matchpairs " smart_matchpairs
call s:option_init("smart_matchpairs", '^\%(\w\|\!\|£\|\$\|_\)') call s:option_init("smart_matchpairs", '^\%(\w\|\!\|£\|\$\|_\)')
" smart_quotes " smart_quotes
" XXX: backward compatibility. Ugly, should go the way of the dodo soon. " XXX: backward compatibility. Ugly, should go the way of the dodo soon.
let quotes = escape(join(s:g('quotes_list'), ''), '\-^[]') let quotes = escape(join(s:g('quotes_list'), ''), '\-^[]')
let default_smart_quotes = '\%(\w\|[^[:punct:][:space:]' . quotes . ']\|\%(\\\\\)*\\\)\%#\|\%#\%(\w\|[^[:space:][:punct:]' . quotes . ']\)' let default_smart_quotes = '\%(\w\|[^[:punct:][:space:]' . quotes . ']\|\%(\\\\\)*\\\)\%#\|\%#\%(\w\|[^[:space:][:punct:]' . quotes . ']\)'
if exists('g:delimitMate_smart_quotes') && type(g:delimitMate_smart_quotes) == type(0) if exists('g:delimitMate_smart_quotes') && type(g:delimitMate_smart_quotes) == type(0)
if g:delimitMate_smart_quotes if g:delimitMate_smart_quotes
unlet g:delimitMate_smart_quotes unlet g:delimitMate_smart_quotes
else else
unlet g:delimitMate_smart_quotes unlet g:delimitMate_smart_quotes
let g:delimitMate_smart_quotes = '' let g:delimitMate_smart_quotes = ''
endif endif
endif endif
if exists('b:delimitMate_smart_quotes') && type(b:delimitMate_smart_quotes) == type(0) if exists('b:delimitMate_smart_quotes') && type(b:delimitMate_smart_quotes) == type(0)
if b:delimitMate_smart_quotes if b:delimitMate_smart_quotes
unlet b:delimitMate_smart_quotes unlet b:delimitMate_smart_quotes
if exists('g:delimitMate_smart_quotes') && type(g:delimitMate_smart_quotes) && g:delimitMate_smart_quotes if exists('g:delimitMate_smart_quotes') && type(g:delimitMate_smart_quotes) && g:delimitMate_smart_quotes
let b:delimitMate_smart_quotes = default_smart_quotes let b:delimitMate_smart_quotes = default_smart_quotes
endif endif
else else
unlet b:delimitMate_smart_quotes unlet b:delimitMate_smart_quotes
let b:delimitMate_smart_quotes = '' let b:delimitMate_smart_quotes = ''
endif endif
endif endif
call s:option_init("smart_quotes", default_smart_quotes) call s:option_init("smart_quotes", default_smart_quotes)
" apostrophes " apostrophes
call s:option_init("apostrophes", "") call s:option_init("apostrophes", "")
call s:option_init("apostrophes_list", split(s:g('apostrophes'), ":\s*")) call s:option_init("apostrophes_list", split(s:g('apostrophes'), ":\s*"))
" tab2exit " tab2exit
call s:option_init("tab2exit", 1) call s:option_init("tab2exit", 1)
" balance_matchpairs " balance_matchpairs
call s:option_init("balance_matchpairs", 0) call s:option_init("balance_matchpairs", 0)
" eol marker " eol marker
call s:option_init("eol_marker", "") call s:option_init("eol_marker", "")
" Everything is fine. " Everything is fine.
return 1 return 1
endfunction "}}} Init() endfunction "}}} Init()
function! s:g(...) " {{{ function! s:g(...) " {{{
return call('delimitMate#Get', a:000) return call('delimitMate#Get', a:000)
endfunction " }}} endfunction " }}}
function! s:s(...) " {{{ function! s:s(...) " {{{
return call('delimitMate#Set', a:000) return call('delimitMate#Set', a:000)
endfunction " }}} endfunction " }}}
function! s:Map() "{{{ function! s:Map() "{{{
" Set mappings: " Set mappings:
try try
let save_keymap = &keymap let save_keymap = &keymap
let save_iminsert = &iminsert let save_iminsert = &iminsert
let save_imsearch = &imsearch let save_imsearch = &imsearch
let save_cpo = &cpo let save_cpo = &cpo
set keymap= set keymap=
set cpo&vim set cpo&vim
silent! doautocmd <nomodeline> User delimitMate_map silent! doautocmd <nomodeline> User delimitMate_map
if s:g('autoclose') if s:g('autoclose')
call s:AutoClose() call s:AutoClose()
else else
call s:NoAutoClose() call s:NoAutoClose()
endif endif
call s:ExtraMappings() call s:ExtraMappings()
finally finally
let &cpo = save_cpo let &cpo = save_cpo
let &keymap = save_keymap let &keymap = save_keymap
let &iminsert = save_iminsert let &iminsert = save_iminsert
let &imsearch = save_imsearch let &imsearch = save_imsearch
endtry endtry
let b:delimitMate_enabled = 1 let b:delimitMate_enabled = 1
endfunction "}}} Map() endfunction "}}} Map()
function! s:Unmap() " {{{ function! s:Unmap() " {{{
let imaps = let imaps =
\ s:g('right_delims', []) + \ s:g('right_delims', []) +
\ s:g('left_delims', []) + \ s:g('left_delims', []) +
\ s:g('quotes_list', []) + \ s:g('quotes_list', []) +
\ s:g('apostrophes_list', []) + \ s:g('apostrophes_list', []) +
\ ['<BS>', '<C-h>', '<S-BS>', '<Del>', '<CR>', '<Space>', '<S-Tab>', '<Esc>'] + \ ['<BS>', '<C-h>', '<S-BS>', '<Del>', '<CR>', '<Space>', '<S-Tab>', '<Esc>'] +
\ ['<Up>', '<Down>', '<Left>', '<Right>', '<LeftMouse>', '<RightMouse>'] + \ ['<Up>', '<Down>', '<Left>', '<Right>', '<LeftMouse>', '<RightMouse>'] +
\ ['<C-Left>', '<C-Right>'] + \ ['<C-Left>', '<C-Right>'] +
\ ['<Home>', '<End>', '<PageUp>', '<PageDown>', '<S-Down>', '<S-Up>', '<C-G>g'] \ ['<Home>', '<End>', '<PageUp>', '<PageDown>', '<S-Down>', '<S-Up>', '<C-G>g']
for map in imaps for map in imaps
if maparg(map, "i") =~# '^<Plug>delimitMate' if maparg(map, "i") =~# '^<Plug>delimitMate'
if map == '|' if map == '|'
let map = '<Bar>' let map = '<Bar>'
endif endif
exec 'silent! iunmap <buffer> ' . map exec 'silent! iunmap <buffer> ' . map
endif endif
endfor endfor
silent! doautocmd <nomodeline> User delimitMate_unmap silent! doautocmd <nomodeline> User delimitMate_unmap
let b:delimitMate_enabled = 0 let b:delimitMate_enabled = 0
endfunction " }}} s:Unmap() endfunction " }}} s:Unmap()
function! s:TestMappingsDo() "{{{ function! s:TestMappingsDo() "{{{
if &modified if &modified
let confirm = input("Modified buffer, type \"yes\" to write and proceed " let confirm = input("Modified buffer, type \"yes\" to write and proceed "
\ . "with test: ") ==? 'yes' \ . "with test: ") ==? 'yes'
if !confirm if !confirm
return return
endif endif
endif endif
call delimitMate#TestMappings() call delimitMate#TestMappings()
g/\%^$/d g/\%^$/d
0 0
endfunction "}}} endfunction "}}}
function! s:setup(...) "{{{ function! s:setup(...) "{{{
let swap = a:0 && a:1 == 2 let swap = a:0 && a:1 == 2
let enable = a:0 && a:1 let enable = a:0 && a:1
let disable = a:0 && !a:1 let disable = a:0 && !a:1
" First, remove all magic, if needed: " First, remove all magic, if needed:
if get(b:, 'delimitMate_enabled', 0) if get(b:, 'delimitMate_enabled', 0)
call s:Unmap() call s:Unmap()
" Switch " Switch
if swap if swap
echo "delimitMate is disabled." echo "delimitMate is disabled."
return return
endif endif
endif endif
if disable if disable
" Just disable the mappings. " Just disable the mappings.
return return
endif endif
if !a:0 if !a:0
" Check if this file type is excluded: " Check if this file type is excluded:
if exists("g:delimitMate_excluded_ft") && if exists("g:delimitMate_excluded_ft") &&
\ index(split(g:delimitMate_excluded_ft, ','), &filetype, 0, 1) >= 0 \ index(split(g:delimitMate_excluded_ft, ','), &filetype, 0, 1) >= 0
" Finish here: " Finish here:
return 1 return 1
endif endif
" Check if user tried to disable using b:loaded_delimitMate " Check if user tried to disable using b:loaded_delimitMate
if exists("b:loaded_delimitMate") if exists("b:loaded_delimitMate")
return 1 return 1
endif endif
endif endif
" Initialize settings: " Initialize settings:
if ! s:init() if ! s:init()
" Something went wrong. " Something went wrong.
return return
endif endif
if enable || swap || !get(g:, 'delimitMate_offByDefault', 0) if enable || swap || !get(g:, 'delimitMate_offByDefault', 0)
" Now, add magic: " Now, add magic:
call s:Map() call s:Map()
if a:0 if a:0
echo "delimitMate is enabled." echo "delimitMate is enabled."
endif endif
endif endif
endfunction "}}} endfunction "}}}
function! s:TriggerAbb() "{{{ function! s:TriggerAbb() "{{{
if v:version < 703 if v:version < 703
\ || ( v:version == 703 && !has('patch489') ) \ || ( v:version == 703 && !has('patch489') )
\ || pumvisible() \ || pumvisible()
return '' return ''
endif endif
return "\<C-]>" return "\<C-]>"
endfunction "}}} endfunction "}}}
function! s:NoAutoClose() "{{{ function! s:NoAutoClose() "{{{
" inoremap <buffer> ) <C-R>=delimitMate#SkipDelim('\)')<CR> " inoremap <buffer> ) <C-R>=delimitMate#SkipDelim('\)')<CR>
for delim in s:g('right_delims') + s:g('quotes_list') for delim in s:g('right_delims') + s:g('quotes_list')
if delim == '|' if delim == '|'
let delim = '<Bar>' let delim = '<Bar>'
endif endif
exec 'inoremap <silent> <Plug>delimitMate' . delim . ' <C-R>=<SID>TriggerAbb().delimitMate#SkipDelim("' . escape(delim,'"') . '")<CR>' exec 'inoremap <silent> <Plug>delimitMate' . delim . ' <C-R>=<SID>TriggerAbb().delimitMate#SkipDelim("' . escape(delim,'"') . '")<CR>'
exec 'silent! imap <unique> <buffer> '.delim.' <Plug>delimitMate'.delim exec 'silent! imap <unique> <buffer> '.delim.' <Plug>delimitMate'.delim
endfor endfor
endfunction "}}} endfunction "}}}
function! s:AutoClose() "{{{ function! s:AutoClose() "{{{
" Add matching pair and jump to the midle: " Add matching pair and jump to the midle:
" inoremap <silent> <buffer> ( ()<Left> " inoremap <silent> <buffer> ( ()<Left>
let i = 0 let i = 0
while i < len(s:g('matchpairs_list')) while i < len(s:g('matchpairs_list'))
let ld = s:g('left_delims')[i] == '|' ? '<bar>' : s:g('left_delims')[i] let ld = s:g('left_delims')[i] == '|' ? '<bar>' : s:g('left_delims')[i]
let rd = s:g('right_delims')[i] == '|' ? '<bar>' : s:g('right_delims')[i] let rd = s:g('right_delims')[i] == '|' ? '<bar>' : s:g('right_delims')[i]
exec 'inoremap <expr><silent> <Plug>delimitMate' . ld exec 'inoremap <expr><silent> <Plug>delimitMate' . ld
\. ' <SID>TriggerAbb().delimitMate#ParenDelim("' . escape(rd, '|') . '")' \. ' <SID>TriggerAbb().delimitMate#ParenDelim("' . escape(rd, '|') . '")'
exec 'silent! imap <unique> <buffer> '.ld exec 'silent! imap <unique> <buffer> '.ld
\.' <Plug>delimitMate'.ld \.' <Plug>delimitMate'.ld
let i += 1 let i += 1
endwhile endwhile
" Exit from inside the matching pair: " Exit from inside the matching pair:
for delim in s:g('right_delims') for delim in s:g('right_delims')
let delim = delim == '|' ? '<bar>' : delim let delim = delim == '|' ? '<bar>' : delim
exec 'inoremap <expr><silent> <Plug>delimitMate' . delim exec 'inoremap <expr><silent> <Plug>delimitMate' . delim
\. ' <SID>TriggerAbb().delimitMate#JumpOut("\' . delim . '")' \. ' <SID>TriggerAbb().delimitMate#JumpOut("\' . delim . '")'
exec 'silent! imap <unique> <buffer> ' . delim exec 'silent! imap <unique> <buffer> ' . delim
\. ' <Plug>delimitMate'. delim \. ' <Plug>delimitMate'. delim
endfor endfor
" Add matching quote and jump to the midle, or exit if inside a pair of matching quotes: " Add matching quote and jump to the midle, or exit if inside a pair of matching quotes:
" inoremap <silent> <buffer> " <C-R>=delimitMate#QuoteDelim("\"")<CR> " inoremap <silent> <buffer> " <C-R>=delimitMate#QuoteDelim("\"")<CR>
for delim in s:g('quotes_list') for delim in s:g('quotes_list')
if delim == '|' if delim == '|'
let delim = '<Bar>' let delim = '<Bar>'
endif endif
exec 'inoremap <expr><silent> <Plug>delimitMate' . delim exec 'inoremap <expr><silent> <Plug>delimitMate' . delim
\. ' <SID>TriggerAbb()."<C-R>=delimitMate#QuoteDelim(\"\\\' . delim . '\")<CR>"' \. ' <SID>TriggerAbb()."<C-R>=delimitMate#QuoteDelim(\"\\\' . delim . '\")<CR>"'
exec 'silent! imap <unique> <buffer> ' . delim exec 'silent! imap <unique> <buffer> ' . delim
\. ' <Plug>delimitMate' . delim \. ' <Plug>delimitMate' . delim
endfor endfor
" Try to fix the use of apostrophes (kept for backward compatibility): " Try to fix the use of apostrophes (kept for backward compatibility):
" inoremap <silent> <buffer> n't n't " inoremap <silent> <buffer> n't n't
for map in s:g('apostrophes_list') for map in s:g('apostrophes_list')
exec "inoremap <silent> " . map . " " . map exec "inoremap <silent> " . map . " " . map
exec 'silent! imap <unique> <buffer> ' . map . ' <Plug>delimitMate' . map exec 'silent! imap <unique> <buffer> ' . map . ' <Plug>delimitMate' . map
endfor endfor
endfunction "}}} endfunction "}}}
function! s:ExtraMappings() "{{{ function! s:ExtraMappings() "{{{
" If pair is empty, delete both delimiters: " If pair is empty, delete both delimiters:
inoremap <silent> <Plug>delimitMateBS <C-R>=delimitMate#BS()<CR> inoremap <silent> <Plug>delimitMateBS <C-R>=delimitMate#BS()<CR>
if !hasmapto('<Plug>delimitMateBS','i') if !hasmapto('<Plug>delimitMateBS','i')
if maparg('<BS>'. 'i') == '' if maparg('<BS>'. 'i') == ''
silent! imap <unique> <buffer> <BS> <Plug>delimitMateBS silent! imap <unique> <buffer> <BS> <Plug>delimitMateBS
endif endif
if maparg('<C-h>'. 'i') == '' if maparg('<C-h>'. 'i') == ''
silent! imap <unique> <buffer> <C-h> <Plug>delimitMateBS silent! imap <unique> <buffer> <C-h> <Plug>delimitMateBS
endif endif
endif endif
" If pair is empty, delete closing delimiter: " If pair is empty, delete closing delimiter:
inoremap <silent> <expr> <Plug>delimitMateS-BS delimitMate#WithinEmptyPair() ? "\<Del>" : "\<S-BS>" inoremap <silent> <expr> <Plug>delimitMateS-BS delimitMate#WithinEmptyPair() ? "\<Del>" : "\<S-BS>"
if !hasmapto('<Plug>delimitMateS-BS','i') && maparg('<S-BS>', 'i') == '' if !hasmapto('<Plug>delimitMateS-BS','i') && maparg('<S-BS>', 'i') == ''
silent! imap <unique> <buffer> <S-BS> <Plug>delimitMateS-BS silent! imap <unique> <buffer> <S-BS> <Plug>delimitMateS-BS
endif endif
" Expand return if inside an empty pair: " Expand return if inside an empty pair:
inoremap <expr><silent> <Plug>delimitMateCR <SID>TriggerAbb()."\<C-R>=delimitMate#ExpandReturn()\<CR>" inoremap <expr><silent> <Plug>delimitMateCR <SID>TriggerAbb()."\<C-R>=delimitMate#ExpandReturn()\<CR>"
if s:g('expand_cr') && !hasmapto('<Plug>delimitMateCR', 'i') && maparg('<CR>', 'i') == '' if s:g('expand_cr') && !hasmapto('<Plug>delimitMateCR', 'i') && maparg('<CR>', 'i') == ''
silent! imap <unique> <buffer> <CR> <Plug>delimitMateCR silent! imap <unique> <buffer> <CR> <Plug>delimitMateCR
endif endif
" Expand space if inside an empty pair: " Expand space if inside an empty pair:
inoremap <expr><silent> <Plug>delimitMateSpace <SID>TriggerAbb()."\<C-R>=delimitMate#ExpandSpace()\<CR>" inoremap <expr><silent> <Plug>delimitMateSpace <SID>TriggerAbb()."\<C-R>=delimitMate#ExpandSpace()\<CR>"
if s:g('expand_space') && !hasmapto('<Plug>delimitMateSpace', 'i') && maparg('<Space>', 'i') == '' if s:g('expand_space') && !hasmapto('<Plug>delimitMateSpace', 'i') && maparg('<Space>', 'i') == ''
silent! imap <unique> <buffer> <Space> <Plug>delimitMateSpace silent! imap <unique> <buffer> <Space> <Plug>delimitMateSpace
endif endif
" Jump over any delimiter: " Jump over any delimiter:
inoremap <expr><silent> <Plug>delimitMateS-Tab <SID>TriggerAbb()."\<C-R>=delimitMate#JumpAny()\<CR>" inoremap <expr><silent> <Plug>delimitMateS-Tab <SID>TriggerAbb()."\<C-R>=delimitMate#JumpAny()\<CR>"
if s:g('tab2exit') && !hasmapto('<Plug>delimitMateS-Tab', 'i') && maparg('<S-Tab>', 'i') == '' if s:g('tab2exit') && !hasmapto('<Plug>delimitMateS-Tab', 'i') && maparg('<S-Tab>', 'i') == ''
silent! imap <unique> <buffer> <S-Tab> <Plug>delimitMateS-Tab silent! imap <unique> <buffer> <S-Tab> <Plug>delimitMateS-Tab
endif endif
" Jump over next delimiters " Jump over next delimiters
inoremap <expr><buffer> <Plug>delimitMateJumpMany <SID>TriggerAbb()."\<C-R>=delimitMate#JumpMany()\<CR>" inoremap <expr><buffer> <Plug>delimitMateJumpMany <SID>TriggerAbb()."\<C-R>=delimitMate#JumpMany()\<CR>"
if !hasmapto('<Plug>delimitMateJumpMany', 'i') && maparg("<C-G>g", 'i') == '' if !hasmapto('<Plug>delimitMateJumpMany', 'i') && maparg("<C-G>g", 'i') == ''
imap <silent> <buffer> <C-G>g <Plug>delimitMateJumpMany imap <silent> <buffer> <C-G>g <Plug>delimitMateJumpMany
endif endif
endfunction "}}} endfunction "}}}
"}}} "}}}
@@ -379,18 +379,18 @@ command! -bar DelimitMateOff call s:setup(0)
" Autocommands: {{{ " Autocommands: {{{
augroup delimitMate augroup delimitMate
au! au!
" Run on file type change. " Run on file type change.
au FileType * call <SID>setup() au FileType * call <SID>setup()
au VimEnter * call <SID>setup() au VimEnter * call <SID>setup()
" Run on new buffers. " Run on new buffers.
au BufNewFile,BufRead,BufEnter * au BufNewFile,BufRead,BufEnter *
\ if !exists('b:delimitMate_was_here') | \ if !exists('b:delimitMate_was_here') |
\ call <SID>setup() | \ call <SID>setup() |
\ let b:delimitMate_was_here = 1 | \ let b:delimitMate_was_here = 1 |
\ endif \ endif
augroup END augroup END
"}}} "}}}