Questions tagged [key-bindings]

Doing an action when pressing a key. These are also called key mappings or mappings. For questions about default key bindings, as well as creating or redefining key bindings.

119 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
13
votes
0answers
260 views

Using <C-,> causes "<80>ü^D," to flash in the showcmd area?

I've mapped <C-,> as well as some other special keys (<C-Enter>, <C-S-Space>, ...) in my vimrc like, :set <F13>=^[[44;5u :map <F13> <C-,> :map! <F13> <C-...
4
votes
0answers
265 views

Remapping home row keys hjkl when using repmo plugin

I am new to Vim and I am trying to remap the four (arrow) navigation keys hjkl one step to the right on the keyboard to get j down k up l left ; right I am following the recommendations given in ...
4
votes
0answers
297 views

Is it possible to remap the character following CTRL+R in INSERT mode?

While in INSERT mode, I'd like to make <c-r>* behave as <c-r>+. Is that possible? I tried both of the following, but no luck: inoremap <c-r>* <c-r>+ onoremap * + Is it ...
3
votes
0answers
2k views

Unable to map ctrl-l

My _vimrc contains the following lines: set nocompatible source $VIMRUNTIME/vimrc_example.vim source $VIMRUNTIME/mswin.vim behave mswin nmap <c-l> :w<CR> nmap <c-m> :w<CR> ...
3
votes
0answers
479 views

Using text objects with IJKL navigation keys

Like many people, I prefer a triangular or inverse-T navigation key format like IJKL instead of HJKL for ergonomic reasons. There's a pretty simple way to set this up in vim that I've used for years: ...
2
votes
0answers
71 views

Conditional mapping for two plugins (UltiSnips and Vimwiki)

Vimwiki table default mappings include <tab> for moving to the next table column in insert mode. Also UltiSnips default mappings include <tab> for expanding snippets in insert mode. Here ...
2
votes
0answers
46 views

How to delete the previous buffer when loading new result from quick-fix window?

In the quick-fix window, if I'm loading new results, the previous buffers stay which I don't want. I want only those buffers to stay which I open intentionally (e.g. to write new code, do diff of ...
2
votes
0answers
55 views

How to get this tab/autocompletion setup?

Basically what I want is a PyCharm-like completion: If there is only whitespace, insert <TAB>. If pum is visible and nothing is selected, complete with first, otherwise choose the selected word/...
2
votes
0answers
66 views

How do I delete a block a text using the mouse cursor?

Yes, I know this is unconventional, but I just want to know. When I right click on a chunk of higlighted text, the dropdown doesn't show any option for deleting - just copy, copy as html...show ...
2
votes
1answer
314 views

How can I make Vim NOT remove lines below with Ctrl and Left Arrow?

How can I make Vim not remove lines below with Ctrl and Left Arrow? So I just found a dangerous setting with Vim on Linux. If I press Ctrl and Left Arrow then whole rows below start vanishing. With ...
2
votes
1answer
2k views

Integrating autocomplete and snippets

I'm trying to set up an autocompletion/snippet workflow that's a bit complicated. This is stemming from needing a better workflow for latex. Right now I'm using coc.nvim and UltiSnippets but I am ...
2
votes
0answers
92 views

Function keys: won't work with macros (I tried a lot)

Specs: Vim 8.0 patch 500 gnome-terminal 3.18.3 on Ubuntu 16.04 running Unity Function keys in my vim slightly misbehave, however, in an annoying way: I can't completely use them in my macros. After ...
2
votes
0answers
159 views

^O (Ctrl+O) works slowly

In my system, <C-o> works really slowly compared to <C-i> or <C-p>. Is it just my experience or is there a subtle reason behind it? Is this in any way related to ttimeoutlen? I saw ...
2
votes
0answers
140 views

Why are the vim line wise movement commands inconsistent?

While browsing index.txt looking for space to fit some custom keymappings, I noticed something. ^ - First CHAR of current line N- - First CHAR N lines higher N_ - First CHAR N-1 lines ...
2
votes
0answers
19 views

greek_polytonic keymap file not working

Is anyone using this keymap file with success? https://github.com/vim-scripts/greek_polytonic.vim I get only Latin output after following the instructions.
1
vote
2answers
47 views

jedi-vim prevents mapping [[ to * and ]] to #

jedi-vim appears to prevent mapping [[ to # and ]] to * mapping does not alter behaviour produced by [[ or ]] in .py files when jedi-vim in bundle folder (and does alter behaviour in .py files ...
1
vote
0answers
26 views

Mac + vim : character ASCII 160 instead 32 as space

This is a problem that is making me crazy so any help is welcomed :-) That happens to me mainly when typing scripts with Vim in Mac but I think I got the problem somethimes when typing some commands ...
1
vote
0answers
20 views

cannot run `:normal s<CR>` just for nerdtree (opens file vertically splitted)

what im trying to achieve: use <C-V> to paste text in normal mode in current buffer use same <C-V> to vertically split a file from nerdtree what i know: when you are with your cursor in ...
1
vote
0answers
24 views

IM's keyboard shortcut is ignored only in vim

I'm Japanese so I'm using IM. In my IM settings, Ctrl+Backspace is assigned to the "undo the last conversion" functionality. This shortcut usually works on normal programs (e.g. on Mozilla ...
1
vote
1answer
111 views

Remap enter Terminal-normal mode Neovim to something else than Esc

I have remaped enter terminal normal-mode to <Esc> with: tnoremap <Esc> <C-\><C-n> and it does work. But I am using zsh vi-mode, which also requires the use of <Esc> to ...
1
vote
0answers
19 views

Can I use Mac keybindings in insert mode?

I use Vim on a Mac book, and I am wondering if it is possible for me to use Mac keybindings when I am in insert mode. For example, option + delete to remove the word before the cursor, command + ← to ...
1
vote
0answers
30 views

Any ideas on how to jump back and forth between a file and its corresponding unit test?

Here's an example of a typical project structure for me: components/a.js components/common/b.js tests/unit/components/a.test.js tests/unit/components/common/b.test.js Notice that inside the /unit ...
1
vote
0answers
34 views

Can't remap to <C-)>

I'm using a French keyboard, and <C-]> to access to a tag definition is cumbersome. You need AltGr+] to access the ] character, so the whole thing is 3 keys pressed at the same time: Ctrl+AltGr+]...
1
vote
0answers
83 views

What are the acceptable values for termwinkey?

What are the acceptable values for termwinkey? From VIM's documentation, it appears that any single keystroke (multi-byte or not) should be valid. However, setting it to <D-'> (my first choice) ...
1
vote
0answers
35 views

Terminal window interprets quick initial q as macro record

I have a function that opens a terminal window running some program. The program is quit by pressing q. But when I press q in the terminal window shortly after (within 1-2 seconds) of it being opened, ...
1
vote
0answers
74 views

Typing colon character in Insert mode undoing changes?

I am really curious as to why this is happening. I have this line in my .vimrc file (I am using WSL2 on windows and this line helps support copying from vim to the system clipboard): set clipboard=...
1
vote
1answer
183 views

Remapping caps tock to ctrl and backspace while in vim only

I'm pretty new to vim, and I'm starting to discover it, and seeing how important the ctrl key is. I've seen that many remap the caps lock key to ctrl and escape at the same which seems really useful, ...
1
vote
0answers
47 views

When Pop Up menu is visible, <M-Key> no longer works

I use Alt plus h/j/k/l/w/e/ etc... to escape insert mode and move. e.g. <M-h> to escape insert mode and move left. However whenever the pop up menu is visible (pumvisible), then <M-h> ...
1
vote
0answers
122 views

How to debug change in command / key binding behavior (<c-p> / ctrl-p for ctrlp.vim vim plugin)?

I'm using the vim ctrlp plugin, and the <c-p> (Ctrl+p) key binding / command (which invokes :CtrlP) often goes back to the vim default of moving the cursor up a line. I can't figure out why ...
1
vote
0answers
85 views

Re-mapping Swedish letters

On a Swedish keyboard to the right of the keyboard one has: O, P, Å L, Ö, Ä [ and ] are extensively used by Vim, and hard to reach on my keyboard, so therefore I've mapped these to Ö and Ä in my ....
1
vote
0answers
18 views

Mapping <C-[> causes input() to not be abortable

The following function, when at the prompt, if one presses <Esc>, then it will print EXIT. function! Testinput() let g:searchString = input("Enter search string: ", 'default', 'syntax') ...
1
vote
0answers
46 views

Undo a shortcut association, Vim

A few days ago, accidentally, I create a shortcut/keys association and now I can't use the '<>' key within Vim (outside of Vim, the key works just fine). That's a Spanish keyboard from which I can ...
1
vote
0answers
46 views

F10 is not yet available to Vim via gnome-terminal

I'm using gnome-terminal for first time (after using xterm for many years). And the one keystroke that no longer works within gnome-terminal from my Vim application is Function Key F10. I've turned ...
1
vote
0answers
30 views

Save & recall favourite vim :commands

I often find myself using the up arrow at the vim command prompt : Is there a way to 'favourite' some? Or at least an easy way to search through previous commands? For example, I couldn't remember ...
1
vote
0answers
74 views

Can't figure out where this mapping comes from

For more than a year, I have unmap <C-X> in my .vimrc because I can't figure out where this mapping comes from. I used verbose map <C-X> as suggested in another topic, it returns v &...
1
vote
1answer
340 views

Vim feedkeys in operator pending mode

I'm trying to build a very simple plugin that allows for pressing a keymapping <Leader>, to call a function that prompts for a single keypress: function! ControlKey() echo "Key → <C-Key&...
1
vote
0answers
80 views

How do I securely remap the current split's width and height keys?

Iam trying to put nnoremap <C-Right> <C-w>3> in the ~/.vimrc But it's not working. Also, VIM has a PRETTY ANNOYING line erasing binding to ctrl+Right in the Normal Mode. I would like ...
1
vote
0answers
52 views

How do I remap result navigation buttons after a search?

I search with /, press enter, and go a few results down using n. I realize that I have gone a few more results down than I meant to and want to go back a few. I press m because that is next to n just ...
1
vote
0answers
133 views

Prevent "Pattern not found" error in autocompletition (i_Ctrl-N)

I use the following mapping for <Tab>: inoremap <expr> <Tab> getline('.')[col('.') - 2] =~ '\w' ? "<C-N>" : "<Tab>" It works well except that if I want to insert a tab ...
1
vote
0answers
25 views

Evim: Typing to delete and replace selected text instead reformats the current line if the letter typed is Q (vim-gtk, debian)

In the vim-gtk version of evim, selecting text and then beginning typing produces the normal WYSIWYG result of the first character typed deleting the selection and replacing it with that character (...
1
vote
0answers
21 views

How can I remap the arrow buttons in insert mode when Pencil is enabled

I use vim to write text, and that’s why I often use it in combination with the Pencil plugin. The plugin creates significant delay in the movement of the cursor when in insert mode. I have tried to ...
1
vote
0answers
107 views

Change the behavior of CTRL-X submode key bindings

I wanted to change the behavior of some keys in the :h i_CTRL-X submode. For example, I wanted to use the following: inoremap <expr> <C-f> pumvisible() ? "\<C-x>\<C-f>" : "<...
1
vote
0answers
322 views

In Vim, how to enable Meta in all keybindings?

In case it's relevant, this is on MacOS and iTerm. How do I use key mappings that involve the Meta key, e.g. <M-e>? For example, the auto-pairs plugin has a keybinding that allows you to ...
1
vote
0answers
29 views

Why does `<C-k> {char1} {char2}` work for digraphs but `{char1} <BS> {char2}?

Based on the documentation of digraphs-use (:help digraphs-use) it should be possible to do both <C-k> {char1} {char2} and {char1} <BS> {char2}, but the second one does nothing and <BS&...
1
vote
0answers
52 views

Pressing CTRL-U combination gives invalid arguments for function timer_stop?

I am not precisely able to reproduce the exact conditions under which this occurs, but sometimes, when I press CTRL+u, I get the errors below. I cannot even exit vim with CTRL+c or suspend. I haven't ...
1
vote
0answers
82 views

Odd langmap behavior with multi-key bindings

I'm getting some odd behavior from langmap. With set langmap=hjki;ihjk inoremap k u works as expected, inoremap jk u maps to ji, inoremap kik u maps to khi. When I say 'maps' I mean that's ...
1
vote
0answers
552 views

How to map <C-Space> to ESC

I am using nnoremap <C-Space> i inoremap <C-Space> <Esc> to map to Esc. It works for all file with any extension but it doesn't work for the files with ".tex" extension ( I am ...
1
vote
0answers
49 views

applying a map only to normal buffers

I have a binding that I use heavily and is very close to my heart. However, it tends to break (only a few) other functionality, primarily the command-line window. The bind is normal mode : ...
1
vote
1answer
2k views

Make YouCompleteMe open definition in vertical split even if buffer is not saved

There is something I cannot do with YouCompleteMe that I could do when just using tags to navigate to a definition or declaration. The desired behaviour is (taking into account that , is my leader ...
1
vote
0answers
438 views

How to map shortcut to double square brackets using the leader key

I'd like to assign [[ to leader[ and ]] to leader]. I've tried the obvious: let mapleader=" " nnoremap <leader>[ [[ nnoremap <leader>] ]] but the former mapping doesn't work. I've ...