2016-12-05 41 views
2

我.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下?

回答

1

設置CTRL + Z稍微有點棘手,因爲spacemacs代碼包含一個函數,在一個切換到emacs模式並重新返回時重新綁定它。它通過引用evil-toggle-key來完成此操作,默認爲CTRL + Z。如果您將邪惡肘關鍵更改爲其他內容,則可以使用CTRL + Z進行撤消。

建議:在.spacemacs文件

在自定義設置的變量部分

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

與該線路dotspacemacs /用戶配置部分添加此行

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

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

+0

似乎把''(evil-toggle-key」C-'「)'放在'dotspacemacs/user ''custom-set-variables'中的'-config'已經太晚了,因爲邪惡已經加載了,但是把'(setq evil-toggle-key'C-'\')'放在'dotspacemacs/user- .spacemacs的init()'部分似乎工作。 – NeilenMarais

1

根據我的經驗,moose1089的答案大部分都在那裏,但是邪惡的配置需要比中的dotspacemacs/user-config secion更早加載。我發現添加(setq evil-toggle-key "C-「)in the dotspacemacs/user-init()section of .spacemacs`作品魅力