如何在doom emacs 里用SPC number 选择window

  1. doom emacs 默认 SPC w h/j/k/l来选择window, 如何设置成SPC 1 来选择window 1,就像spacemacs那样?
  2. doom emacs 如何开启modeline的window number 呢。

小白刚入坑emacs, 有点懵,轻拍…

第一个问题,可以将添加一些快捷键解决。比如我是 SPC + num 选择 window。

(map! :leader
  "0" 'winum-select-window-0-or-10
  "1" 'winum-select-window-1
  "2" 'winum-select-window-2
  "3" 'winum-select-window-3
  "4" 'winum-select-window-4
  "8" 'split-window-below
  "9" 'split-window-right
  )
1 个赞

安装了winum后在config.el加入上述代码就工作了,而且window number在modeline里也显示了,估计是winum package的作用。非常感谢!

现在有了另一个问题,doom emacs 安装了treemacs后打开在侧边栏显示文件树,但是它没有window number, 也不能通过 SPC 0 选择。

(map! (:leader (:desc "open window 0" :g "0" #'treemacs-select-window)) )

可以工作了。

这个显然抄过来漏了改吧?


spacemacs我记得不是SPC w 1而是SPC 1,我现在也是用后者,这个高频操作,后者要好用得多。

and你可能需要把SPC <tab>设为

(defun my/alternate-window ()
  "Switch back and forth between current and last window in the
current frame."
  (interactive)
  (let (;; switch to first window previously shown in this frame
        (prev-window (get-mru-window nil t t)))
    ;; Check window was not found successfully
    (unless prev-window (user-error "Last window not found."))
    (select-window prev-window)
    (my/maybe-golden-ratio-adjust)))

(defun my/maybe-golden-ratio-adjust ()
  "Do golden ratio adjust if it's loaded and enabled."
  (when (and (boundp 'golden-ratio-mode)
             (symbol-value golden-ratio-mode))
    (golden-ratio)))

对的,感谢指出2处错误,已修改。另外SPC Tab非常好用!

才看到这贴,其实 doom 里面有 winum,在 init 里加上就行。

Doom 里面默认键位是 C-w 0~9 ,个人感觉不如 SPC 0~9 好按。