-
Notifications
You must be signed in to change notification settings - Fork 250
feat(nui): allow callbacks in nui input with option #1372
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
feat(nui): allow callbacks in nui input with option #1372
Conversation
`config.enable_normal_mode_for_inputs`
Usecase: Move cursor right before the extension and start insert mode. config.enable_normal_mode_for_inputs = ":exe 'norm F.' | :startinsert" |
😱 In this example you're using an option called enable_normal_mode_for_inputs to startinsert mode. 😱 I think we already have a generic solution that would be perfect, which is the event system. In a quick attempt I could not get the existing |
Yeah 🎉 That's what I mean by absolute power lol. I plan to not document this anywhere so it's absolutely to the users own risk to do anything.
Creating a new event is also a good option, but the codebase is the same for |
@cseickel Updated. Regarding this change, I deprecated the As I wanted to give more information on how to migrate, I changed the migration module to be able to add descriptions in the buffer. Besides, now bullet point for each change doesn't make much sense, so I changed it to use level 2 header |
It is definitely nice to be able to add a longer description to deprecations. One thing I was considering is that I think it is more standard for plugins to have a What do you think? |
I don't quite like when behavior before event handler execution changes by a different option in the config. If you have an option to alter the behavior other than When people asks how to do xxx in the popup, I need to instruct; if you have I'd prefer to have the handler start consistently, either always from insert mode or always from normal mode. |
OK, fair enough. In that case, we stick with your idea. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay on this one. LGTM.
@pysan3 Hello, I update to release E5108: Error executing lua ...m/lazy/neo-tree.nvim/lua/neo-tree/setup/deprecations.lua:18: Invalid option name: 'wrap'
stack traceback:
[C]: in function 'nvim_buf_set_option'
...m/lazy/neo-tree.nvim/lua/neo-tree/setup/deprecations.lua:18: in function 'show_migrations'
...re/nvim/lazy/neo-tree.nvim/lua/neo-tree/command/init.lua:51: in function 'execute'
...re/nvim/lazy/neo-tree.nvim/lua/neo-tree/command/init.lua:169: in function '_command'
[string ":lua"]:1: in main chunk
Do you know how to fix it or find more clues? |
The fix was just released as |
@pysan3 I think you forgot to remove The only location I can find where neo-tree.nvim/lua/neo-tree/defaults.lua Line 22 in d8b4687
I believe this is because the neo-tree.nvim/lua/neo-tree/setup/deprecations.lua Lines 61 to 68 in d8b4687
$ lua
Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio
> foo = false
> foo ~= nil
true
> foo = nil
> foo ~= nil
false Commenting out |
Follow up for bug introduced in PR nvim-neo-tree#1372 nvim-neo-tree#1372 (comment)
My bad. Thank you @rrrix |
I may be missing a basic command, but can I make it such that I enter the popup in insert mode, but pressing escape puts me in normal mode (instead of leaving the popup) ? That's the behavior I'm getting from other popups. |
Map |
When I want to rename a file, I'm bummed that I can't use any normal vim movements to get myself to the start of the filename. They recently added an event that allows us to start the inputs in normal mode! nvim-neo-tree/neo-tree.nvim#1372
We already have an option to default to normal mode in nui inputs.
config.enable_normal_mode_for_inputs
However, it looks like users want more power of customization to the details. (#1371)
So why not just let users do whatever they want with absolute power?
All
function/string/table
are considered true-thy so this will cover backwards compatibility.