Linked Questions
78 questions linked to/from How to debug a mapping?
3
votes
1answer
607 views
Remapping motion keys [duplicate]
I recently found the awesome plugin named CamelCaseMotion which is awesome. I used their suggested mappings in my .vimrc for the plugin like this:
map <silent> w <Plug>CamelCaseMotion_w
...
1
vote
0answers
49 views
How can I detect which command triggers a shortcut in a third-party package? [duplicate]
I remap Shift + k to noh, but once I installed ale, it is no longer working since one of the command on the package uses the shortcut.
At least as far as I know, I feel that it is related to ...
1
vote
0answers
28 views
Mapping influenced my return key to toggle the syntastic check mode [duplicate]
I've mapped control-m to start the Syntastic check mode (Active/Passive)
nnoremap <c-m> :SyntasticToggleMode<Cr>
But in normal mode, when I tap the return key, it also toggles the mode. ...
24
votes
3answers
7k views
What does `<Bar>` mean?
In answering a question just now, I mentioned using a normal mode key mapping that can be found at the Vim Tips Wiki. In the middle of explaining the key mapping, I realized that I had no idea what &...
18
votes
5answers
22k views
arrow keys don't work in insert mode
When I hit the arrow keys in insert mode I get characters instead of navigation:
I'd like to be able to use the arrow keys to navigate.
Things I've tried
I have set nocompatible in my ~/.vimrc (...
16
votes
2answers
11k views
File Type dependent key mapping
I'm trying to setup mappings for <C-]> that, depending on the buffer's file type, trigger different functions. For example, if I'm in a Javascript buffer, I want <C-]> to trigger :TernDef. ...
22
votes
1answer
5k views
Can I map a Ctrl + upper-case letter separately from Ctrl + lower-case letter?
I am trying to figure out how to navigate windows little quicker, so I would like to map the following:
:nmap <silent> <C-F> :wincmd f<CR>
The problem is this remaps the ^f (lower-...
8
votes
2answers
5k views
How to run internal vim terminal at current file's dir?
I edit file /home/me/projects/myproj/src/util.c And want to start terminal at /home/me/projects/myproj/src. Vim version > 8 so I can run :terminal but it always starts at folder in which I've opened ...
9
votes
1answer
2k views
Why does remapping <Esc> make the cursor jump?
In .vimrc:
inoremap ii <esc> " ii to go back into command mode
The problem is, after ii, cursor jumps 35 columns right. The only other line which affects Esc:
...
6
votes
2answers
881 views
What does <Plug> do in vim?
I came across <Plug> in this command of easy-motion
nmap <Leader>w <Plug>(easymotion-overwin-w)
I tried to search for the definition of but no luck. What does it mean?
Does it have ...
6
votes
1answer
2k views
Separate C-m and Enter
I am using zsh, urxvt, tmux and in there vim. I am not 100% sure who causes the effect but I would like to bind something to ctrl and m but not to carriage return in vim. Does somebody how this is ...
10
votes
1answer
2k views
What does asterisk mean in vim mappings?
For example, easy clip has this mapping when you run smap k:
s k * <C-o>"_ck
The asterisk and <C-o> are highlighted.
7
votes
2answers
3k views
key mapping best practices
I found that I frequently needed a command in INSERT mode to open a line above the cursor (what O does in NORMAL mode)
I put this in my .vimrc
inoremap ao <esc>O
It works well. I chose the ...
6
votes
1answer
2k views
Is it possible to map <C-S-Space> in neovim?
I usually use gvim and it understands the mapping similar to
inoremap <C-Space> <C-n>
inoremap <C-S-Space> <C-p>
Now I'm testing nvim and I can use the Ctrl+Space.
But Ctrl+...
4
votes
2answers
2k views
Strange behavior of <ctrl-j> remapping
I want ctrl-h, ctrl-j, ctrl-k and ctrl-l in insert mode to behave like the arrow keys. I have this (among other things) in my .vimrc:
inoremap <C-j> <Down>
inoremap <C-k> <Up&...
4
votes
1answer
1k views
Leader shortcuts ignored
In my vimrc I have
nnoremap <Leader>h :bp<CR>
nnoremap <Leader>l :bn<CR>
But I have to source my vimrc to enable them with (:so $MYVIMRC). If I do a :map after starting vim I ...
6
votes
1answer
514 views
store regex searches in vimrc as mappings
In browsing markdown files, I find the following search useful
/\v^(\*|#)
However, when I try to map it I get an error
nmap <c-j> /\v^(\*|#)<cr>
E488: Trailing characters: #)
What ...
6
votes
1answer
1k views
Mapping control-H in insert mode doesn't work; it always works like backspace
I tried mapping control-H, J, K, and L respectively in insert mode to move around splits.
inoremap <C-h> <ESC><C-W><C-h>i
inoremap <C-l> <ESC><C-W><C-l&...
4
votes
1answer
1k views
How to map shortcut to double square brackets?
When I type [[ or ]] in normal mode, cursor is jumping previous / next "class definition" during editing python (.py) file.
I want to map these shortcuts to SHIFT + UP and SHIFT + DOWN. And I added ...
1
vote
1answer
2k views
mapping to quit using “<Ctrl> + q” not coming into effect [duplicate]
I am trying to map Ctrl + q to quit editing the file. I added the below line to my .vimrc
nnoremap <C-q> :execute "q"<CR>
On pressing the above key combination, nothing happens, vim ...
2
votes
2answers
1k views
inoremap only works after source
So I want to disable the arrow keys in insert mode. So I added the following lines at the end of ~/.vimrc:
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <...
1
vote
1answer
2k views
Swap `j` and `gj` [duplicate]
I use vim a lot to edit tex files.
When I have lines spanning multiple display lines, most of the time I want to navigate through them with gj not j (i.e. according to displayed lines, not physical ...
0
votes
2answers
2k views
vim split horizontal resize shortcut
I can resize horizontal split windows by ctrl-w-shift-< and ctrl-w-shift->. I would like to have a shortcut for that.
Close to the topic, recently I learned about the following maps:
nnoremap &...
0
votes
4answers
874 views
How to disable Help menu in insert mode?
I want to map <M-h> to ← in insert mode. I add imap <M-h> <Left> to .vimrc.
But if I press <M-h>, Help menu will pop up.
How to disable this and force <M-h> to ←...
1
vote
1answer
1k views
Can't remap <C-C> in vim
(NB: I've moved this question from another SE site, let me know if thats not ok and I can take this down)
I'm having issues remapping Ctrl+Shift+c to copy visually selected text to the + register. ...
0
votes
1answer
1k views
<Esc> key mapping seems to be not working in my vim 8.0 on my Ubuntu 16.04
I have inoremap jj <ESC> in my vimrc on my Ubuntu 16.04. I have no idea why my jj not working and its just typing literally <ESC> in my text file for my jj press.
Any idea how can I get ...
2
votes
1answer
1k views
Mapping key to execute shell script from vim
I would like to execute a shell script, with parameters, from vim by mapping it to F6, however the current mapping I have in my .vimrc isn't working:
" Map F6 to sync project changes to dev server
...
2
votes
1answer
238 views
Assign shortcut to a Split window resize Ctrl+w+|
I can expand a vertical split screen to occupy most of the area using Ctrl+w+|
Now I would like to map that shortcut to Ctrl+m. I tried the following but it failed.
nnoremap <C-m> <C-W&...
3
votes
1answer
269 views
Vimrc tries to execute command defined on leader
I'm trying to have something like this in my .vimrc:
nnoremap <leader>has :w | ! reset; runhaskell % <cr>
How ever, now it prompts an error when loading .vimrc and tells me:
:! reset; ...
1
vote
1answer
433 views
Alt-I doesn't work to inset \item in vim-latex
Hello Vimmers and LaTeXers,
I cannot get Alt-I to work in vim-latex. It is supposed to insert \item depending on the environment that you are in. Do I need to activate it somehow? Is there a setting ...
3
votes
1answer
334 views
Mapping vim key to change to next tab in Konsole
Description:
In my Konsole the key mappings for changing tabs to left and right are Shift-left and Shift-right (where left/right are the arrow keys).
What I'm trying to do is to map F2 in vim to ...
1
vote
2answers
271 views
Problem remapping § to esc in vim on a macbook with touch-bar
I am using a macbook with touchbar. As many others I would like to map a different key to the esc key, since the touchbar esc is a bit inconvenient. My problem is that I have some weird behaviour of ...
0
votes
1answer
737 views
How to make <S-A-Left> and <S-A-Right> work in vim within Mac Terminal
I'm using these keyboard shortcuts to navigate/manipulate tabs in MacVim
" tab navigation
nnoremap <silent> <S-Left> :tabprevious<CR>
nnoremap <silent> <S-Right> :...
2
votes
2answers
261 views
Repeat complicated motions
I know that similar things were asked here several times. I know that to repeat a motion ; works. Unless it doesn't(in case there is count for example), but then repmo.vim usually works. And I know ...
0
votes
1answer
172 views
Vertical split keymap suddenly broken
In my vimrc I have a shortcut for opening a vertical split:
let mapleader = ','
map <leader>v :vsplit<CR> " ,v for vsplit
map <leader>s :split<CR> " ,s for split
This has ...
0
votes
1answer
449 views
Mapping backspace to delete previous word
I would think this would work to make backspace delete the entire previous word in insert mode:
imap <BS> <C-W>
but it doesn't. Tried in vim 8.0 and neovim 0.2.2 iterm2 if that matters.
...
0
votes
1answer
246 views
<S-BS> and <C-BS> mappings not working
Neither of the following mappings do anything in neovim in iterm2 on mac
inoremap <C-BS> <Esc><Right>s
inoremap <S-BS> <Esc><Right>s
Is mapping backspace like ...
1
vote
2answers
380 views
Cannot set (let) mapleader and use <leader> in global vimrc
I'm using basic version vimrc from https://github.com/amix/vimrc. No problem if I put my vimrc at /home/{user}/.vimrc, but if I put it in /etc/vimrc (arch) or /etc/vim/vimrc (debian), it becomes a ...
0
votes
2answers
287 views
Mapping using tpope/vim-surround only works with command
I have this mapping to surround a Word with jQuery id selector $("#...") and it works fine using a command:
command! JqId normal viwo^[i#^[ysiW"ysiW)i$^[E
nnoremap <Leader>jqid :JqId<CR>
...
-3
votes
1answer
154 views
Make gvim show Q letter (character) [closed]
My vim doesn't represent the uppercase letter q Q?
How to fix this?
Here is my vimrc :
set nocompatible " be iMproved, required
filetype off " required
syntax on
set ...
0
votes
1answer
172 views
Map movement keys to jump words like in non-modal editors [closed]
Coming from non-modal editors, I still get confused with e, w, b in Vim.
One feature I like about non-modal editors is jumping words by simply combining Ctrl with ←→ arrow. So I thought I ...
0
votes
1answer
145 views
Ctrl keybindings not working in wsltty
I have the following mappings:
nnoremap <C-,> :tabe ~/.config/nvim/init.vim<cr>
nnoremap <C-/> gcc
Neither of these mappings is working - they both do nothing. I have a plugin ...
2
votes
1answer
181 views
i_CTRL-K does not insert digraphs when in Mutt inside tmux
I configured mutt to use vim as an editor to write emails (with set editor=vim in .muttrc), and I have noticed that when I am in tmux (with an empty .tmux.conf), the vim keybinding CTRL-K in insert ...
1
vote
1answer
232 views
How to use filename expansion in a mapping
I have this shorcut in my vimrc that I use all the time (admittedly, I just copied it over from the web):
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:...
1
vote
0answers
292 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 ...
2
votes
2answers
47 views
How to turn this piped bash command into a vim map?
I have a bash command that will align text into a tabular form. If I have input such as this:
A | B | C
Alpha | Beta | Gamma
12 | 34.56 | 78.9
I can run cat test.txt | sed -e 's/|/'$'\001''|/g' | ...
1
vote
0answers
265 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 ...
2
votes
1answer
143 views
Change <up>/<down> to gk/gj in insert mode
I want to replace the default behavior of the arrows in insert mode, so that they behave like gk and gj, I have used:
inoremap <up> <Esc>gka
inoremap <down> <Esc>gja
But this ...
0
votes
0answers
234 views
How to map the slash key “/”
I am trying to map the NERDCommenterToggle command from the nerdcommenter plugin. I want to use "Ctrl+/" for this:
vmap <C-/> <plug>NERDCommenterToggle
nmap <C-/> <plug&...
0
votes
1answer
56 views
Vim command 0 goes to second column instead of first one
When I press 0 in Normal mode, the cursor goes to the second column and not the first one.
This is not the normal behavior stated in vim's :help 0.
I have tried disabling the remaps to move between ...