Linked Questions

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 &...
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-...
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. ...
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.
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: ...
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 ...
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

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 ...
6
votes
1answer
513 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
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+...
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

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 ...
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

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 ...

15 30 50 per page
1
2 3 4 5 6