Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Treadstone06

macrumors newbie
Original poster
Apr 28, 2014
7
0
I started a new position recently and with that came a macbook. I've never used one on a daily basis so am currently learning. My biggest problem so far is with the terminal app. I use it daily but am finding myself really missing the home/end keys and even occasionally the page up/down.

Could someone please give me a hand on how to allow the use of these within terminal and specifically within vim as well.

Thanks to everyone for their time and effort.
 

Treadstone06

macrumors newbie
Original poster
Apr 28, 2014
7
0
Thanks, good to know.

I was reading somewhere about the possiblity of adding the home and/or end keys to be used within vim...has anyone successfully done this?

Thanks again.
 

bradl

macrumors 603
Jun 16, 2008
5,952
17,447
Since Terminal is just... well, a terminal, screen controls can vary by what program you're in.

For vi:

Home (top of document): 1G ("line 1 go")
End (end of document): G ("go")
Page up: ctrl-B ("back")
Page down: ctrl-F ("forward")

In bash:

Beginning of line: ctrl-A
End of line: ctrl-E

And page up/down are Fn-up arrow and Fn-down arrow, and those mappings work in vi, as does Fn-left and Fn-right arrows for beginning/end of line.

Make it easier for the line. In vi:

Beginning of line in a document: 0
End of line in a document: $

Just be careful, as with some Unices, vim is not installed, let alone an option, so those mappings to function keys, PgUp/PgDn may not exist. Some don't even have the arrows mapped, so you'd have to rely on H, J, K, and L for movement in command mode.

To the OP: I know you wouldn't like to spend the money, but in this case, it would be money well spent. O'Reilly & Associates have some of, if not the best books out there in regards to IT. In this case, for the Unix user and/or power user, especially with editors, you should pick up the vi & Vim Pocket Reference Guide. It's worth it, and has what you are looking for and then some.

BL.
 
Last edited:

Watabou

macrumors 68040
Feb 10, 2008
3,426
759
United States
If you just want to know the basics, type
Code:
vimtutor
in the terminal, and it will go over the basic vim commands. Just takes 10-15 minutes of your time to complete the whole tutorial.
 

Treadstone06

macrumors newbie
Original poster
Apr 28, 2014
7
0
Thanks everyone for all of the advice. I've now got myself a little cheat sheet to reference until I get them all memorized. Much appreciated for your time and knowledge.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.