Send As SMS

1/31/2006

add a goto-line command to emacs

it boggles the mind that emacs - famous for having a bazillion keyboard shortcuts - doesn't have one for quickly finding a line.

so, here's how to make one.

go to your home directory in the terminal:

>> cd
and open up the .emacs file that lives there.

add the following line of code to it:
(global-set-key "\C-l" 'goto-line)
restart emacs and you'll find that whenever you hit "ctrl-l" (lowercase L), you'll be presented with a prompt asking which line of the text you'd like to be moved to.


3 Comments:

self said...

That's what you get for running Emacs! XEmacs has had M-g for 'goto-line' for years.

2/01/2006 04:12:23 AM  
Anonymous said...

heh, 7 months later...

in vi or vim, simply type [line number]G when not in insert mode.

hey, it's a slow day at work today :)

-Andrew

7/03/2006 12:58:25 PM  
Lawrence David said...

you vim lovers make me sick :)

insert mode? it's a freakin' text editor - why do you need extra commands just to edit text?!

7/03/2006 01:27:52 PM  

Post a Comment

Links to this post:

Create a Link

<< Home

My blog has moved! Redirecting...

You should be automatically redirected. If not, visit http://stinkpot.afraid.org:8080/tricks/ and update your bookmarks.