Reputation: 28572
I'm new to Emacs. I run emacs on Windows. When I start Emacs by click the runemacs.exe
, I got a welcome window. Now to create a new file and do some experiment editing, I press C-x C-f. Now the minibuffer shows something similar to:
Find file: d:\emacs-23.3\bin
Normally I need to press backspace some time to delete d:\emacs-23\bin
and type a new file name like c:\test\a.txt
. My question is, how can I quickly delete d:\emacs-23\bin
? How do you deal with the welcome window (I don't like it)?
Thanks
Upvotes: 9
Views: 4695
Reputation: 17345
I normally use the following lisp code to kill the current line with a single key combination. This will remove the whole line and move to the cursor to the beginning.
(defun my-kill-line ()
"kill current line. you don't have to put point at the beginning of line."
(interactive)
(copy-kill 'kill 'line))
A better approach (once you get familiar with Emacs usage) is to use some package to make your file navigation easier. Take a look to helm (or ido) I personally prefer helm and to projectile. Combining helm+projectile you can open files very fast and switch easily between files located on different directories/projects.
Upvotes: 0
Reputation: 11465
You can use backward-kill-sentence that is bound by default to M-DEL
If you use ido-mode (if not you should give a try, it is very useful) you can just begin to type the path or name of the file you want to open and it will give you some proposals.
For the startup message, you can put the following in your .emacs :
(setq inhibit-startup-message t)
Upvotes: 3
Reputation: 21162
You don't need to delete the default filename. Just continue to enter your file
d:\emacs-23.3\bin\c:\test\a.txt
Upvotes: 5
Reputation: 161
On unix-like OSes, you can type ~
or /
after the file- or pathname in the prompt. Emacs then takes that as the starting point for the file path. ~
starts from your home directory, /
from root.
Example: assume the prompt is Find file: /var/tmp/etc/list/foo/bar/
, then simply type ~/.emacs
to get the dot-emacs file in your home directory. No need to delete anything.
Upvotes: 4
Reputation: 1925
The answers given are probably the best approach for now but once you've been using emacs for a while you should look at ido-mode. Type M-x ido-mode
to start, then use the arrow keys to move quickly around file paths.
Upvotes: 0
Reputation: 17422
backward-kill-sentence
is bound to C-x DEL by default.
Alternatively, you could type C-a C-k which I find slightly easier to type because
This key combination first moves point (aka the cursor) to the beginning of the line, and then kills the line. So it's actually two commands, but it's the same amount of key strokes.
Upvotes: 12