restoring standard emacs key binding effectiveness in VSCode Terminal window - macos

I periodically get thrown into the emacs editor in vscode, when I issue git commands.
For example, I'd like to edit the commit message for git, but the standard emacs key sequence ctrl-X ctrl-C is not accepted in the terminal window. This makes it difficult to exit emacs in the standard way.
I assume it's not being sent because MacOS or VSCode is intercepting the key combination.
I also assume that if MacOS was intercepting a two-keystroke combination, I would have noticed when running emacs on the MacOS terminal program (Unix shell prompt)

Related

I noticed that my terminals get a bit kooky after they forcibly disconnect from SSH

The terminal begins to behave a little bit strangely after an SSH session inside has been terminated (due to sleeping the computer or killing it via <Enter>+~+.).
It causes a beep to be emitted whenever focus enters and leaves the particular terminal. Also when in my zsh shell, a blank new line appears to be fed into the terminal.
I've tested this in:
tmux in alacritty
raw alacritty
iTerm2
This is not a hugely annoying behavior, although the bell is definitely annoying for sure.
Today I was able to finally find a way to reproduce the behavior. Clearly this is somehow related to a terminal mode that SSH puts the terminal into and which it fails to clean up when it dies. But it is also related to the focus reporting.
I have tried stty sane but it does not work. Not even starting and quitting vim works. That usually is able to reset various other terminal state weirdnesses, such as being stuck in mouse mode where clicking the mouse on the terminal (and especially scrolling your mouse) produces lots of bells.
Inspired by the answer https://superuser.com/a/1017817/98199, I found that issuing the command echo '\x1b[?1004l' does effectively turn off the focus reporting, and restores normal behavior.
Since vim definitely is capable of recognizing focus events I do not know why starting and stopping vim does not do the trick for this. I suppose I will make this command into an alias and just run it when I need to.

In mosh how can I scrollback in the terminal and use mouse in emacs, less etc

I want to use mouse-wheel in emacs and also scroll-back in the terminal history. When I do mosh --no-init I can scroll-back in the terminal history but I cannot use mouse wheel in the emacs. Instead if I do only mosh without --no-init flag I can use mouse-scroll in Emacs but cannot scroll back in the terminal history. I get lost in finding solution to fix this.
In mosh is it possible to scroll-back in the terminal history along with using mouse wheel in emacs, nano, less?
mosh prevents the use of scrollback #122
The root cause of not able to scroll is caused by mosh entering a
"alternative screen" mode. It can be disabled using the --no-init flag
(see the doc). Just alias mosh='mosh --no-init' and the problem
will go away.
Developers argue that:
I don't consider using --no-init as a way to get reliable access to a local scroll-back buffer. But please interpret this open issue as simply an acknowledgement of the request. We do not have any intention on implementing this feature
And recommended me from a issue I opened to use screen or tmux as a solution. But I was not able to make them work. Where when I use tmux inside the remote machine I experience that:
Scroll-back in the terminal history works, but it prevents me to copy some text from previois terminal history, it jumps back to current cursor spot right away.
Scroll-back does not work within emacs, less, nano etc.
My comment in their repsonde to mosh prevents the use of scrollback #122 labelled as This comment was marked as off-topic., which was what I mentioned in this question.
Their issue related to mosh prevents the use of scrollback #122 was open since 2012, which is around 8 years and I believe it is abandoned. If it is implemented it was implemented by now.
Contributors of mosh ignoring this issue. and saying There is hundreds of subscribers. Please think very carefully before commenting . // There was not hundreds of subscribers in the thread.
In summary, I am not having issue with --no-init, I am having issue with mosh related to mosh prevents the use of scrollback #122 , which does not support scroll back in terminal history along within tools like emacs, nano, vim, vi, less, more and so on. If a developer switching from ssh to mosh there is no way he/she can adapt the scroll behavior of mosh. Without having both together like ssh does, there is no meaning to use mosh at all.

How to clear LLDB console

How do I clear the console screen in an LLDB session terminal? I know in GDB this is done with shell clear
(Ctrl+L does not work for my case since I am running my LLDB session in VSCode debug console)
In the gdb case, shell clear is spawning a sub shell and calling that shell's clear command. Because the shell is sharing the same terminal with gdb, this acts to clear the terminal.
In the case of VSCode, lldb isn't directly connected to a terminal, it's just feeding text to VSCode through a socket. So it has no influence over the window VSCode chooses to display the text in. The VSCode-lldb interface would have to have a "clear your console" primitive for it to work in cases like this. That does not exist on the lldb side. I don't know whether it exists on the VSCode side.

why command is canceled when I move terminal window on ubuntu?

everyone!
I installed ubuntu on vmware for working laravel framework.
I have problem with terminal.
when I move terminal window using mouse, running command is canceled.
Please see this...
hkg328#hkg328-virtual-machine:~$ ^C
hkg328#hkg328-virtual-machine:~$ ^C
hkg328#hkg328-virtual-machine:~$ ^C
hkg328#hkg328-virtual-machine:~$ ^C
whenever I move terminal window using mouse, following line appears in terminal.
hkg328#hkg328-virtual-machine:~$ ^C
What is the reason?
What should I do for solving this problem?
(When I move terminal using shift key+mouse drag It is ok.
But I don't want to use shift key.)
Thank you.
The likely problem is that your terminal has the xterm mouse-protocol enabled (usually from running some text-editor). Occasionally that does not clean up after itself (a problem with vim's plugins), and you'll even see this enabled on the shell command-line.
When you click in the text-area without shifting, that sends escape characters (and control characters) when xterm mouse-protocol is enabled. For xterm, at least, clicking/dragging the window border (including title area) shouldn't pass those escape/control characters to the application.
The use of the shift-key is built into the mouse protocol; if it's enabled you'll get that behavior -- always.

Emacs With GUI on mac os. Different keyboard layout key bindings

I am using two version of emacs. One in terminal, and other from emacsformacosx.com. In terminal I can use non-English keyboard layout and everything fine. But emacs version with gui don't understands these commands. Why it happening? Why I can't just run terminal version with GUI?
update:
For example when I pressed M-x with non-English keyboard layout in minibuffer appear text - M-ч is undefined. ч is a symbol equal to x. Pressing same shortcut in terminal version of Emacs works fine. Emacs running on other OS haven't this problem. I think to solve it needs to run terminal version with gui and use it. It is impossible. But why?

Resources