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

doom

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

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


#2

第一个问题,可以将添加一些快捷键解决。比如我是 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
  )

#3

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


#4

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


#5

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

可以工作了。


#6

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


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)))