-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
feat(defaults): enable mouse support #19290
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
Conversation
|
Can't do this until the full suggestion in #15521 (comment) is implemented.
|
As menu functionality has been implemented, do I understand right that we lack few default commands, such as |
correct |
|
@justinmk All done. The menu is embedded into C code to match with default mappings and autocommands. I also changed the default for AFAIU, the test emulates mouse clicks in the status line area, but the popup menu shows up unexpectedly. So what's the plan? To reset mousemodel to "extend", or to set it for this test specifically, or to patch popup menu implementation, so it doesn't show up upon a click outside of buffer area? |
justinmk
left a comment
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.
This is looking quite good, thanks for putting some thought into this :)
This comment was marked as resolved.
This comment was marked as resolved.
It should, yeah |
|
@justinmk Okay, no problem. Should we also merge default autocmds in? Kind of
I see neither l10n nor menu API but that's not important, I guess. Just going to embed a piece of VimScript into Lua for now. |
no, don't want to decide that right now :) Menus really are just mappings. So
that's fine--thanks! |
| anoremenu PopUp.Paste "+gP | ||
| vnoremenu PopUp.Paste "+p | ||
| vnoremenu PopUp.Delete "_x | ||
| nnoremenu PopUp.Select\ All ggVG |
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.
todo(?): for many of these, it might be nice to maintain the cursor position and the viewport, so there is no visible jumping-around
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.
At least for "Select All" and other Visual-related stuff, it's impossible, AFAIU. The editor really wants to keep the cursor both visible and anchored to one of selection ends, so it may adjust the selected range upon any viewport change.
Future
|
anoremenu PopUp.Go\ to\ definition <Cmd>lua
\ if #vim.lsp.get_active_clients() > 0 then
\ vim.lsp.buf.definition()
\ else
\ vim.cmd 'normal! <C-]>'
\ end<CR>
vnoremenu PopUp.Go\ to\ definition <Cmd>lua
\ if #vim.lsp.get_active_clients() > 0 then
\ vim.lsp.buf.definition()
\ else
\ vim.cmd 'normal! <C-]>'
\ end<CR>It's working but looks ugly, so I didn't add it yet. BTW. "vnoremenu" with the same code needed, because "amenu" would drop from Visual mode, and so it ignored the selected text in favor of the word under cursor.
---@param expr Lua function or string of "normals"
---@param opts Table with optional keys:
--- args - array of args for expr
--- cond, fallback - some condition and "fallback" action
--- keepview, remap - some boolean flags
--- more stuff maybe...
function vim.action(expr, opts)
...
endThen the menu items could look like this But this one could also become redundant if menu API is ever ported to Lua.
<Lua>
print"Hello world"
<CR>which is a rough equivalent of <Cmd>lua << <CR>
print"Hello world"
<CR>except the latter is not working, of course. But this probably deserves opening a new issue first. And again, it's more useful for mappings defined in VimScript. With |
|
do we need a |
|
windows CI failure is unrelated, known flakey test: |
This comment was marked as resolved.
This comment was marked as resolved.
|
Resolution
Future
Locked to keep the summary visible. You can always chat or open an issue if you have new information/topics to discuss. |
Closes #15521