Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

goto-file in Emacs

Tags:

emacs

Is there a substitute in emacs for the vi "gf" command? meaning try to open the file which is under the cursor right now if a real file name is in fact there.

Thanks

like image 964
Nir Avatar asked Nov 03 '08 17:11

Nir


People also ask

How do I jump to a specific line in Emacs?

To go to a specific line: Type M-x goto-line <Enter>, then type the line number followed by <Enter>. There are also shortcuts. Type the command "help -q emacs goto" in a local window to find out about it. (Local shortcut is M-x #).

How do I find Files in Emacs?

To find a file in Emacs, you use the C-x C-f ( find-file ) command.

How do you go to the beginning of a file in Emacs?

How do I move to the beginning of the file in emacs (i.e. the effect of Ctrl + Home in windowed text editors)? Mashing pageup does not move the cursor to the beginning (nor does Ctrl+Home , ofc). Here the shortcut for the desired result is described as: M-< : Move to the top of the buffer (beginning-of-buffer).

How do you go to the bottom of a file in Emacs?

Type C-M-v to scroll the bottom window. (If you don't have a real Meta key, type ESC C-v.) >> Type C-x o ("o" for "other") to move the cursor to the bottom window.


1 Answers

You want the find-file-at-point function (which is also aliased to ffap). It's not bound to a key by default, but you can use

M-x ffap 

Or, you can put in your .emacs file:

(ffap-bindings) 

This will replace many of the normal find-file key bindings (like C-x C-f) with ffap-based versions. See the commentary in ffap.el for details.

like image 99
cjm Avatar answered Sep 19 '22 08:09

cjm