简体   繁体   English

emacs:控制选项卡缓冲循环,或堆栈缓冲循环,类似于windows之间的alt-tab

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

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 experience slightly awkward without being able to visualize other buffers further down the stack. 我已经查阅了这个资源: httpbuffer-stack.el ,并尝试了buffer-stack.el ,这很有用,但是我发现用户体验有点尴尬而无法想象其他在堆栈中进一步缓冲。 It is also outdated (2002), so I wonder if there is an improved version. 它也是过时的(2002年),所以我想知道是否有改进的版本。 Most other links on that page are broken or very old as well. 该页面上的大多数其他链接都已损坏或非常旧。

I am seeking a ctrl + tab stack-based buffer cycling, similar to the way alt + tab works with windows. 我正在寻找一个基于ctrl + tab的缓冲区循环,类似于alt + tab与windows一起工作的方式。 Ideally it would include an indicator for my current location in the buffer list. 理想情况下,它会在缓冲区列表中包含我当前位置的指示符。 I don't think my desired feature is too specific, since many IDE's already have this feature. 我不认为我想要的功能太具体,因为许多IDE已经具备此功能。

I would imagine a tool that is similar to how buffer cycling works in Eclipse. 我想象一个类似于Eclipse中缓冲区循环的工具。 Pick below: 选择如下:

在此输入图像描述

I have explored other options, but nothing seems to mimic the functionality that has already been implemented across other IDE's like Eclipse. 我已经探索了其他选项,但似乎没有任何模仿已经在其他IDE(如Eclipse)中实现的功能。

I am aware of ido-mode , although it does not suit my needs for rapid stack-based switching. 我知道ido-mode ,虽然它不适合我对快速基于堆栈的切换的需求。

I am also aware of other non-stack solutions like the one below: 我也知道其他非堆栈解决方案,如下所示:

(global-set-key [C-tab] 'next-buffer)
(global-set-key [C-S-iso-lefttab] 'previous-buffer);Linux
(global-set-key [C-S-tab] 'previous-buffer);Windows/Linux

but I prefer a stack-based switch. 但我更喜欢基于堆栈的交换机。

Any suggestions? 有什么建议? Is this feature available somewhere, or even in development? 这个功能在某个地方,甚至在开发中都可用吗? Especially with an index indicator, as shown in Eclipse above. 特别是带有索引指示器,如上面的Eclipse所示。 That would be awesome - I imagine it would be as a pop-up or in the mini-buffer. 这将是非常棒的 - 我想它会像弹出窗口或迷你缓冲区一样。

elscreen does a little bit what you seek: http://wikemacs.org/index.php/Elscreen elscreen做了一点你所寻求的: httpelscreen
You have to create screens (tabs) on demand and you can call Mx elscreen-select-and-goto to select a screen from a list in the minibuffer. 您必须按需创建屏幕(选项卡),您可以调用Mx elscreen-select-and-goto从迷你缓冲区中的列表中选择一个屏幕。

Fortunately it is already coupled with helm : helm-elscreen . 幸运的是它已经与helmhelm-elscreen That gives a good looking and handy choice list: 这给出了一个好看又方便的选择列表:

  • fuzzy matching 模糊匹配
  • scrollable list 可滚动列表
  • choose actions (press TAB and choose "Change screen/Delete/Only"). 选择操作(按TAB键并选择“更改屏幕/删除/仅”)。

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). 但是,您仍然需要手动创建一个屏幕(但我喜欢它,因为我可以组织一些工作区域 - 可以隔离每个屏幕的缓冲区。每个缓冲区的选项卡太多了+ emacs创建了许多内部缓冲区,所以它们可以上路了)。

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

ps: helm-buffers-list is close to the interface you want for switching buffers, without tabs… ps: helm-buffers-list接近你想要切换缓冲区的接口,没有标签......

在此输入图像描述

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. 它通常不如ido-switch-buffer ,但无论如何它ido-switch-buffer完成它的工作。

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. 如果时间允许,我会把我的叉子放在github上。 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. 我并不反对添加某种索引显示,尽管在我的用例中并不重要 - 从缓冲区列表中选择helm非常棒。

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

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