Skip to content

Commit

Permalink
Tweaks to make perl 'smarter'
Browse files Browse the repository at this point in the history
  • Loading branch information
atsepkov committed Aug 16, 2013
1 parent ea19edc commit 50f241a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions autoload/smartinput.vim
Expand Up @@ -73,28 +73,32 @@ function! smartinput#define_default_rules() "{{{2
endfunction
call urules.add('()', [
\ {'at': '\%#', 'char': '(', 'input': '()<Left>'},
\ {'at': '\%#\_s*)', 'char': ')', 'input': '<C-r>=smartinput#_leave_block('')'')<Enter><Right>'},
\ {'at': '(\%#)', 'char': '<BS>', 'input': '<BS><Del>'},
\ {'at': '()\%#', 'char': '<BS>', 'input': '<BS><BS>'},
\ {'at': '\\\%#', 'char': '(', 'input': '('},
\ {'at': '(\%#)', 'char': '<Enter>', 'input': '<Enter><Enter><BS><Up><Esc>"_A'},
\ {'at': '(\%#)', 'char': '<Enter>', 'input': '<Enter><Esc>"_O'},
\ ])
"\ {'at': '\%#\_s*)', 'char': ')', 'input': '<C-r>=smartinput#_leave_block('')'')<Enter><Right>'},
"\ {'at': '(\%#)', 'char': '<Enter>', 'input': '<Enter><Enter><BS><Up><Esc>"_A'},
call urules.add('[]', [
\ {'at': '\%#', 'char': '[', 'input': '[]<Left>'},
\ {'at': '\%#\_s*\]', 'char': ']', 'input': '<C-r>=smartinput#_leave_block('']'')<Enter><Right>'},
\ {'at': '\[\%#\]', 'char': '<BS>', 'input': '<BS><Del>'},
\ {'at': '\[\]\%#', 'char': '<BS>', 'input': '<BS><BS>'},
\ {'at': '\\\%#', 'char': '[', 'input': '['},
\ {'at': '\[\%#\]', 'char': '<Enter>', 'input': '<Enter><Enter><Esc><Up>"_A<Tab>'},
\ {'at': '\[\%#\]', 'char': '<Enter>', 'input': '<Enter><Esc>"_O'},
\ ])
"\ {'at': '\%#\_s*\]', 'char': ']', 'input': '<C-r>=smartinput#_leave_block('']'')<Enter><Right>'},
call urules.add('{}', [
\ {'at': '\%#', 'char': '{', 'input': '{}<Left>'},
\ {'at': '\%#\_s*}', 'char': '}', 'input': '<C-r>=smartinput#_leave_block(''}'')<Enter><Right>'},
\ {'at': '{\%#}', 'char': '<BS>', 'input': '<BS><Del>'},
\ {'at': '{}\%#', 'char': '<BS>', 'input': '<BS><BS>'},
\ {'at': '\\\%#', 'char': '{', 'input': '{'},
\ {'at': '{\%#}', 'char': '<Enter>', 'input': '<Enter><Enter><BS><Up><Esc>"_A'},
\ {'at': '{\%#}', 'char': '<Enter>', 'input': '<Enter><Esc>"_O'},
\ {'at': '=.*{\%#}', 'char': '<Enter>', 'input': '<Enter><End>;<Esc>"_O'},
\ {'at': '(.*{\%#})', 'char': '<Enter>', 'input': '<Enter><Enter><BS><End>;<Up><Esc>"_A'},
\ ])
"\ {'at': '\%#\_s*}', 'char': '}', 'input': '<C-r>=smartinput#_leave_block(''}'')<Enter><Right>'},
"\ {'at': '(.*{\%#})', 'char': '<Enter>', 'input': '<Enter><Enter><BS><Up><Esc>"_A'},
call urules.add('''''', [
\ {'at': '\%#', 'char': '''', 'input': '''''<Left>'},
\ {'at': '\%#''\ze', 'char': '''', 'input': '<Right>'},
Expand Down

0 comments on commit 50f241a

Please sign in to comment.