Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly configure Ctrl-Tab in Emacs

Tags:

emacs

I converted from Visual Studio to Emacs for most of my development (mainly due to switching programming languages). However, there is one cool feature of Visual Studio that I truly miss: Ctrl-Tab between "buffers".

The ctrl-tab that in Visual Studio is not the same as C-x b in Emacs. So, it's not just a keyboard mapping issue. Here are the features of my ideal Ctrl-Tab:

  1. Hold down ctrl hit tab, you see the next buffer before you let go of ctrl.
  2. There is no need to hit enter.
  3. If this is not the buffer you want, hit tab again until you see the buffer you want.
  4. The moment that ctrl is released, the buffer ring is updated. The next buffer in the ring is the buffer where you first pressed ctrl.

I've seen some Emacs plugins that try to simulate this behavior, but #4 is the most difficult. It seems like Emacs is unable to detect when the ctrl key is released. Instead, the code waits for the user to be in the buffer for a certain time or waits for a buffer to change..and then the buffer is added to the ring. It's different enough to really frustrate me and just never use my beloved ctrl-tab again. For now I just deal with C-x b. ido-mode makes C-x b more tolerable, but I still dream of a day when I can ctrl-tab in emacs.

Has anyone out there found a way to configure Ctrl-Tab in Emacs to work like Visual Studio?

like image 855
User1 Avatar asked Nov 10 '10 16:11

User1


2 Answers

I was searching for exactly the behavior that you describe and came across the iflipb package: http://www.emacswiki.org/emacs/iflipb and bound it to C-tab, C-S-tab.

Unfortunately it doesn't restart the cycling either after releasing the ctrl key, so in that regard is the same as the my-switch-buffer in the answer above. Any new insights into this issue are highly appreciated.

like image 125
til Avatar answered Sep 20 '22 15:09

til


If you are using GNU Emacs 22.1 or more recent releases, \C-x<Right> fires M-x next-buffer and \C-x<Left> fires M-x previous-buffer. This page on EmacsWiki has a link to C-TAB Windows style buffer cycling. The page also talks about how to bring this behavior on older releases of Emacsen.

This question from yesterday looks very similar to what you want to achieve, except that the question talks about Notepad++ instead of Visual Studio.

like image 41
vpit3833 Avatar answered Sep 21 '22 15:09

vpit3833