简体   繁体   English

emacs:选择时关闭缓冲区列表

[英]emacs: close buffers list on selection

Is there a configuration hook to make the " Buffers List " buffer automatically closing when a buffer is selected in such window? 当在这样的窗口中选择缓冲区时,是否有配置挂钩使“ 缓冲区列表 ”缓冲区自动关闭? Each time the buffer list opens and I select a buffer I have to manually close it using Cx Ck and this is annoying, also because it leaves the frame split in at least two windows. 每次缓冲区列表打开并且我选择一个缓冲区时我必须使用Cx Ck手动关闭它,这很烦人,因为它会将帧分割为至少两个窗口。

Not sure about a config option, but you can always use q (or a Cx 1 in your current buffer) instead of Cx Ck to close the temp buffer. 不确定配置选项,但您总是可以使用q (或当前缓冲区中的Cx 1 )而不是Cx Ck来关闭临时缓冲区。

PS Almost nobody uses buffer-list these days. PS这几天几乎没有人使用buffer-list Most Emacs users simply remap it to ibuffer (its much smarter and you might like the fact that its temp buffer disappears by default): 大多数Emacs用户只需将其重新映射到ibuffer (它更聪明,你可能会喜欢它的临时缓冲区默认消失的事实):

(global-set-key (kbd "C-x C-b") 'ibuffer)

You can tweak this function for your requirement: 您可以根据您的要求调整此功能:

(defun kill-other-buffers ()
  "Kill all other buffers."
  (interactive)
  (mapc 'kill-buffer (delq (current-buffer) (buffer-list))))

This code kills all the buffers except the current one. 此代码将杀死除当前缓冲区之外的所有缓冲区。 Source: Emacs Wiki 资料来源: Emacs Wiki

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM