emacs - Spacemacs 键绑定(bind)未注册

标签 emacs editor key-bindings 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 时,我的更改都没有注册。但是,如果我在同一个文件中启用或禁用包,这些更改就会注册。这些键绑定(bind)调整不应该在 user-config 下吗?

最佳答案

设置 CTRL+Z 有点棘手,因为 spacemacs 代码包含一个函数,可以在切换到 emacs 模式并再次返回时重新绑定(bind)它。它通过引用默认为 CTRL+Z 的 evil-toggle-key 来实现。如果您将 evil-toggle-key 更改为其他内容,则可以使用 CTRL+Z 进行撤消。

建议:在.spacemacs文件中

在自定义设置变量部分添加这一行

'( evil-toggle-key "C-`")

和 dotspacemacs/user-config 部分中的这一行

(global-set-key (kbd "C-z") 'undo) 

上述配置我在 Windows 和 Linux 下的 spacemacs 版本 0.200.7,emacs 版本 25.1.1 上工作

关于emacs - Spacemacs 键绑定(bind)未注册,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40983562/

相关文章:

editor - 有没有办法改变notepad++中工具栏的颜色?

javascript - Ace Editor - 只读变量

java - 在运行时切换键盘快捷键集

Javascript 捕获 ctrl+alt+c

emacs - GNU Emacs : How to disable prompt to save modified buffer on exit

regex - Emacs 在每个单词周围添加引号

emacs - 如何通过El-Get安装MELPA软件包?

emacs - 在 emacs 的 org 模式下禁用归档支持

linux - 适用于 Linux 的 Cocos2d-x 编辑器?

Java 键绑定(bind)加键