Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs shortcut to go to a specific line in a file

I'm learning Emacs after over two years of using Notepad++ as my default editor. I'm still hung up on a few things, but I find myself kind of enjoying working with it.

My question is simple: in Notepad++, when I wanted to go to a specific line of my file, I used CTRL+G. Emacs, for some perplexing reason, requires me to do M-x goto-line [enter] $linenumber [enter].

I can't believe there isn't a shortcut for that. I must be googling wrong, surely?

like image 941
Nekkoru Avatar asked Feb 05 '13 16:02

Nekkoru


People also ask

How do you go to a specific line?

To do this, press Esc , type the line number, and then press Shift-g . If you press Esc and then Shift-g without specifying a line number, it will take you to the last line in the file. To look for the next occurrence after the first, either press n or press / again and then press Enter .

How do you go to specific line in a Notepad file?

Finding a Line in Notepad To go to a specific line, click "Edit" and select "Go To" to display the Go To Line dialog. Type the line number into the field and click "Go To" to find the line. The blinking cursor is positioned at the beginning of the specified line.

What is the C command in Emacs?

Summary of essential emacs commands In the list below, C- means "control key", M- means "meta key" (escape). For meta commands, press the meta key, then the other key.


1 Answers

M-g g or M-g M-g are the default bindings for goto-line.

And, the easiest way to find this is either M-x where-is RET goto-line RET which will list the bindings for the command goto-line, or you can type C-h b which lists all the bindings for the current buffer (and then you can peruse the bindings to see if goto-line is there, or to discover other useful commands & bindings.

like image 196
Trey Jackson Avatar answered Sep 20 '22 19:09

Trey Jackson