Comments (7)
Oh, I forgot that run_run
returns the inputted key, so:
local core=require'ultimate-autopair.core'
vim.keymap.set('i','\r',function()
local key=core.run_run(vim.api.nvim_replace_termcodes('<plug>ultimate-autopair-CR',true,true,true))
if key==vim.api.nvim_replace_termcodes('<plug>ultimate-autopair-CR',true,true,true) then
vim.api.nvim_feedkeys('\r','n',false)
else
vim.api.nvim_feedkeys(key,'n',false)
end
end)
from ultimate-autopair.nvim.
The thing is that each key gets past through nvim_replace_termcodes
, so it is \r
and not <cr>
.
Note that core.run
returns an action and requires the mapping to be an <expr>
, activating textlock, which you probably don't want.
So I would guess you want this:
local core=require'ultimate-autopair.core'
vim.keymap.set('i','\r',function()
vim.api.nvim_feedkeys(core.run_run('\r'),'n',false)
end)
(I'm currently working on the next version of the plugin where this will be simplified)
from ultimate-autopair.nvim.
Nice, thank you!
How can I know disable the automatic mapping by the plugin? I have some issues with the loading order, so my mappings gets overwritten by the one of the plugin atm. But if I set in the plugin config the cr = { map = '' }
, then the run_run
function does not work anymore. Can I disable the plugin to create the mapping, but still have the function working?
(I'm currently working on the next version of the plugin where this will be simplified)
Cool! 👍
from ultimate-autopair.nvim.
It is not possible (yet).
But you could do cr = { map = '<plug>ultimate-autopair-CR' }
and then use
local core=require'ultimate-autopair.core'
vim.keymap.set('i','\r',function()
vim.api.nvim_feedkeys(core.run_run(vim.api.nvim_replace_termcodes('<plug>ultimate-autopair-CR',true,true,true)),'n',false)
end)
from ultimate-autopair.nvim.
Nice, that does the job. Good idea! 👍🏾
Thank you very much for your help!
from ultimate-autopair.nvim.
Damn. I get sometimes recursive mapping errors now. Don't know where they are coming from. 😑
It triggers when I hit enter and there is nothing happening by autopair. So if I type (<CR>
, that is fine. But if I just type <CR>
anywhere else to create a new line, it fails with the recursion error. 🤔
Surprised that also explicitly setting noremap = true
doesn't help. 😖
from ultimate-autopair.nvim.
Alright, this finally works now. 👌🏾
Despite that part: I love how powerful this plugin is. 😊
from ultimate-autopair.nvim.
Related Issues (20)
- Feature request: Rust lifetime syntax support HOT 19
- [Question] How to ignore a specific parser? HOT 1
- Builtin C-style block comment support HOT 2
- [Question] - JSX Support HOT 4
- alpha extension unexpected behavior HOT 2
- Support for lua `[=[...]=]` string? HOT 4
- [Performance] Holding on space in large markdown files freeze the editor HOT 3
- [Bug] Incorrect pair exiting behavior HOT 1
- [BUG] Wrong behavior when deleting asterisk in makdown files HOT 1
- Healthcheck fails saying parser is missing for 'lua' HOT 4
- [Feature Request] Specify pairs by regular expression HOT 2
- Way to prevent autocomplete if Esc is pressed? HOT 13
- Delete comma after pair HOT 6
- Undo mappings in insert mode don't work as expected HOT 3
- [BUG] Installing ultimate-autopair causes luasnip to malfunction HOT 2
- Parenths don't auto close in swift files with swift string interpolation HOT 5
- Feature request: fastwarp for left parenthesis
- Suround vs Surround HOT 2
- Bug: `in_string()` errors in `ftplugin/lua.lua` HOT 4
- [Bug] Pairing in Select mode doesn't work when LSP server loads HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ultimate-autopair.nvim.