Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird behaviour when using Latex-suite #25

Open
hadr1an opened this issue Apr 30, 2020 · 7 comments
Open

Weird behaviour when using Latex-suite #25

hadr1an opened this issue Apr 30, 2020 · 7 comments
Assignees

Comments

@hadr1an
Copy link

hadr1an commented Apr 30, 2020

Not sure if it is my fault or a general thing but when I do not edit Latex files the plugin seems to be working normally. When I edit Latex files (with latex-suite) the closing bracket appears correctly with the placeholder but if I type the closing bracket, another placeholder appears with a second closing bracket. When I hit only the character before the cursor gets deleted.
Any help will be appreciated,
Thanks.

@LucHermitte
Copy link
Owner

vim-latex requires a special attention. Normally lh-brackets is written to be compatible with vim-latex. Could you described more precisely what you do and what you observe.

For instance. When vim-latex is installed, if in insert mode I type ) when the cursor in within (|)<++>, the cursor is moved after the ) and the placeholder is removed.

I can check that the insertion is given to vim-latex with:

:imap )

that prints

i  )           * <C-R>=<SNR>192_LookupCharacter(")")<CR>

instead of the following when vim-latex isn't loaded.

 i  )           * lh#brackets#closer(")",")","")

Also, vim-latex (through plugin/imaps.vim) has registered the following:

:echo strtrans(IMAP_list(')'))

displays

rhs = ^R=lh#brackets#closer(")",")","")^M place holders = <+ and +>

This is what you should observe.

@LucHermitte LucHermitte self-assigned this May 2, 2020
@LucHermitte LucHermitte added the bug label May 2, 2020
@LucHermitte
Copy link
Owner

I observe the problem with the latest version on vim-latex. I'll try to investigate what is wrong. It's not necessarily on lh-brackets side.

@hadr1an
Copy link
Author

hadr1an commented May 2, 2020

Alright at least, if you can reproduce it, is not related to wrong configuration on my side.

@LucHermitte
Copy link
Owner

It looks like that somewhere someone has registered () to expand into (<++>)<++>. IMO, this mapping isn't really ergonomic.

:echo strtrans(IMAP_list('()'))

In the previous versions of vim-latex, this association didn't exist. It's done in ftplugin/latex-suite/main.vim. May be you could request to have a way to inhibit these mappings as you have another pairing/bracketing plugin that inserts the complete pair when typing the opening part.

Ideally they should detect whether the closing character is after the cursor to move over it instead of triggering an expansion. This would be a complex change, I doubt they would do it. Also, other conflicts would appear on (( for instance.

I see two paths from here:

  • you either inhibit default mappings from lh-brackets for (La)TeX files (in ~/.ftplugin/tex.vim add let b:cb_no_default_brackets = 1 and add the ones you want instead; see after/ftplugin/tex/tex_brackets.vim)
  • or you inhibit these vim-latex mappings

@LucHermitte LucHermitte added wontfix and removed bug labels May 2, 2020
@LucHermitte
Copy link
Owner

My mistake. The definitions have been here for a long time, but they did not cause any conflict.

@hadr1an
Copy link
Author

hadr1an commented May 2, 2020

I solved it after spotting the location of it. Thanks for walking me through this.

@LucHermitte LucHermitte added the Doc label May 3, 2020
@LucHermitte
Copy link
Owner

You're welcome.
I keep the issue open for the moment to to not forget to document this compatibility issue somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants