Forwarding keystroke to shell in Shell mode - emacs

Is there some way to forward a keystroke to the shell when using Shell mode?
In particular, I sometimes want to use CTRL+\ to sigkill a process, but Emacs intercepts it
Another problem is that I sometimes want Tab to get forwarded to the shell to get default tab completion.

In general, M-x term, or even better, M-x ansi-term, give more complete emulators than M-x shell. Once you are in term-mode you can get into char mode with C-c C-j to interact with the terminal. Once you are in char mode, you should be able to use the terminal's tab completion and other terminal keyboard shortcuts. You can get back to the regular default line mode with C-c C-k.
You can read more about the differences between these modes here

You can press Control-Q before any other key to treat that key literally. So, C-q C-\ or C-q TAB should do what you want.

Related

How can I get CTRL+K CTRL+E to work in terminal

I don't use these specific control commands in vs code. But I do use them on the terminal all the time.
How can I configure VSCode to send them to the terminal?
When press CTRL+E or CTRL+K, it says:
waiting for the second key of chord.
CTRL+A works in the terminal just fine, so I figured I'd either have to set something or unset something, but I've had zero luck in tracking that down.

Background mode for vim in windows

I've recently started moving away from my regular editor to vim and I use powershell as my default shell. I noticed in the normal mode that pressing ctrl z allows to quickly go back to the terminal ( although in a very different mode, regular shortcuts like ctrl L to clear screen etc. weren't working ). After reading through some posts I got to know that this shortcut is meant to put vim in backgroud mode in linux and fg brings it back to the foreground. Since this doesn't work in powershell is there an alternative way to get the same functionality?
PS: Is there also any alternative to reach powershell prompt from within vim?
Thanks!
The terminal command can be used to reach a powershell prompt from within Vim.
:term powershell
This will open powershell in a new terminal window.
There are various ways to invoke a terminal. For example, :tab term powershell will open the terminal in a new tab. :term ++curwin powershell will open the terminal in the current window. See :help :term for more details.
Here is some more relevant information from a prior post:
Using :term will place you in Terminal-Job mode, where you can use
the terminal as expected.
Within Terminal-Job mode, pressing Ctrl-W N or Ctrl-\ Ctrl-N switches the mode to Terminal-Normal, which
allows the cursor to be moved and commands to be ran similarly to
Vim's Normal mode. To switch back to Terminal-Job mode, press i.

ansi-term hangs on C-s

When I type C-s using ansi-term in emacs, the shell becomes unresponsive. I can move the cursor around in the shell but I can't type anything. Is this some sort of obscure "feature", or is it a bug? How can I get around it?
It's an obscure feature: XON/XOFF flow control. C-s tells the computer to stop sending data to the terminal, because the terminal can't print or display the data as fast as the serial line is sending it. It made a lot of sense in the 1970s, but now it's pretty useless.
Press C-q to tell the computer to send data again. Press C-v C-s to send a C-s character to the application, and likewise for C-q.
If you want to turn off this feature, put stty -ixon in your shell startup file (e.g. ~/.bashrc). I don't know of a way to turn it off automatically by configuring ansi-term itself.

Ergoemacs C-x and C-c Shortcuts, and Apple Cmd shortcuts

For ergoemacs, what are the C-x and C-c shortcuts re-mapped to?
There doesn't seem to be a page to help people transition from regular emacs to ergoemacs mode. They just have a keyboard picture with everything in it, without any information on C-x and C-c.
Also for Apple keyboards, when it says Ctrl/Cmd, does that mean either can be used? It doesn't look like it. It seems that OS X Cmd shortcuts are taking precedence over the ergoemacs ones. Until Ctrl/Cmd means something else?
Ctrl-c is copy and Ctrl-x is cut.
According to ErgoEmacs Documentation, the keybindings C-c and C-y are respectively associated with native <copy> and <paste> functionality using emacs kill-ring-save and yank commands.
The traditional C-k and C-y methods of line pulling / yanking used in GNU Emacs and XEmacs are left behind in an attempt to "[make it] so you don't have to change your mindset when you switch in and out of emacs". We can expect many features of ergoemacs to be intuitive to the sort of end-users who have never been religiously bound to a text editor.
In current version of ergoemacs-mode, by default C-x and C-c are same as GNU Emacs's.
in older version of ergoemacs-mode, the gnu emacs's C-x and C-c are simply left intact. ergoemacs-mode just turn on cua-mode.

How to switch split screen Emacs where one screen is the editor while the other is terminal emulator?

I have ssh'ed to a remote machine and started emacs. I opened one small python application, and then split the screen into two, and M-x terminal-emulator in the other. I would like to edit the script in one section, then press C-x o and run it on the other section. Unfortunately, I can't seem to C-x o away from the terminal emulator and it just ends up typing x o.
Is there a better quick way of doing what I'm trying to do? Or is there a keystroke that will let me switch back to the editor section?
Edit: I just tried doing 'M-x shell', instead of 'M-x term', and that allows me to use C-x o to switch.
While at the * terminal* window, C-^ o to switch to other window, and C-^ C-h for more help.
ALT-X other-window
C-TAB also works locally. Will that translate over SSH? If not, bind other-window to another key that will go over SSH.
I found this post and I customized the .emacs file accordingly.
http://nex-3.com/posts/45-efficient-window-switching-in-emacs