cohama / lexima.vim

Auto close parentheses and repeat by dot dot dot...
1.01k stars 46 forks source link

Add ability to move cursor after closing bracket in new line #48

Closed vitorf7 closed 8 years ago

vitorf7 commented 8 years ago

When you are writing for example a function like so:

public function helloWorld() {|}

When you press it will be like so:

public function helloWorld() {
    |
}

Which is all ok but once you finish everything it would be ideal to be able to press } and then the cursor move to the position after the closing parentheses like so:

public function helloWorld() {
    return "hello world";
}|

The same would apply to () and [] as those can be used in many languages (I am a PHP dev) to denote things like arrays, and function parameters etc.

Thanks.

cohama commented 8 years ago

You can do this by adding following rules to your vimrc.

call lexima#add_rule({'char': '}', 'at': '\%#\n\s*}', 'leave': '}'})
call lexima#add_rule({'char': ']', 'at': '\%#\n\s*]', 'leave': ']'})
call lexima#add_rule({'char': ')', 'at': '\%#\n\s*)', 'leave': ')'})
cohama commented 8 years ago

any updates?

vitorf7 commented 8 years ago

@cohama I have tried it and it worked. Sorry for the delay in responding