cycling through your buffers with Ctrl-Tab

Emacs-users tend to have many buffers open, -- maybe some source code files, an email message, a short note etc.There are many ways to switch from one buffer to another, but I like the quick and easy way of cycling through them with Ctrl-Tab, just like tabs in Firefox.

It's quite trivial to add this keybinding to your .emacs:

;; cycle through buffers with Ctrl-Tab (like Firefox)
(global-set-key (kbd "<C-tab>") 'bury-buffer)
If you want a more advanced version that ignores certain buffers, you could take a look at ControlTABbufferCycling in EmacsWiki.


Mikhail said...

There are also useful combinations: C-x C-right (or just right) and C-x C-left (or just left) that invoke (next-buffer) and (previous-buffer) commands respectively. The advantage here is that when you jump over a buffer that you needed, you can step back.

Anonymous said...

I used your idea and Mikhail's idea to bind control-shift-tab to previous buffer. It works great!

Anonymous said...

How did you bind Ctrl-Shift-Tab. I tried

(global-set-key (kbd "C-S-") 'bury-buffer)

but that did not work.

djcb said...

@Anonymous: the generic rule for binding some key is pressing C-h k, then the key you want to use. Then emacs will display a (kbd ...)-compatible description.

I think the comments section eats greater-than and smaller-than, but for me it looks like:


(and replace the square brackers with smaller than, greater than.

Anonymous said...

Thanks! Turns out I had emacs version 21.4 installed, so I got the previous/next functions from http://www.emacswiki.org/emacs/prev-next-buffer.el and bound them as you mentioned.

Anonymous said...

This is the way to do it:

;cycle through buffers with Ctrl-Tab (like in Firefox)
(global-set-key (kbd "") 'other-window)

It does the same thing as "C-x o"