Как настроить .vimrc, чтобы функция автозаполнения использовалась в Sublime Text 2? - PullRequest
0 голосов
/ 24 декабря 2011

Я нашел настройки для автозаполнения скобок,

inoremap ' ''<Left>
inoremap " ""<Left>
inoremap { {}<Left>
inoremap ( ()<Left>

но когда я попытался удалить «(», «)» остается, но в Sublime Text 2 это тоже исчезнет. Так как я могу настроить .vimrc ro сделать это?

// Обновление: получил плагин vim-autoclose, похоже, работает сейчас.

1 Ответ

1 голос
/ 25 декабря 2011

Если вы установите round.vim , вы можете сделать это, используя

inoremap ' ''<Left>
inoremap " ""<Left>
inoremap { {}<Left>
inoremap ( ()<Left>

imap <expr> <C-h> "\<C-\>\<C-n>x".((col('.')==col('$'))?(""):("h"))."a"
imap <BS>  <C-h>
let s:pairsymbols={"'": "'",
            \      '"': '"',
            \      '{': '}',
            \      '(': ')',}
function! s:DelPair()
    let cnt=v:count1
    if col('$')==1
        let shiftline=(line('.')<line('$'))
        normal! dd
        if shiftline
            normal! k
        endif
        normal! $
        if cnt>1
            execute 'normal '.(cnt-1).'x'
        endif
        return
    endif
    let curch=getline('.')[col('.')-1]
    if has_key(s:pairsymbols, curch)
        let oldchtick=b:changedtick
        if getline('.')[col('.')] is# s:pairsymbols[curch]
            normal! 2x
        else
            execute "normal \<Plug>Dsurround".s:pairsymbols[curch]
            if b:changedtick==oldchtick
                normal! x
            endif
        endif
    else
        normal! x
    endif
    if cnt>1
        execute 'normal '.(cnt-1).'x'
    endif
endfunction
nnoremap x :<C-u>call <SID>DelPair()<CR>
...