cohama / lexima.vim

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

Add rule using | character #112

Closed ngmoviedo closed 3 years ago

ngmoviedo commented 3 years ago

I'm trying to add the following rule:

call lexima#add_rule({'char': '\|', 'input_after': '\|', 'filetype': 'tex'})

to match \| with \| (mathematical norm in TeX). But it doesn't work at all. I guess the |character may have some other meaning, so I've tried escaping it, to no avail. The filetypeoption is not the issue, as I have other rules set up and working for TeX.

ngmoviedo commented 3 years ago

Solved! Using <Bar> was required, instead of | or \|.

call lexima#add_rule({'char': '\<Bar>', 'input_after': '\<Bar>', 'filetype': 'tex'})
call lexima#add_rule({'char': '<BS>', 'at': '\\\|\%#\\\|', 'input': '<BS><BS>', 'delete': 2, 'filetype': 'tex'})
call lexima#add_rule({'char': '<Bar>', 'at': '\%#\\\|', 'leave': 2, 'filetype': 'tex'})

So I guess there's no issue here.