2011-12-24 3 views
0

私は、ブラケットをオートコンプリートについてのconfigureを見つけ.vimrcを設定してオートコンプリート機能をいくつかのサブライムテキスト2にする方法は?

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

が、私は「(」、「)」滞在を削除しようとしたときに、あまりにも消えてしまう崇高テキスト2、でてきました。それでは、どのようにして.vimrc roを設定すればいいですか?

//アップデート:vim-autocloseプラグインを入手しました。現在作業中です。

+0

なぜ 'IMAP] ''と 'ないinoremap' '' 'を使って、あなたがこれを行うことができsurround.vimをインストールした場合は? – ZyX

+0

TOT、間違い、私はそれを編集しました。 – jiyinyiyong

答えて

1

あなたは

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> 
+0

someting strange。 Vimでbarackets sucが "(必要なもの)"という文字列を入力したとき、大括弧で "g"という単語を削除すると、呪いは滞在するのではなく最後にジャンプしました。それは混乱している。 – jiyinyiyong

+0

@jiyinyiyongはい、私はそれを今見ます。一定。 – ZyX

+0

ありがとうございますが、まだ小さなバグです。私はtxtファイルの最後に新しい行を開いてから、この空行をBackspaceで削除しようとしましたが、2行は1行ではなく2行上にジャンプします。 (これは最後の行でない場合には発生しません) – jiyinyiyong

関連する問題