Motions and Moving

Motions and Moving Motions are used to get your cursor where you want it. As programmers, we tend to spend most of our time editing existing code. This means we spend a lot of time navigating files and positioning the cursor where we want it, an...
This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/onramp-to-vim-motions-and-moving

to go to the beginning of a line, I often use

^

however this is kind of hard to reach on a Querty keyboard. Does anyone have a good remapping for this key?

greetings and thanks,

Anthony

I just saw the video on vimrc configurqtion in the ‘Onramp to Vim’ course.

there Chris show the mapping for going to the beginning of line:

nmap 0 ^

just what I was looking for. Thanks Chris and Ben, this ‘Onramp to Vim’ tutorial is great!

greetings,

Anthony

1 Like

This is a great example of why I love raiding other folks’ vim setups. Even if you’re only borrowing a tiny fraction of the shortcuts and strategies other vimmers are using, just seeing what’s painful for other people helps you reframe whether you’re unnecessarily suffering through a less than ideal way of accomplishing something we probably do scores of times every day.

I recently saw a guy on Stack Overflow who mentioned that he does 0 w. Same number of keystrokes as ^, but easier to reach.

@wakelank, that’s an interesting motion. I think there’s an advantage to using ^ for things like deleting, etc, as some operations such as c or d with the ^ motion have a very different behavior than if you used them with 0w.

If you had this line, where * is the location of my cursor and the line is indented several spaces from the left side:

        The quick* brown fox jumped over the lazy dog

And you wanted to change that sentence to have the same indentation but begin with The slow from the current cursor location, you could type c^The slow<CR>, but if you used c0w, you’d have to begin your next typing by replacing the spaces that you just lost.

@christoomey

Hey, thanks for this vid again. I noticed when you searched, it vim highlighted all matches in a nice pink-ish text. If I turn on the vim highlight on search, it highlights it in a very hard to read (and quite distasteful, I might add, neon background :yum:) What config did you do to get the nice pink-ish text? And if it is covered in a later video, you can just direct me there as always. Thanks.

Hey @thedanotto, sounds like this is a colorscheme issue, rather than a more general setting. You might want to try a different colorscheme (I use jellybeans).

Also, I cover some basic search settings in the Art of Vim if you want to check those out.

Thanks for that. jellybeans is awesome now that I’ve tried it.