cohama / lexima.vim

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

Implement lexima#add_rules() #52

Closed thirtythreeforty closed 8 years ago

thirtythreeforty commented 8 years ago

This allows blocks of custom rules such as the following to be grouped into the following more readable form:

call lexima#add_rules([
        \ {'char': '<', 'at': '\w\%#', 'input_after': '>'},
        \ {'char': '>', 'at': '\%#>', 'leave': 1},
        \ {'char': '<BS>', 'at': '\w<\%#>', 'delete': 1},
\ ], ['rust', 'cpp'])

Here, the three rules in the first argument are all passed separately to lexima#add_rule. In addition, each rule is only valid for the filetypes 'rust' and 'cpp'.

thirtythreeforty commented 8 years ago

Please let me know if you think the API could be improved. I have this already in my dotfiles because it really denoises all the custom rules I have.

cohama commented 8 years ago

You can define the function so I think no need to support your function officially.

cohama commented 8 years ago

Yes, the API will be refined in the future version.

thirtythreeforty commented 8 years ago

Very well. Thanks for the review!