emacs: control tab buffer cycling, or stack buffer cycling, similar to alt-tab between windows

后端 未结 3 1850
野的像风
野的像风 2021-01-13 16:41

I have consulted this resource: http://www.emacswiki.org/cgi-bin/wiki/ControlTABbufferCycling, and tried buffer-stack.el, which is useful, but I find the user e

相关标签:
3条回答
  • 2021-01-13 16:56

    elscreen does a little bit what you seek: http://wikemacs.org/index.php/Elscreen
    You have to create screens (tabs) on demand and you can call M-x elscreen-select-and-goto to select a screen from a list in the minibuffer.

    Fortunately it is already coupled with helm: helm-elscreen. That gives a good looking and handy choice list:

    • fuzzy matching
    • scrollable list
    • choose actions (press TAB and choose "Change screen/Delete/Only").

    However, you still have to create a screen manually (but I like it because I can organize sort of work areas -it is possible to isolate buffers per screen. A tab per buffer would be way too much + emacs creates many internal buffers so they can get on the way).

    helm: https://github.com/emacs-helm/helm/wiki

    ps: helm-buffers-list is close to the interface you want for switching buffers, without tabs…

    enter image description here

    0 讨论(0)
  • 2021-01-13 16:59

    Try out this snippet:

    (defun ctrltab ()
      "List buffers and give it focus"
      (interactive)
      (if (string= "*Buffer List*" (buffer-name))
          ;; Go to next line. Go to first line if end is reached.
          (progn
            (revert-buffer)
            (if (>= (line-number-at-pos)
                    (count-lines (point-min) (point-max)))
                (goto-char (point-min))
              (forward-line)))
        (list-buffers)
        (switch-to-buffer "*Buffer List*")
        (delete-other-windows)
        (forward-line)))
    
    (global-set-key [C-tab] 'ctrltab)
    

    It's often inferior to ido-switch-buffer, but it does its job anyway.

    0 讨论(0)
  • 2021-01-13 17:02

    I have been maintaining a personal copy of buffer-stack. It works really well -- to the extent that I haven't thought about it for years until recently when I had to fix a legacy workaround which caused a bug.

    I will put my fork up on github when time allows. I'm not averse to adding some sort of index display although it does not matter much in my use-case -- helm is great to choose from a list of buffers.

    0 讨论(0)
提交回复
热议问题