Spacemacs键绑定没有注册

时间:2016-12-05 21:20:33

标签: 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时,我的所有更改都没有注册。但是,如果我在同一个文件中启用或禁用这些更改,则会更改这些更改。这些键绑定调整是否应该在user-config下?

2 个答案:

答案 0 :(得分:2)

设置 CTRL + Z 有点棘手,因为spacemacs代码包含一个函数来重新绑定它,因为切换到emacs模式并再次返回。它通过引用evil-toggle-key来执行此操作,默认情况下为 CTRL + Z 。如果您将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

答案 1 :(得分:1)

根据我的经验,moose1089的答案大部分都在那里,但邪恶的配置需要比dotspacemacs/user-config中的.spacemacs部分更早加载。我发现添加(setq evil-toggle-key "C-")in the dotspacemacs / user-init()section of。spacemacs`是一种魅力。