Auto Pairs ========== Insert or delete brackets, parens, quotes in pair. Installation ------------ copy plugin/auto-pairs.vim to ~/.vim/plugin Features -------- * Insert in pair input: [ output: [|] * Delete in pair input: foo[ output: foo * Insert new indented line after Return input: {|} (press at |) output: { | } * Insert spaces before closing characters input: {|} (press at |) output: { | } * Skip closed bracket. input: [] output: [] * Ignore auto pair when previous character is \ input: "\' output: "\'" * Fast Wrap input: |'hello' (press ( at|) output: ('hello') Shortcuts --------- System Shortcuts: : Insert new indented line after return if cursor in blank brackets or quotes. : Delete brackets in pair : Toggle Autopairs : Fast Wrap Optional Shortcuts: could be turn off by let g:AutoPairsShortcuts = 0 jump to next closed bracket. jump to end of line. jump to newline with indented. Options ------- * g:AutoPairs Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"'} * g:AutoPairsShortcutToggle Default: '' The shortcut to toggle autopairs. * g:AutoPairsShortcutFastWrap Default: '' Fast wrap the word. all pairs will be consider as a block (include <>). (|)'hello' after fast wrap at |, the word will be ('hello') (|) after fast wrap at |, the word will be () * g:AutoPairsShortcuts Default: 1 imap 3 shortcuts jump to next closed bracket. jump to end of line. jump to newline with indented. * g:AutoPairsMapBS Default : 1 Map to delete brackets, quotes in pair execute 'inoremap =AutoPairsDelete()' * g:AutoPairsMapCR Default : 1 Map to insert a new indented line if cursor in (|), {|} [|], '|', "|" execute 'inoremap =AutoPairsReturn()' * g:AutoPairsCenterLine Default : 1 When g:AutoPairsMapCR is on, center current line after return if the line is at the bottom 1/3 of the window. * g:AutoPairsMapSpace Default : 1 Map to insert a space after the opening character and before the closing one. execute 'inoremap =AutoPairsReturn()' TroubleShooting --------------- The script will remap keys ([{'"}]) , If auto pairs cannot work, use :imap ( to check if the map is corrected. The correct map should be =AutoPairsInsert("\(") Or the plugin conflict with some other plugins. use command :call AutoPairsInit() to remap the keys.