If I click on menu File → Close, it closes the buffer like I want, but it doesn't list a key mapping for it. What is the key mapping?
5 Answers
You can use Ctrl + X, K to kill the current buffer. See the Emacs manual.
-
6Since the question asks how to kill the current buffer,
kill-this-buffer
, mapped tos-k
, is faster. See: stackoverflow.com/a/26592985/109618– David J.Oct 27, 2014 at 17:12 -
1This does not close the buffer. In someone's perverted mind, the buffer stays open and is filled with the contents of another buffer. What idiot is responsible for this awful ux??? How hard can it possibly be to get the buffer of interest to take up 80x24 of the terminal???– jwwJul 13, 2019 at 16:46
-
I just realize s-k => 's' => is 'super' key, LOL.. I never know what it super key before.– 1234Dec 21, 2019 at 21:39
-
C-x k doesn't 'kill' (whatever that may mean) the current buffer but merely empties it. If I do C-x b after I 'killed' a buffer it is still in the list. How do I kill the buffer AND remove it from the list?– HarryHAug 10, 2020 at 8:41
BKB has already given the correct answer. I just wanted to add that C-h b
lists the key bindings applicable in the current buffer.
-
3C-h b is a lifesaver when you're editing a new type of file for the first time in emacs.– BrananOct 21, 2008 at 17:33
-
17Unfortunately, BKB (user 27055) deleted all his answers. The answer (from Google's cache) was: "C-x k kills the current buffer C-x # kills a server buffer (if you use Emacsclient)"– CesarBNov 8, 2008 at 16:05
The question asks how to kill the current buffer. Use M-x kill-this-buffer
. On my Emacs, it is mapped to s-k
. Fewer keystrokes is better!
By default, 's' (for super key) is the Windows key on most keyboards and the Command key on Mac.
-
1
s-k
? As in, Shift-K, the same key that usually types the uppercase K key? Feb 12, 2015 at 17:44 -
2
-
-
2What is the equivalent of 's'/'super' key on Linux? Is there a substitute key for it?– vfclistsOct 6, 2018 at 23:27
-
1if you are using a standard non-Mac keyboard, the super key is the "Windows" key, usually located between Ctrl and Alt Dec 9, 2018 at 20:43
Well, you can view the shortcut of any function with the Help
command (C-h).
Press C-hw and then type the command name as you would in M-x mode.
For example (in your case):
- Press C-hw
- Type the name of the command:
kill-buffer
( you can also use tab/space to autocomplete :) ) - Press RET
Hope that helps :)
C-x k
to kill the current buffer.C-x 0
to close the current window.C-x 1
to close every other window.