Comments (8)
Although the snippet I sent earlier was just a random example, I think it also shows a problem I would run into with layers. If I wanted to handle the key 'd' in my layer, I would be unable to trigger a lower binding that is also bound to 'd'
from nvim-libmodal.
Apologies if that was vague! I'll try to be more specific. From what I understand, this issue is related to doing something like this:
libmodal.mode.enter('FOO', function()
vim.api.nvim_input('dd')
end)
β¦and the mode eats the dd
input? (If I'm not understanding that right, please let me know / post a small example and I can help better).
Based on my understanding, the following is a solution:
libmodal.mode.enter('FOO', {
d = 'norm! dd', -- map 'd' to 'dd'
f = function() -- map `f` to a function
vim.api.nvim_command 'norm! dd' -- (or nvim_input)
end,
})
There are also some benefits to providing a mapping table like this, such as automatic generation of a mode summary (i.e. press ?
to see available mappings). It won't be a great solution if you need to dynamically respond to user actions (i.e. the available mappings aren't predetermined), although this can be somewhat mitigated by using submodes.
from nvim-libmodal.
Thank you for taking the time to elaborate. I think that should cover my use case, especially with the help of submodes (thanks for the hint)
from nvim-libmodal.
Would a :h libmodal-layer
help in this case?
from nvim-libmodal.
Sadly not really. I don't want unrecognized input to be passed through, but rather the ability to trigger other "lower" bindings in a very controlled manner.
from nvim-libmodal.
I see. I'll do some investigation.
from nvim-libmodal.
I had a thought, would something like this work? You can pass a table of possible inputs to the mode and anything which executes there is taken as raw input (and if it doeen't still do that, it's most certainly a bug)
If that doesn't fit your use case I can investigate it further.
from nvim-libmodal.
I'm sorry but you're going to have to be a bit more specific, I don't really understand how this could solve my issue
from nvim-libmodal.
Related Issues (20)
- consider move initialization to lua HOT 5
- Visual block mode needs to be added to galaxyline config HOT 2
- Indicator functionality within a Layer, OR cursor functionality within a Mode. HOT 2
- Support mapping to function in Layer HOT 1
- Bad styling HOT 1
- Compatibility with `sindrets/winshift.nvim` HOT 2
- feline archieved switch to lualine? HOT 4
- Layers don't seem to be reusable HOT 1
- Error encountered: Expected lua string HOT 6
- Bug: cursor movements aren't updated until after leaving mode HOT 4
- Bug: `vim.v.count` is always 0 HOT 7
- Shallowly switching between libmodal modes HOT 7
- Modifier mappings don't seem to work support HOT 2
- `CursorMoved` / `CursorMovedI` isn't triggered inside custom mode HOT 4
- `TextChanged` isn't triggered in custom mode HOT 3
- What's the best way to expose the mode keymaps table to my consumers? HOT 4
- Attempt to compare number with string in Mode.lua:296 HOT 5
- Importing libmodal prevents pasting into command prompt HOT 5
- "Error while calling lua chunk for luaeval()... Undefined variable: _instruction" HOT 6
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 nvim-libmodal.