在我的大部分开发中,我从Visual Studio转换为Emacs(主要是由于切换编程语言).但是,我真正想念Visual Studio有一个很酷的功能: Ctrl- Tab在"缓冲区"之间.
本ctrl- tab在Visual Studio是不一样的C- x b在Emacs.所以,这不仅仅是键盘映射问题.以下是我理想的特点Ctrl- Tab:
我见过一些试图模拟这种行为的Emacs插件,但#4是最困难的.似乎Emacs无法检测ctrl密钥何时被释放.相反,代码等待用户在缓冲区中一段时间或等待缓冲区更改..然后缓冲区被添加到环中.这足以不同,真正阻挠我,只是从来没有用我心爱的ctrl- tab一次.现在我只是处理C- x b.偶像模式使C- x b更容忍,但我仍然梦想有一天我可以ctrl- tab在emacs.
有没有人找到一种方法来配置Ctrl- Tab在Emacs中工作像Visual Studio?
我认为这很接近你想要的。正如您所提到的,Emacs 不会接收控制键的事件,因此您无法完全获得所需的功能。但是,这不会记录缓冲区切换,直到您执行除按下之外的其他操作C-tab(即滚动、键入内容、单击鼠标、使用命令M-x ...):
(global-set-key (kbd "<C-tab>") 'my-switch-buffer)
(defun my-switch-buffer ()
"Switch buffers, but don't record the change until the last one."
(interactive)
(let ((blist (copy-sequence (buffer-list)))
current
(key-for-this (this-command-keys))
(key-for-this-string (format-kbd-macro (this-command-keys)))
done)
(while (not done)
(setq current (car blist))
(setq blist (append (cdr blist) (list current)))
(when (and (not (get-buffer-window current))
(not (minibufferp current)))
(switch-to-buffer current t)
(message "Type %s to continue cycling" key-for-this-string)
(when (setq done (not (equal key-for-this (make-vector 1 (read-event)))))
(switch-to-buffer current)
(clear-this-command-keys t)
(setq unread-command-events (list last-input-event)))))))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3440 次 |
| 最近记录: |