85

If I click on File -> Close, it closes the buffer like I want, but doesn't list a key mapping. What is the key mapping?

Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
Nick Stinemates
  • 41,511
  • 21
  • 59
  • 60

5 Answers5

117

You can use C-x k to kill current buffer. See Emacs Manual .

Anish
  • 1,490
  • 1
  • 13
  • 13
  • 5
    Since the question asks how to kill the current buffer, `kill-this-buffer`, mapped to `s-k`, is faster. See: http://stackoverflow.com/a/26592985/109618 – David J. Oct 27 '14 at 17:12
  • This 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??? – jww Jul 13 '19 at 16:46
  • I just realize s-k => 's' => is 'super' key, LOL.. I never know what it super key before. – 1234 Dec 21 '19 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? – HarryH Aug 10 '20 at 08:41
33

BKB has already given correct answer. Just wanted to add that C-h b lists the key bindings applicable in current buffer

C. K. Young
  • 219,335
  • 46
  • 382
  • 435
Miserable Variable
  • 28,432
  • 15
  • 72
  • 133
  • 3
    C-h b is a lifesaver when you're editing a new type of file for the first time in emacs. – Branan Oct 21 '08 at 17:33
  • 16
    Unfortunately, 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)" – CesarB Nov 08 '08 at 16:05
22

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):

  1. Press C-hw
  2. Type the name of the command: kill-buffer ( you can also use tab/space to autocomplete :) )
  3. Press RET

Hope that helps :)

Sazid
  • 2,747
  • 1
  • 22
  • 34
22

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!

David J.
  • 31,569
  • 22
  • 122
  • 174
11
  1. C-x k to kill the current buffer.
  2. C-x 0 to close the current window.
  3. C-x 1 to close every other window.
nomad
  • 471
  • 6
  • 12