Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
1answer
29 views

Cycle through autocomplete menu using tab

I am activating my autocomplete menu in vim using: inoremap <C-@> <C-n> and after it opened and only when it opened I would like to use the "tab" key to cycle through the menu. But when ...
1
vote
1answer
24 views

NERDTreeMenu Remapping

I'm a Colemak keyboard layout user and I recently started to learn and use Vim. I was able to map the arrow keys in the normal mode by putting custom mappings such as noremap u k in .vimrc (because ...
0
votes
0answers
22 views

How do I fix <DEL> behavior on macOS in VIM 8.1?

I've recently installed "huge" VIM 8.1 with Lua support (on macOS via MacPorts). This installation is side-by-side with my "normal" VIM 8.0 which lacks Lua support, so I have access to both versions. ...
1
vote
1answer
28 views

Send current vim line to seperate tmux pane and move cursor down

I am trying to send the vim line that is under the cursor to another tmux pane and then move the cursor on vim down 1 line. For context, I have vim open on 1 pane, and python open on another. I want ...
3
votes
2answers
174 views

Detect existing key binding before creating one

A plugin I've recently started maintaining currently checks to see if any bindings exist to its functions before creating the default ones. This makes it easy to setup custom bindings and not have to ...
3
votes
1answer
19 views

remap “undo key” to no op

I have a keyboard with an undo key right next to the esc key. I often miss esc, hit undo, which causes the vim process to be stopped. How can I remap the undo key in vim such that it doesn't do ...
1
vote
2answers
38 views

Switch order of three “words”

When writing code, I often have code of the form variableA operator variableB and I would like to edit it to be variableB operator variableA. Right now, I do this by deleting/pasting variableB to ...
-1
votes
0answers
24 views

How to configure VIM to drop all IDEs [closed]

So this is kind of a follow-up to this answer over on stackoverflow. I have been naivly using vim for quite some time now and recently finished my first small c++ project in production with it. I got ...
0
votes
1answer
67 views

Mapping (omap) to erase inside any of (), {}, [], <> or their embeddings

I want to map an operator-pending key combination to erase contents of any embedded combination of (text), [more text], <other text> or {misc text} by placing my cursor inside and issuing the c+&...
0
votes
0answers
26 views

Automatically inserting predefined strings to terminal buffer

When I compile any code file in vim, I use a specific mapping to open the terminal buffer and get into insert mode, but this requires me to be aware of the (potentially long and complicated) file name....
2
votes
1answer
33 views

How not to use <Space> as a hit-enter key in command output pager

According to :h hit-enter, a message is shown when there is something on the screen to read and the screen is about to be redrawn. For example, - After executing an external command (e.g., ":!ls" and ...
0
votes
0answers
24 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 ...
0
votes
0answers
23 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
2answers
45 views

neovim key remap specific to terminal buffer

I have been using nvim terminal mode to learn python and I want to have Ctrl-C break the python script from the terminal window even when I am not in insert mode. However, I also want Ctrl-C in my ...
3
votes
1answer
41 views

How to map Alt key with M J K L U I O to make a numpad?

I would like to have the keys M, J, K, L, U, I, O to be mapped to 0, 1, 2, 3, 4, 5, 6 (combine with the keys 7, 8, 9 already being on top of those keys) to be a total numpad when I hold a modifier key,...
0
votes
1answer
16 views

Indent text to beginning of line

Sometimes I'll have some text with an arbitrary indentation. Sample text. If I want to bring this text back to the beginning of the line, I'll visually select the line and then ...
0
votes
1answer
30 views

Cannot map Ctrl+ number (except 6 or ^)

I am using macvim 8.1, the map command is :inoremap <C-$> <End> I also tried <C-4>, no working. tried other number, can't work too (however CTRL-6 could work). Also tried ...
2
votes
1answer
140 views

Unmap “delete file” in Explore mode

I just accidentally deleted an important file in :Ex (I thought I was still typing a search string and hit Shift+D and then Enter immediately). Can I unmap this entirely to avoid this (stupid and not ...
0
votes
1answer
24 views

nnoremap conflicts with i_CTRL-O

I added two normal mode mappings so that the cursor doesn't move when changing case nnoremap gUiw m0gUiw`0 nnoremap guiw m0guiw`0 Recently I had to uppercase a word and I tried like this: ...
0
votes
1answer
24 views

Prevent abbreviations from echoing on the command line

If I want to map a key to a certain command and I don't want the command to echo in the command line, I can do the following: :nnoremap <silent> <leader>N <... command ...> But can ...
1
vote
0answers
30 views

Why is <C-S> not remappable? [duplicate]

The vim version on my Mac is 8.1.1000, installed by homebrew: VIM - Vi IMproved 8.1 (2018 May 18, compiled Mar 11 2019 08:36:53) macOS version Included patches: 1-1000 Compiled by Homebrew Huge ...
0
votes
2answers
21 views

Syntax of keys on keyboard in documentation

What is the meaning of <S-x> or <C-x> in the documentation? Example: http://vimdoc.sourceforge.net/htmldoc/motion.html#%3CS-Right%3E I often see people using <C-x> to refer to Ctrl-...
1
vote
1answer
23 views

maparg returns empty string, but the mapping is effective

I have a mapping set by a plugin that I want to unmap, which is the sequence "cop". The mapping is defined in unimpaired plugin: nnoremap cop <Nop>. If I do :map cop n cop * <Nop&...
2
votes
1answer
34 views

How to make mapping for any mark

I want to make a mapping that jumps to the file of a mark but on the last visited line. Ideally I would write something like this: nnoremap z<mark> '<mark>`" Where z is some command ...
1
vote
1answer
33 views

<Alt> to enter normal mode on Windows

I'm new to vim, and I find using <Esc> to enter normal mode to be slow. I'm on Windows. I seldom use the <Alt> keys (left and right) when I'm editing text. It should be convenient to use &...
1
vote
1answer
25 views

How to see the active mapping of hjkl

I basically have the same problem as described here. In my vimrc I have nnoremap <buffer> <silent> k gk nnoremap <buffer> <silent> j gj nnoremap <buffer> <silent> ...
0
votes
1answer
23 views

How to return control characters from a function?

I have a keybinding that works: inoremap <silent> <Tab> <C-r>= \ pumvisible() ? "\<lt>C-N>" : \ CursorAfterOnlyWhitespace() ? "\<lt>Tab>" : \ "\<lt>C-\&...
0
votes
1answer
32 views

How to show the left-hand side of insert mode mappings while invoking them in Neovim

Much like what was asked in this question: I want Neovim to show what I type, and keep recognising it as a mapping in progress even if I use Backspace or Delete. This is actually a very useful ...
1
vote
1answer
26 views

Cannot map some key to Escape key in insert mode

I've installed the vim by homebrew, current version and installation information is as below: VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 19 2019 11:57:49) macOS version Included patches: 1-950 ...
3
votes
2answers
51 views

Creating a repeatable mapping in Vim

I find myself often aligning certain code blocks by inserting one or more spaces, like in the following situation: case something of Just a▉-> ... Nothing -> ... Here ▉ is the position ...
2
votes
1answer
41 views

Are there any commands aside from ZZ and ZQ that start with Z?

I know that pressing ZZ is the same as :x and ZQ is the same as :q!; are there any others? There doesn't seem to be any around :help ZZ or :help ZQ, and :help Z brings up the -Z flag.
0
votes
1answer
24 views

How to expand selection to containing block?

I'm trying to re-do the C-w selection shortcut in Jetbrains's IDE. Is there a way to select visually the whole containing block ? for now, i use nnoremap <C-w> <Esc>viw vnoremap <C-w&...
0
votes
1answer
41 views

Why does my function sometimes respect whitespace?

I have a few functions to help with adding PHP docblock tags. Suppose a block like this: /** * Does a thing * * | */ Where | is my cursor position. I have a mapping to <localleader>@p, for ...
1
vote
1answer
42 views

How to do a conditional key mapping dynamically?

I know that I can do a conditional key mapping by map-expression: map [key] [condition] ? [foo] : [bar] But now my situation is somehow awkward. I want to map <C-h> to <C-w>h if I have ...
1
vote
1answer
27 views

How to have vnoremap call function once?

I'm trying to write a function + map that works on a visual selection. My function just prints out the marks right now: let g:count = 0 function! s:plink(...) abort let g:count = g:count + 1 ...
1
vote
1answer
19 views

bind mouse scroll up and down [duplicate]

I am trying to make it so, in the normal mode : some modifier + scroll upward triggers revert u some modifier + scroll downward triggers redo <C-R> Edit : I do mean mouse scroll some modifier ...
0
votes
1answer
34 views

map <expr> <F2> Cannot Check Focus Pane

How can a keypress dynamically change its behavior, depending upon which split pane has focus? (Specifically, whether the pane containing the cursor has another split pane to the right, or not.) map ...
0
votes
0answers
28 views

How to bind command+s to save file on macOS?

I have a Macbook. I want to save files by pressing command + s (this should happen if it is in insert mode or not, and I want it to go to non-insert mode after it is saved). How do I do this? ...
0
votes
1answer
25 views

Loading UTF keymap file

I need to load a particular keymap file that enables me to write underscore, special characters by typing :set keymap=iast where iast.vim is my keymap file This no longer works. Where should this ...
6
votes
2answers
265 views

Why does xnoremap mapping make visual selection slow?

I have made a mapping xnoremap j; <Esc> where j; puts you into normal mode if you're in visual mode. Having this mapping in my vimrc slows down visual selection. I can't figure out why this is ...
6
votes
1answer
465 views

What is the meaning of 'g'?

Note: this question has two sort of answers on StackOverflow but I thought perhaps a better answer would come from here, and, if not, at least it will be documented where it should be: What are the ...
2
votes
1answer
108 views

Terminal-mode not working with Ctrl-W

I am trying to work more with the built-in terminal for vim 8.1 and reading through the docs noticed it has two keybindings for entering the normal Terminal-mode. CTRL+\ CTRL+N as well as CTRL+W CTRL+...
3
votes
1answer
54 views

Exiting and entering insert mode again with key-binding

I'd like to experiment one of the tip by Drew Neil in his Vimcast, that is to "escape" regularly, so that it gives more granularity to the "undo" command. For example, I write one short sentence. ...
0
votes
1answer
25 views

Mappings with counts at the end without using loops?

Suppose you are trying to create a set of mappings such that pressing <C-t> followed by a number # would alternate to the respective tab at index #. I know that using a loop, I can do: " Map ...
0
votes
1answer
33 views

inoremap inserts unwanted tabs

I recently made myself custom insert mode keybindings to type faster in LaTeX. However, When I use them, Vim adds tabs that weren't part of the original keybinding. Example: Here is my inoremap: ...
0
votes
0answers
25 views

How to limit a key binding to a single key

I'm having trouble putting to words what I'm looking for, please mark as duplicate if appropriate I have a key binding that launches a search based on a fuzzy finder (specifically bindings to fzf and ...
1
vote
1answer
96 views

Visual feedback after executing mapping

I have the following mapping in my ~/.vimrc file: map <F3> my0v$"+y`y It works correctly, but I'd like some visual feedback or some other indication to show that I've pressed the key. Any ...
0
votes
1answer
57 views

Making Numpad numerical keys work in Vim using Ubuntu 18's terminal

In my current machine, I use Vim 8.1 in a Ubuntu 18's default terminal (Vim is running with TERM=xterm256-color, which is a requirement for me). Everything works perfectly, with the exception of the ...
1
vote
2answers
53 views

Disable filetype-specific `[`/`]` bindings like `[[` and `[m` [duplicate]

The default vim filetype commands create new bindings beginning with [ and ]. Is there a way to prevent them from doing so or control which bindings are created? I like using [ and ] to scroll up and ...
2
votes
1answer
90 views

Numpad characters don't work in keybindings mappings (but work in general)

For my terminal Vim 8.0, I have downloaded this plugin that makes changing font size on the fly easy: https://github.com/drmikehenry/vim-fontsize Following the instructions, here is how I decided to ...