I'm trying to remap Ctrl-C to Esc, or <C-c> to <Plug>(PearTreeFinishExpansion) in neovim but I can't seem to be able to do it. If I do either of these following commands in nvim they work:
:map <C-c> <Esc>
or
:map <C-c> <Plug>(PearTreeFinishExpansion)
But if I try to put them in my init.lua file in either vim.cmd[[imap <C-c> <Esc>]] or through the vim.api.nvim_set_keymap, they don't work.
Where do I need to define this remap to make it work? Cheers <3
Related
I'm trying to override shortcut for workbench.action.terminal.split. Default shortcut (Ctrl+Shift+5) works fine, but when I change it to shortcut with Alt prefix (e.g. it gets passed to terminal.
I check that shell receives keypresses using stdbuf -o0 showkey -a.
Is there a way to make VSCode handle such shortcuts and not pass it to terminal?
There are settings that allow to fine tune weather vscode or terminal handle key bindings; I found them at :
#id:terminal.integrated.commandsToSkipShell,terminal.integrated.sendKeybindingsToShell,terminal.integrated.allowChords
adding workbench.action.terminal.split to the list "Commands To Skip Shell" should do the trick for you
Finally the problem was caused by enabling terminal.integrated.sendKeybindingsToShell setting.
https://github.com/microsoft/vscode/issues/151603
I'd like to know how to close nano under a term using /bin/bash, all under the context of in emacs -nw. A plain ^X doesn't work.
I tried entering the character mode using C-c C-k, but that didn't seem to help. Is there another "just send this along" command for a key binding?
Short answer: Esc Esc X will be interpreted by nano in the same manner as C-x.
Background: A [sometimes-]handy nano tip: press Esc twice followed by the desired key to send the equivalent Ctrl- command.
I'm using Powershell in the integrated terminal by adding the following line to the settings.json file.
"terminal.integrated.shell.windows": "C:\\WINDOWS\\system32\\WindowsPowershell\\v1.0\\powershell.exe",
It works very well, but usually, when I'm in Powershell, typing ctrl+c cancels what I had typed and opens a new line.
But in the integrated terminal it just prints ^C.
Is there a way to fix it or find an alternative method to achieve this?
Thanks
This is with VSCode and not necessarily with the PowerShell Extension. You can see this by just using the default cmd.exe terminal, CTRL+C does nothing. It does not print the ^C at all, and creates no new line.
If you want this to work as expected in the normal command prompt or PowerShell.exe you will need to submit an issue to VSCode repository and request it.
I would expect this is all tied to the keybindings.json file. I went through that file but could not find a command available to the same function that occurs in the full command prompt or console. So this will likely need a new command added for VSCode.
If you search through the keybindings file you can see the terminal has that key CTRL+C bound to copySelection when terminalFocus && terminalTextSelected. This is why the ^C is being output, and no new line is being added.
A workaround:
Pressing Esc will erase the line back to the beginning.
In the Spacemacs Documentation, creating the .spacemacs dotfile is accomplished with the following command:
<SPC> : dotspacemacs/install RET
I parse this as being the following string (note the preceding space):
: dotspacemacs/install
followed by me hitting the enter key.
When I open up emacs and type the first space, nothing appears to happen and my computer makes a sound I typically hear with invalid input. I have also tried the following:
: dotspacemacs/install (no preceding space). This gives me Unknown command: dotspacemacs/install
M-x (on my keyboard alt x) followed by both of the previously mentioned commands. These both result in [no match]
Where am I going wrong?
did you see the spacemacs buffer after you started emacs?
make sure you install the spacemacs correctly or you can copy that file manually :
cp ~/.emacs.d/core/templates/.spacemacs.template ~/.spacemacs
close emacs and reopen to see if works
SPC f e d
does create / open it after a fresh install.
I am trying to run Emacs on a guest system (Ubuntu 12.04)
inside a Windows 8 command console.
This is done through vagrant + Virtual box.
It looks like this,
Guest system : Ubuntu 12.04
Host system : Windows 8
Environment : Virtual Box + Vagrant
Emacs works fine except I can not set mark on text (C-SPC).
I supposed there is some kind conflict with the key binding.
So I tried and added this to init.el,
(global-set-key (kbd "C-8") 'set-mark-command)
It doesn't work either.
Would someone please advice me?
If you're running Emacs in a terminal, then C-SPC and C-8 are unlikely to send what you want them to.
Use C-h c C-SPC to ask Emacs what it's seeing.
Try using C-# instead.
FYI, I found the Cygwin X server excellent for running GUI Emacs in a Windows-hosted VM. With GUI Emacs you can use many more key combinations than a terminal emulator will permit.
If you try that, start the server with startxwin rather than startx (the former enables the X server's windows to appear as regular Windows windows), and then connect from an xterm with ssh -X or ssh -Y (see the man page) to connect with X11 forwarding.
Thanks a lot for the hint.
I finally figured out what the problem really is.
From the answer #phils, this link clarifies the problem.
Why does Ctrl+. not work when I bind it to a command in Emacs?
In my case, all C-[any other key] bindings work, except for the set-mark-command.
I found a workaround.
By adding the following code to .emacs.d\init.el I can use F8 to set mark now.
(global-set-key [f8] (quote set-mark-command))
It is still confusing why in other command, Ctrl+key bindings works.