Closed bryclee closed 5 years ago
Use the 'not_in'
option in your pair rules:
let g:pear_tree_pairs = {
\ '(': {'closer': ')', 'not_in': ['Comment']},
\ '{': {'closer': '}', 'not_in': ['Comment']}
" etc.
\ }
Hm... I tested this out with a minimal configuration but it still wasn't producing what I was hoping for.
In the above example, I was hoping to end up with the cursor like test()|
, but instead I got test()|)
I'm using these settings:
Plug 'tmsvg/pear-tree'
let g:pear_tree_repeatable_expand = 0
let g:pear_tree_smart_openers = 1
let g:pear_tree_smart_closers = 1
let g:pear_tree_smart_backspace = 1
let g:pear_tree_pairs = {
\ '(': {'closer': ')', 'not_in': ['Comment']},
\ '{': {'closer': '}', 'not_in': ['Comment']},
\ '[': {'closer': ']', 'not_in': ['Comment']}
\ }
I should have mentioned, https://github.com/tmsvg/pear-tree/commit/4f3bc71e979a7ad743eb789aaaf8c23447cb44e7 fixed an issue that would have prevented this particular example from working. Try updating and see if it works.
Thanks! After updating, this is working.
I've noticed that the smart openers and smart closers don't quite work when there is an unpaired paren or bracket within a comment. For example:
I'd expect if I were to press
)
, that the cursor would then move toIs it possible to ignore comments when deciding whether to use the smart closers or not?