Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's wrong with this remapping?

Tags:

vim

vi

I want to define a mapping that takes the cursor to the end of the line and inserts a semicolon there. I have put this in the .vimrc file:

inoremap aa <ESC>A;<ESC>

it works fine in the insert mode but doesn't work in the normal mode!! Please explain why this is happening and what can be done so that it also works in the normal mode. Thanks in advance!

like image 855
secluded Avatar asked Aug 02 '26 16:08

secluded


1 Answers

To make it work for normal mode also you need to add this mapping:

nnoremap aa A;<ESC>

  • inoremap means insert mode mapping

  • vnoremap means visual mode mapping

  • nnoremap means normal mode mapping

  • cnoremap means command mode mapping

  • noremap means visual, normal & Operator-pending modes mapping

For others you can check them by executing :help noremap

like image 178
Meninx - メネンックス Avatar answered Aug 04 '26 11:08

Meninx - メネンックス



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!