Giter VIP home page Giter VIP logo

Comments (15)

altermo avatar altermo commented on July 3, 2024

It is because ext.escape treats multi-character pairs as a single character, this issue will be solved in the next release.
Until then, you can disable escape with { "\\(", "\\)", ft = { "tex" } , noescape = true }

from ultimate-autopair.nvim.

haoming-li-ling avatar haoming-li-ling commented on July 3, 2024

Thank you, that works!
However, I have another question. Now, when the pair is in place, and the cursor is at |, i.e., \(|\), pressing \ will bring me out of the pair. I want to disable this behavior, as in latex, it is often the case that I will input a command that starts with \ when I am in that position. How can I do that?

from ultimate-autopair.nvim.

altermo avatar altermo commented on July 3, 2024

Currently, that is not easily possible.
Will implement it in the next release.

from ultimate-autopair.nvim.

altermo avatar altermo commented on July 3, 2024

Ok, fixed, and the feature added in v0.6.0 (for more info read the Q&A)
(Note: To update to v0.6.0, remove the plugin totally and reinstall)

from ultimate-autopair.nvim.

haoming-li-ling avatar haoming-li-ling commented on July 3, 2024

The problem with the new version now is that the rule you provided does not even work. In fact, the default quotes map for tex also doesn't work.

from ultimate-autopair.nvim.

altermo avatar altermo commented on July 3, 2024

Fixed; the problem was that treesitter uses latex and not tex as languagetree:lang().
So replace {ft={'text'}} with {ft={'text','latex'}}`

from ultimate-autopair.nvim.

haoming-li-ling avatar haoming-li-ling commented on July 3, 2024

I commented out the double quotes rule for tex from internal pairs, and tried to add this rule:

{ "`", "'", fly = true, ft = { "tex", "latex" } }

but this one doesn't work; why?

from ultimate-autopair.nvim.

altermo avatar altermo commented on July 3, 2024

That's weird, cause it works with the minimal config:

vim.fn.system{'git','clone','--depth=1','https://github.com/altermo/ultimate-autopair.nvim',vim.fn.stdpath('data')..'/ultimate-autopair'}
vim.opt.runtimepath:append(vim.fn.stdpath('data')..'/ultimate-autopair')
require'ultimate-autopair'.setup{{'`',"'",fly=true,ft={'tex','latex'}}}
vim.cmd.setf'tex'

from ultimate-autopair.nvim.

haoming-li-ling avatar haoming-li-ling commented on July 3, 2024

I located the plugin causing the issue. It is actually vimtex. Whenever vimtex is enabled, the ` rule does not work. However, I already disabled the auto-expanding snippets from vimtex that start with `, so I don't know why this is still happening. Working alongside vimtex would be ideal, since virtually everyone writing latex on vim uses it.

Additionally,

{ "`", "`", nft = { "tex", "latex" }, multiline = false }

and

{ "`", "'", fly = true, ft = { "tex", "latex" } }

cannot coexist. The former breaks the backspace behavior of the latter, despite the filetype specifications.

from ultimate-autopair.nvim.

altermo avatar altermo commented on July 3, 2024

For the vimtex, I need a config to be able to search for what causes what.
And for the backspace, in what way does it break?

from ultimate-autopair.nvim.

haoming-li-ling avatar haoming-li-ling commented on July 3, 2024

For the broken backspace, it deletes two `s at once, without deleting any 's. So

``|'' --backspace--> |''

from ultimate-autopair.nvim.

altermo avatar altermo commented on July 3, 2024

Fixed; the problem was that only a select cases of backspace(/newline) ran through the filter and the rest ignored it.

from ultimate-autopair.nvim.

haoming-li-ling avatar haoming-li-ling commented on July 3, 2024

Indeed fixed. Thanks!

Something more drastic I noticed with vimtex. It is not that the backtick rule doesn't work; it works, but it interprets the single quotes not on the current line as the ending character. And so, it does not insert the single quote on the same line. Then, when I delete the backtick, a single quote that is very far away from the backtick (on the lines below) gets deleted. I think the multiline behavior is erroneously enabled for this rule when vimtex is enabled.

from ultimate-autopair.nvim.

haoming-li-ling avatar haoming-li-ling commented on July 3, 2024

Ok, setting multiline to false explicitly fixes it. It is still puzzling; what is the default setting for multiline? Why vimtex enabled means multiline on, and vimtex disabled means multiline off, even though I didn't set the multiline option at all in the original rule? Is it perhaps the timing of the filtetype detection that is affected by vimtex, which in turn affects whether the explicit multiline = false option from the nft = { "tex", "latex" } backtick rule gets transferred to the ft = { "tex", "latex" } backtick rule?

from ultimate-autopair.nvim.

altermo avatar altermo commented on July 3, 2024

The default for multiline is true.
Can you give a minimal config so that I can also research it?

from ultimate-autopair.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.