cohama / lexima.vim

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

expanding strings instead of letters #135

Closed aloispichler closed 1 year ago

aloispichler commented 1 year ago

I tried the following rule call lexima#add_rule({'char': '\big(', 'input_after': '\big)', 'filetype': 'latex'}), which expands correctly, but before that only the letters \ - b - i - g - ) are visible, one after the another. What did I wrong?

cohama commented 1 year ago

What you want is the following?

before | input | after
\big|  |  (    | \big(\big)

char will be used as lhs of imap such as imap \big( \big(\big)<Left><Left><Left><Left>.

You need to map only ( and specify at to add context. A better rule is the follow.

call lexima#add_rule({'char': '(', 'at': '\\big\%#', 'input_after': '\big)', 'filetype': 'latex'})

FYI: Escape \ in at clause because it is treated as search argument. For example \sin is treated as SPACE + "in".

aloispichler commented 1 year ago

Thank you, this works now! I like your extension. Thanks for your quick response in addition. This is perhaps an example for the docs as well.

cohama commented 1 year ago

Good.