Spacemacs 键绑定未注册
Spacemacs keybindings not registering
我的 .spacemacs 文件包含一个如下所示的部分:
(defun dotspacemacs/user-config ()
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
;; Keybindings
(global-unset-key [(control z)]) ;; unbind sleep button
(global-unset-key [(control x)(control z)]) ;; unbind sleep button
(global-unset-key [(control e)])
(global-unset-key [(control k)]) ;; unbind kill line
(global-set-key [(control z)] 'undo) ;; set Windows-style undo
(global-set-key [(control e)] 'View-scroll-half-page-backward) ;; remap page up
;; Setting and showing the 80-character column width
(set-fill-column 80)
(auto-fill-mode t)
(toggle-fill-column-indicator)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(paradox-github-token t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
)
我遵循了这篇文章中的语法:https://github.com/andrewfwang/dotfiles/blob/ee84ddd304d1dad7ece206062debd3e3c86e927f/.emacs.d/init.el
但是,每次我重新启动 spacemacs 时,我的 none 更改都会注册。但是,如果我在同一个文件中启用或禁用包,这些更改就会注册。这些键绑定调整不应该在 user-config
下吗?
设置 CTRL+Z 有点棘手,因为 spacemacs 代码包含一个函数,可以在切换到 emacs 模式并再次返回时重新绑定它。它通过对 evil-toggle-key 的引用来实现,默认情况下是 CTRL+Z。如果将 evil-toggle-key 更改为其他内容,则可以使用 CTRL+Z 进行撤消。
建议:在 .spacemacs 文件中
在 custom-set-variables 部分添加此行
'( evil-toggle-key "C-`")
dotspacemacs/user-config 部分中的这一行
(global-set-key (kbd "C-z") 'undo)
以上配置我在 spacemacs 版本 0.200.7 和 emacs 版本 25.1.1 下工作 Windows 和 Linux
根据我的经验,moose1089 的答案大部分都在那里,但邪恶的配置需要在 .spacemacs
中的 dotspacemacs/user-config
部分之前加载。我发现添加 (setq evil-toggle-key "C-
")in the
dotspacemacs/user-init ()section of
.spacemacs` 很有魅力。
我的 .spacemacs 文件包含一个如下所示的部分:
(defun dotspacemacs/user-config ()
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
;; Keybindings
(global-unset-key [(control z)]) ;; unbind sleep button
(global-unset-key [(control x)(control z)]) ;; unbind sleep button
(global-unset-key [(control e)])
(global-unset-key [(control k)]) ;; unbind kill line
(global-set-key [(control z)] 'undo) ;; set Windows-style undo
(global-set-key [(control e)] 'View-scroll-half-page-backward) ;; remap page up
;; Setting and showing the 80-character column width
(set-fill-column 80)
(auto-fill-mode t)
(toggle-fill-column-indicator)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(paradox-github-token t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
)
我遵循了这篇文章中的语法:https://github.com/andrewfwang/dotfiles/blob/ee84ddd304d1dad7ece206062debd3e3c86e927f/.emacs.d/init.el
但是,每次我重新启动 spacemacs 时,我的 none 更改都会注册。但是,如果我在同一个文件中启用或禁用包,这些更改就会注册。这些键绑定调整不应该在 user-config
下吗?
设置 CTRL+Z 有点棘手,因为 spacemacs 代码包含一个函数,可以在切换到 emacs 模式并再次返回时重新绑定它。它通过对 evil-toggle-key 的引用来实现,默认情况下是 CTRL+Z。如果将 evil-toggle-key 更改为其他内容,则可以使用 CTRL+Z 进行撤消。
建议:在 .spacemacs 文件中
在 custom-set-variables 部分添加此行
'( evil-toggle-key "C-`")
dotspacemacs/user-config 部分中的这一行
(global-set-key (kbd "C-z") 'undo)
以上配置我在 spacemacs 版本 0.200.7 和 emacs 版本 25.1.1 下工作 Windows 和 Linux
根据我的经验,moose1089 的答案大部分都在那里,但邪恶的配置需要在 .spacemacs
中的 dotspacemacs/user-config
部分之前加载。我发现添加 (setq evil-toggle-key "C-
")in the
dotspacemacs/user-init ()section of
.spacemacs` 很有魅力。