85
votes
Accepted
Why does vim use hjkl for cursor keys?
From http://www.catonmat.net/blog/why-vim-uses-hjkl-as-arrow-keys/:
When Bill Joy created the vi text editor he used the ADM-3A terminal, which had the arrows on hjkl keys. Naturally he reused the ...
28
votes
Accepted
Why doesn't my numpad work right in my terminal?
Short answer
Turn off “application keypad mode switching.”
Terminal-specific instructions
PuTTY (also here):
Terminal > Features > uncheck Disable application keypad mode
SecureCRT:
Session ...
28
votes
Accepted
How do I keep accidentally creating a no break space before opening curly brace?
Others have already provided work-arounds, but as for the reason why it happens, I bet you're accidentally pressing Alt+Space.
I'm using Xubuntu with the 105-key Finnish keyboard layout myself, so ...
27
votes
Why does vim use hjkl for cursor keys?
Nobe4's answer is great, and explains why we use hjkl very well. However, it's really interesting to see the full keyboard, and a lot of strange things about vim make more sense when you can see the ...
24
votes
Accepted
Expectations in how to get faster with Vim/Nvim?
I think for me the key was (and the optimization-happy engineer in me is aghast at this) not trying to vim-golf my motions. Because once you have to think about the motion it takes you out of the flow....
20
votes
How do I keep accidentally creating a no break space before opening curly brace?
You can add an autocommand that replaces non-breaking spaces with regular ones upon saving particular file types, eg. by putting something like this in your vimrc:
augroup RemoveSpaces
autocmd!
...
17
votes
Why does vim use hjkl for cursor keys?
As to why these arrows were printed on these keys... it's because they could be used with the control key for local cursor movement. Ctrl-H and Ctrl-J (backspace and line feed) are obvious, and an ...
16
votes
How do I keep accidentally creating a no break space before opening curly brace?
The 'listchars' option provides a means to make 'list' display non-breaking spaces. It's not set by default, so you probably want to add it.
set listchars+=nbsp:‗
16
votes
Expectations in how to get faster with Vim/Nvim?
What helped me was to vocalize the commands I'm issuing in my head while keying them into Vim, e.g.:
"change inside quotes" ⇒ ci"
"goto definition" ⇒ gd
"change ...
9
votes
How to enter tilde (~), back tick (`) and special chars with a non-US keyboard?
From :he digraph:
Digraphs are used to enter characters that normally cannot be entered by
an ordinary keyboard.
Running :digraphs will show you the currently defined digraphs. ` is defined as '!...
8
votes
Other ways to exit Insert mode besides Escape
I would suggest using my plugin vim-easyescape.
Plug "zhou13/vim-easyescape"
let g:easyescape_chars = { "j": 1, "k": 1 }
let g:easyescape_timeout = 100
cnoremap jk <ESC>
cnoremap kj <ESC>
...
7
votes
Other ways to exit Insert mode besides Escape
You can map Caps Lock to Control without installing any extra software:
In Mac OS X visit System Preferences > Keyboard -> Modifier Keys
In Linux execute: setxkbmap -option caps:ctrl_modifier
...
7
votes
Accepted
german umlaute mapping
You might want to look into digraphs, which give you a built-in solution to accents and umlauts in Vim.
For umlauted "u" you can type:
Ctrl+K, :, u
Or:
Ctrl+K, u, :
See :help digraphs-use for ...
6
votes
How to disable hjkl movements?
I would do:
nnoremap h <Nop>
nnoremap j <Nop>
nnoremap k <Nop>
nnoremap l <Nop>
5
votes
Accepted
Can I write Japanese (SKK) text in Vim?
OK, this took several days of struggle against the skk.vim plugin mentioned by @SatoKatsura. All the documentation is in Japanese therefore I still do not know of most of its features, and, certainly,...
5
votes
Accepted
How to open a vertical split to the main view not just next to the current one in case of horizontal splitted viewport?
There isn't one single builtin command to open the buffer and position it, I don't believe.
Option #1: Well, it turns out there is. The :botright {cmd} style of commands (e.g. :botright vsplit). If @...
5
votes
Accepted
What does c^n in vim do?
In normal mode, it basically moves your cursor down, it is like pressing RETURN. From :help CTRL-n:
<NL> or CTRL-N [count] lines downward linewise.
In insert mode, it ...
4
votes
How do I swap key bindings without breaking plugins?
EDIT @Octaviour's solution is way smarter, you should use it :-) Nonetheless I'll leave this answer here because I worked on it and because it contains some interesting part about the usage of <SID&...
4
votes
How do I swap key bindings without breaking plugins?
I think your best bet would be to remap everything that uses s in all modes. You are already aware of the command for normal mode I think, nnoremap. This changes the normal mode mapping only. Once you ...
4
votes
How do international users use Ctrl-] efficiently? Remapping?
In the place where ANSI US has [ and ] Nordic keyboards have å and ¨, of which the latter is really not bindable, since it sends "half a character" and waits for the character to be accented. For ...
4
votes
Accepted
Use the same key for `, ~, esc
As far as I know there is no built-in support for mappings that change based on the time you hold the key.
But as the problematic key is Esc, you have some good alternatives:
Use Ctrl+[, which works ...
4
votes
Can I write Japanese (SKK) text in Vim?
Since I was in search for a good way to input unicode Japanese characters in
VIM, this post was really helpful. I tried using skk.vim but found it really
difficult, because contrary to the OP, I ...
4
votes
Accepted
NERDTreeMenu Remapping
if you look at the documentation (:help NERDTree-t), you'll see that each of the command have a name and a default key.
To remap for example NERDTreeMapUpdir to the 'a' key, you just have to add to ...
4
votes
Expectations in how to get faster with Vim/Nvim?
Jared Smith's answer is generally correct, but here I'll provide a few more hints on how to implement this.
The very first thing you need to do, above all else, is to make sure you can touch-type (i.e....
3
votes
Other ways to exit Insert mode besides Escape
FWIW I use:
:map! ;l ^[
:vmap ;l ^[
It feels similar to hitting Return.
I use ; as the leader for other Insert-mode mappings too.
The only time I've needed to type ';' + letter is when code ...
3
votes
Other ways to exit Insert mode besides Escape
I've been using Ctrl+3 since quite some time, I find it easier to type than most alternatives and seems to work nicely (at least on Linux).
My Caps Lock is mapped to Ctrl, so it's very comfy to type ...
3
votes
Can I write Japanese (SKK) text in Vim?
I'm trying to summarize here the experience of the other two users, while trying to keep it simple. Some issues were resolved (e.g. eskk now supports nvim). Also, I'm using pathogen which somewhat ...
3
votes
How do you set no timeout for a specific remap?
It sounds like you have something like
noremap i d
noremap ix ... other mappings starting with i
And you are asking that for i the timeout is 0.
In that case you would never be able to type any of ...
3
votes
Accepted
Auto replace special programming characters
If you're using vim, you want a :noremap variant. To apply this for just the current editing session, and just in insert mode,
:inoremap [ {
:inoremap ] }
:inoremap 9 (
:inoremap 0 )
:inoremap 7 &...
3
votes
Accepted
is it possible to map numpad differently?
There are special keys <k0> to <k9> and <kPlus>, <kMinus>, <kDivide>, <kMultiply>, <kEnter>, and <kPoint>, which can be mapped separately, e.g.,
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
keyboard-layout × 50key-bindings × 29
vimrc × 6
terminal × 4
unicode × 4
insert-mode × 3
gvim × 2
vim-windows × 2
microsoft-windows × 2
escape × 2
map-operator × 2
vimscript × 1
neovim × 1
cursor-movement × 1
normal-mode × 1
visual-mode × 1
cursor-motions × 1
split × 1
plugin-nerdtree × 1
macos × 1
ctags × 1
linux-ubuntu × 1
mark × 1
text-generation × 1
history-of × 1