1

I'm quite new to vim and I dislike that the basic movement buttons are mapped to hjkl, since h and j are meant to be pressed with the same finger. I am using a hungarian keyboard, which has 3 more characters to the right of l: éáű, so I would like to take advantage of this and remap these keys. However, vim does not seem to recognize this command: noremap é l. How can I achieve this?

2

The vim page uses nnoremap with two "n"s at the start instead of one.

http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-Tutorial(Part_1)

I don't have a hungarian keyboard, but with a russian keymap, I managed to get

nnoremap э l

To make Э move 1 character to the right.

Edit

Vim is (famously) a modal editor - that is, it behaves differently in different modes, and you switch between them.

The above command makes the key mapping for 'normal' mode, which seems to mean "navigating around and not doing anything"

This table shows the available mapping commands for the various modes.

Commands                        Mode
--------                        ----
nmap, nnoremap, nunmap          Normal mode
imap, inoremap, iunmap          Insert and Replace mode
vmap, vnoremap, vunmap          Visual and Select mode
xmap, xnoremap, xunmap          Visual mode
smap, snoremap, sunmap          Select mode
cmap, cnoremap, cunmap          Command-line mode
omap, onoremap, ounmap          Operator pending mode

To make something like 2dk work, you need to do the mapping for "Operator pending mode":

onoremap э l

"Command line mode" didn't do what I wanted - what it meant was when I tried to type э for the next remap command I got an l instead.

I think you probably don't want to remap with "Insert and Replace" mode. But you might want to experiment with one or both of "Visual" and "Select" mode.

  • This worked perfectly for movement, but it fails when I use it in combined commands such as 2dk. Is there a way to get it properly working? – Adam Hunyadi Jun 4 '17 at 12:32
  • You also need to also add conoremap э lfor Command line mode. – Shadoath Jun 5 '17 at 0:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.