I have this problem in emacs when using it in console: when pressing C- it just inserts a space instead of invoking the set-mark function as it should. The control key works in console, as other key combination including CTRL key work (e.g C-h-b, C-x C-c).
Under X every keybinding works correctly, so I suppose it is not an emacs problem, but rather a console related one. Does anybody have an idea at least where to start to look for a solution?
edit: thanks for the links but it doesn't work either
after hitting C-h l (shows the keys input to emacs) I noticed that emacs doesn't get C-space at all, just space. But emacs still gets the other Ctrl keys combinations correctly. I am using the linux console, and as far as I know (correct me if I'm wrong) it's not an emulator: it is the terminal. Unfortunately I have no idea how to fix this annoying bug, as I find emacs very useful.
But you can also mess around with the keymaps in /usr/share/kbd/keymaps (load a new one with loadkeys) and see if you can figure out what's happening.
Thanks deong :), that solved my problem: I loaded another compatible keymap with `loadkeys other-keymap'.
I didn't think about it because CTRL worked everywhere else. So am I to understand that in the previous non-working keymap "Ctrl-space" was mapped to "space"?
Related
I tried
inoremap <c-`> <c-w>w
and various combination, but nothing seems to work. Is cntrl-` already mapped?
Using Lubuntu 64 bit 16.04 : lxterminal
Attempted cntrl-v cntrl-` to find the character but nothing shows up.
FYI: I am attempting to make sure I can do same thing with my VSCode editor.
In a typical terminal, control` is an ASCII NUL (zero), which vim will not map. Using cat -v to make the result visible, you'd likely see
^#
which is a single character...
You'd have the same behavior for a few other keys which typically produce a NUL, e.g., controlspace, or control# (really!)
You can't map anything to Ctrl-Backtick because Vim won't recognize it no matter what you do.
Find another key combination.
As #romainl and #Thomas Dickey pointed out, you can't do this in terminal vim.
If you want this is in VSCode, just add this to keybindings.json and add this to the editable pane.
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "ctrl+`", "command": "workbench.action.navigateEditorGroups" },
]
This will work as VSCode doesn't have the same problem of interpreting ctrl` as your terminal.
Also, it might not be a good idea to use ctrl` as it is already being used for toggling integrated terminal
⌃` Toggle Integrated Terminal workbench.action.terminal.toggleTerminal
How to modify keybinding for VSCode
Is cntrl-` already mapped?
No. Even if a key combination is mapped, you can override it in vim.
Attempted cntrl-v cntrl-` to find the character but nothing shows up.
Now you know why
Well, as two other answers indicated. I could NOT find the key combo & I do NOT think I will; however, when using nyaoVim the key combos do work. So, it's just terminal issue.
A bit of pain to install but now everything pretty much works!
I have my ctags setup correctly in vim, I used to press Ctrl+] and it just worked as it should. But for some reason, it stopped working recently, maybe because of the installation of some unrelated plug-in.
Whats even more confusing is that if I press Shift+Ctrl+] it jumps into the tag correctly, or if I use the command tag it also work. I've looked into :map and I didn't see any mapping that may be causing this. Any one have tips?
I've started using Neovim on Windows/WSL through ConEmu. It all works pretty amazingly except one pretty major flaw:
When I paste content into Neovim and forget to enter insert mode before, Neovim will register the input as keyboard strokes and execute them as commands. Needlessly to say, this can get pretty ugly, pretty fast.
A contrived example for clarity: I need to copy some text from my browser. The text in question is "sp" (yes, this is completely stupid, but bear with me). As I paste this into ConEmu (CTRL-V), the terminal transfers the input to Neovim that parses it as commands because it's in normal mode. In this example Neovim will replace whatever character is at the cursor at the time with p.
Vim for Windows has this solved and will paste the content without changing mode (how does a pure Linux environment handle this?). The problem with that solution is that it is dependent on the Windows file system which is a lot harder to tweak/maintain compared to apt-get/Ubuntu/WSL as well other annoyances.
So, initially I thought I'd try to make Neovim detect if the input was directly from the keyboard and not any other source, if it was, switch to insert mode and handle it from there. But I'm frankly not sure if this is even possible (especially though WSL). I also tried to add a shortcut that makes Neovim enter insert mode on CTRL-V in the hopes that is would trigger first and then correctly paste the content.
Maybe I need another terminal than ConEmu?
Anyway, I'm out of ideas, hope you guys can help.
ConEmu shall not detect any "internal" modes of the application you run in the terminal. Actually, when you "paste" something, terminal does almost the same thing if you press same keys manually.
Well, except one major difference: ConEmu uses "bracketed paste mode", so the console application may determine if user paste something or press keys manually.
So, it's the question to Neovim how to process/configure bracketed paste mode inside it.
In ConEmu settings, Keys & Marco -> Paste
There is an option:
Multi-line paste: avoid unexpected command execution by < Enter >
keypress
That's what you need.
Okay, so I've been trying out Vim (the standard console version; my OS is Linux Mint 13) and I'd like to get rid of having to use the Escape key to change modes. Preferably, I'd like to swap the Capslock and Escape keys, but as far as I've heard, that's not possible within Vim itself. Most "solutions" I've found involve changing the key on a global level (using xmodmap or whatever), but I don't really want that. If there's an easy way to swap Capslock and Escape only in Vim, please let me know.
Another common thing I've heard of is using "Ctrl-[" as an equivalent to Escape. However, because I'm using a German keyboard with a different layout, that's not an option. So, I thought I'd use noremap <C-ü> <Esc> in Vim (the "ü" key on a German keyboard is in the same place as the "[" key on US keyboards), but that didn't work, either. I'm assuming that's because "ü" isn't an ASCII character. Is there any way to get either of these options working?
UPDATE: Well, this is strange. After experimenting some more, it seems that "Ctrl-ü" does work after all. I'm not sure what happened – maybe I messed up some encoding-related settings while trying different things? If there is no good solution for remapping capslock, I guess I will stick with "Ctrl-ü".
So, yeah, eventually I decided to go with <C-ü> because it doesn't conflict with anything else and because it's the same as <C-[> on US keyboards.
However, because I'm getting tired of using the German keyboard layout for programming (for example, to get "{" you need to type "Alt Gr-7"), I'm switching my keyboard to US-International, which essentially has a similar effect as far as Vim is concerned. It also helps if you want to want to get into the habit of touch-typing; you actually can't look at the keyboard because the keys aren't labeled "correctly" ;-)
A lot of people use jk:
inoremap jk <Esc>
You can also simply do <C-c>.
Here is another alternative that may be useful to you! It involves changing the keyboard file related to VIM. I found this suggestion on this youtube video
$ cd /usr/share/X11/xkb/symbols/
sudo vim pc
to edit the capslock key to escape, change the capslock line to read as follows:
key <CAPS> { [ Escape ] };
:wq # to write and close the file
Log out and log back into the machine and it should be updated!
I have vimx installed, so I can copy in vimx to the x clipboard by using "+y and the like, which works well as long as I can keep the current vimx running.
However, I also love to be able to switch to the current running shell with ctrl-z and be able to paste what I copied from vim into the shell. Does anyone know how to do this, because as soon as I suspend vim with ctr-z the x-clipboard becomes empty, until I put vim into the fg again.
ok,
After about an hour of head bashing this issue, I have decided to use a different approach to do the same thing.
I will detail what I did here for the benefit of those with the same issue.
If you have wxcopy on your system that is enough to get copy/paste support on your system between vim and other apps. If you want to copy from vim, select the text using v or V or whatever method you prefer, then use the command :tee >(wxcopy). This will copy that code into the oldschool X11 cut buffer. This buffer has the added bonus of not requiring the parent application to be running for pasting to work, hence my problem goes away.
I realize it may be hard to get your hands on wxcopy, under fedora the package that provides it is:
WindowMaker
This isn't an answer as much as a push in the right direction, but start here:
:help quoteplus
:help x11-cut-buffer
Specifically the second help text has some interesting notes about suspending vim. It claims to write the buffer into PRIMARY and CUT_BUFFER0 so you can still use middle click after you've suspended. Maybe you've deleted those or a plugin is interfering? Maybe you are running an old version of vim (I'm running 7.2.182).
My suggestion is to disable all plugins you've manually installed and try vanilla vim. If that doesn't work, consider using vim's -V (verbose) flag and see if it will try to put the buffer into PRIMARY or CUT_BUFFER0 before it actually gets suspended.
I don't have vim compiled with X (vimx) so I can't actually test this myself. Hopefully that gets you in the right direction.