reddit / emacs

How to send ctrl-X in emacs / vterm?

WaitingForEmacs · 2022-06-22 13:42
After many years of being a `-nw` flag user and mostly using emacs remotely via ssh, I am trying to update my workflow a bit and use a local version with a graphic display. I use alpine (an update of pine) for email and it looks like that runs perfectly under vterm (and not so well under ansi-term), however I have not been able to find a way to escape Ctrl-x which is the key that alpine uses to send mail. Is there some generic way to escape control sequences in vterm, or perhaps more broadly in other emacs terminal modes? Thanks in advance for any tips you can send my way.
MitchellMarquez42 · 2022-06-22 15:01
See if C-c C-x does the trick.
jsled · 2022-06-22 15:13
vterm-send-C-x is an interactive Lisp function in ‘vterm.el’. (vterm-send-C-x) Sends C-x to the libvterm. It does not appear to me, here, to be bound to anything by default. So you could `M-x vterm-send-C-x`, or bind it to something convenient for you. Or look it up (`C-h f` for `describe-function`) and see if it's bound for you.
WaitingForEmacs · 2022-06-22 15:18
Thank you!!
quantum_mattress · 2022-06-22 17:33
Yes - I know in shell mode, the C-c prefix works with most things like C-c, C-d, etc.
tjgrinn · 2022-06-22 19:47
Vterm comes with `vterm-send-next-key` which can be bound to `C-q` like in the README. That way `C-q C-x` will send a C-x to the terminal.
WaitingForEmacs · 2022-06-22 20:55
You guys are crushing it. That is exactly what I was looking for. I should have tracked down the README before asking, so I appreciate the help.
tjgrinn · 2022-06-22 21:54
No problem! I just added it a few weeks ago so it's no surprise you might've missed it.