-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
send alt-x keycodes to vim.fn.chansend() #29299
Comments
Actually, considering that the |
This sounds more like a feature request than a bug report. |
chansend() expects the "external" input, not the "internal representation". The external form of |
vim.fn.chansend
Okay, so it seems that what might be lacking here is a For the record, I've managed to work around this using an RPC session which calls map = "<A-x>"
job_id = vim.fn.termopen("nvim --cmd 'map " .. map .. " :echo \"hello\"<CR>' --listen /tmp/exnvimsock")
vim.defer_fn(function()
local sock = vim.fn.sockconnect("pipe", "/tmp/exnvimsock", {rpc = true})
vim.fn.rpcrequest(sock, "nvim_exec_lua",
"vim.fn.feedkeys(vim.api.nvim_replace_termcodes(..., true, true, true))", {map})
end, 500) But obviously that's not a completely general solution (unless you're willing to always execute your automated terminal sessions through an extra layer of nvim). |
I assume you are using termopen() because you want to see the UI of the nested nvim in a buffer. The :terminal buffer will have Thus there is no need to send raw bytes via chansend(). Alternatively if you don't need to see the nested Nvim in a :terminal...
|
Problem
I've been tinkering around with nested neovim instances and sending pre-recorded keystrokes to them with
vim.fn.feedkeys
. In order to allow me to send these keys without having to have the nested sessions open in a terminal as my current window, I've been trying to transition my code to usevim.fn.chansend
instead. But it doesn't seem to have the same effect when sending alt-modified keycodes.Steps to reproduce
Execute the following script, "hello" is not printed as expected:
Expected behavior
The mapping in the nested instance should execute and "hello" should be printed, as it does when we use
feedkeys
:or when we use a different mapping:
Neovim version (nvim -v)
NVIM v0.10.0
Vim (not Nvim) behaves the same?
N/A
Operating system/version
Ubuntu 22.04.3
Terminal name/version
Alacritty 0.13.1
$TERM environment variable
xterm-256color
Installation
build from repo
The text was updated successfully, but these errors were encountered: