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.

71 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
13
votes
0answers
216 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
213 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 ...
3
votes
1answer
72 views

Maps literally read < and > instead of the actual character

Situation Entire .vimrc: inoremap a <CR> Action: user types ia to enter insert mode and type a Expected result: a carriage return is entered into the document Actual result: the characters &...
3
votes
0answers
171 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 ...
2
votes
1answer
29 views

Remapping `v` in netrw/calling NetrwSplit(5) directly

So I've created some helper functions to help work around netrw. They are some keybind simplifications that help with things like window/cursor management when opening files, where to open them, ...
2
votes
0answers
45 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
1answer
47 views

Is it possible to `lmap` a key to multiple characters?

I want to use f and t command for Unicode characters, so lmap is the way to go. I can map a letter to a Japanese kanji: :lmap k 中 then after i_CTRL-^, I can press fk to locate 中。 However, there is ...
2
votes
0answers
44 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
0answers
49 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
108 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
1k 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> ...
2
votes
0answers
129 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
313 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
16 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
0answers
28 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
16 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
31 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
14 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
21 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
50 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
0answers
51 views

Change behavior of `gx` key

I used to use chromium before and then, I could press gx on an url and vim would open it in a new tab if a chromium instance was already running, otherwise create a new window. But in firefox, when I ...
1
vote
2answers
58 views

Can I make left Alt act the same as shift key using key map?

I would like to swap my left shift key with my left alt key, and I would like to know if it’s possible to achieve this with vim key mapping. Maybe not swapping but copy the whole shift key map to ...
1
vote
1answer
103 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
55 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
29 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
55 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
19 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
14 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
64 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
1answer
1k 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 ...
1
vote
0answers
79 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
25 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
49 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
72 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
350 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
37 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
1k 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
60 views

Do not display letter when waiting for key sequence to complete

I have the following binding in my .vimrc and the default timeoutlen of 1000ms. inoremap df <Esc> inoremap fd <Esc> However, when I type df in insert mode slowly but under the threshold, ...
1
vote
0answers
168 views

Jump from tag-to-tag in xml?

I'm using emmet-vim which says that it can work in xml files but I can't seem to navigate between tags. Say I have this structure: <dependency> <groupId>com.google</groupId> &...
1
vote
0answers
158 views

Some mappings in my .vim/ftplugin/*.vim change upon entering a window with different filetype, and some don't. What could be the reason for this?

I have special commenting macros for different languages in my ftplugin files, and macros for creating "dividers" (i.e. commented out line of dashes #--------...). I also define a Vimscript filetype ...
1
vote
0answers
252 views

Troubleshooting mapping

I have the following in my vimrc: nnoremap <C-J> o<Esc>k$ nnoremap <C-K> O<Esc>j$ The bottom mapping works as expected, but c-j now produces the same effect as i (which is ...
1
vote
1answer
502 views

Mapping doesn't work for tabs

I have several files opened in tabs in Vim. I want to switch between tabs, so I use Ctrl+left to move left (previous) and for next also. But my mapping doesn't work. :map <C-Left> :tabprevious&...
1
vote
0answers
87 views

Disable Alt-key combinations for non ASCII characters

I use the Alt-Latin keyboard layout (set in OSX) to write diacritics in Vim. This layout uses combinations with the Alt and Shift keys for modified letters. For example <A-.> followed by a ...
1
vote
0answers
105 views

<s-f10> cannot be mapped in neovim

At least not on my mac. it works fine in vim. is this simply an error in nvim?
1
vote
0answers
39 views

mapping with multiple substitutes inserts just a newline with 'R'

I have this mapping in my vimrc: nnoremap <F3> :%s/ä/\\"{a}/g<CR> :%s/ö/\\"{o}/g<CR> :%s/ü/\\"{u}/g<CR> :%s/ß/\ss{}/g<CR> after executing it, an 'R' is inserted above ...
1
vote
0answers
88 views

How can I enable onmifunc completion automatically?

I want to enable omnifunc in my MacVim whenever I start to type in a few of leading words, such that whenever I type np., the completion list pops up to show me the candidates (e.g. np.random, np....
1
vote
0answers
108 views

Ctrl-Key in vim keymaps running on raspbian are not responsive

I'm currently running raspbian (a 7 version, cat /etc/debian_version says 7.8) on a Raspberry Pi 2 Model B. Because I have to edit some of my python files directly on the running system, I copied my ....
1
vote
0answers
203 views

Difference between smart_close_popup() and cancel_popup() in neocomplete?

I have started using neocomplete and there's one thing that confuses me. What's actually the difference between neocomplete#smart_close_popup() and neocomplete#cancel_popup() I am definitely not ...
1
vote
0answers
180 views

Use ISO Level3/5 as modifier in vim keymap?

I've been using the pseudo keymap solution from my previous question to great effect for 6 months now. The short version is that it allows me to keep the computer keyboard map in my usual Programmer's ...
0
votes
0answers
21 views

Make vim commands be executed once a job on a terminal buffer has finished

The context I've the following mapping in ~/.vim/ftplugin/cpp/mappings.vim. What this mapping does is to compile an arbitrary C++ file and open two windows (a) and (b). (a) shows the output of the ...