Guillermo kuster
Guillermo kuster

Reputation: 175

Override default command movement key in Vim

I'm using vim for some months ago and i'm still trying to customize my .vimrc to get the best performance while coding. In this case, I'm trying to override the defaults movements listed below:

$ (to go to the end of line)
0 (to go to the beginning of line) 

I want to override the $ key to g_ that sends me to the last character in the line.

I also want to override 0 to ^ that sends me to the first character in the line.

Can you guys please help me to reach my aim?

Upvotes: 2

Views: 889

Answers (1)

Sundeep
Sundeep

Reputation: 23697

nnoremap $ g_ 
nnoremap 0 ^ 
  • nnoremap Normal mode non-recursive mapping, avoids nesting
  • See :h :map-commands for inbuilt help
  • A good resource to learn vim customization: learnvimscriptthehardway

Upvotes: 1

Related Questions