Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Buffer switching in Emacs

Tags:

emacs

buffer

I would like to emulate Alt-Tab as it works with individual windows on GTK, but with Ctrl-Tab within buffers in emacs.

So, for example, if I have ten buffers open in emacs, and I am working on two at the moment, say Buffer1 and Buffer2, and I am in Buffer1 currently, I would like Ctrl-Tab to take me to Buffer2, and on pressing Ctrl-Tab again, back to Buffer1.

In case I need to go to Buffer3, or Buffer4 etc, I keep Ctrl pressed while I press Tab.

Does this make sense? If so, please tell me how I can do this.

like image 903
xoxa Avatar asked Jul 25 '11 08:07

xoxa


2 Answers

What are you using currently?

But I think

(global-set-key (kbd "C-<tab>") 'next-buffer)
(global-set-key (kbd "C-S-<tab>") 'previous-buffer)

should be doing what you describe.

As jaybee comments, it may be a whole less useful than in, say, Firefox. But I'd recommend ido-switch-buffer.

This may also be of interest: http://www.emacswiki.org/emacs/ControlTABbufferCycling

like image 187
Michael Markert Avatar answered Sep 21 '22 15:09

Michael Markert


I think swbuff works well. See http://www.emacswiki.org/emacs/SwBuff.

From my init file:

(require 'swbuff)
(global-set-key [(control tab)] 'swbuff-switch-to-next-buffer)
like image 21
mzjn Avatar answered Sep 22 '22 15:09

mzjn