我知道这个标题看起来很主观,但是我希望这个问题能够顺利地介绍一下来自emacs的新手而不是(这是我的情况)。
你可能想知道为什么我决定使用spacemacs,这是一个高度自定义的黑客而不是emacs,没有花时间习惯先使用vanilla emacs。好吧,事实上,我一直在尝试使用emacs和vim很长一段时间,因为我可以理解为什么这些软件能够提高工作效率并让你感觉更多"在家里" 编码/黑客攻击时 不幸的是,当我开始习惯vim时,你需要花时间学习,最重要的是,你需要花费在配置那些软件上的时间太高了对我来说 然后我发现了 spacemacs ,其中包含了vim中的一些优点,emacs中的优点,并将它们组合成一个很好的 预配置包。
问题是大多数配置是通过emacs-lisp完成的,并且期望用户在启动软件时理解代码的加载和执行方式,我完全不知道(因为我开始意识到越来越多的我深入研究代码)。
我希望能够启动emacs,并看到它执行我要编写的一些自定义代码,以便:
我希望能够在必要时对这些功能(以及其他一些功能)进行实际编码,或者在它们已经可用时安装它们。
(以及什么不起作用)
我(天真)配置我的spacemacs,就像任何lisp / emacs新手一样:
(defun dotspacemacs/user-config ()
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration. You are free to put any user code."
;; TODO
;; - Display whitespaces
;; - Install workgroups2
;; interface ;; this works
(setq powerline-default-separator 'arrow)
;; mouse scroll ;; this works? maybe
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
;; middle click copy-paste ;; this works
(setq x-select-enable-primary t)
;; diff-hl ;; this used to work but now does not
(diff-hl-flydiff-mode)
(setq diff-hl-side 'left)
;; rust ;; this works (and seems the right way to do it)
(add-hook 'rust-mode-hook #'racer-mode)
(add-hook 'racer-mode-hook #'eldoc-mode)
;; neotree ;; this works? maybe
(setq neo-show-hidden-files nil)
;; toggle preferences ;; this does not work
(spacemacs/toggle-automatic-symbol-highlight-on)
(spacemacs/toggle-line-numbers-on)
;; COrrect DOuble CAps ;; this does not works either (should be a hook)
(doublecaps-mode 1)
)
我意识到有一个名为" major-modes"和"次要模式"它分别适用于所有缓冲区或仅适用于特定的缓冲区实例,但我也很担心emacs有自己的全局和局部变量(似乎可以通过(setq)
自定义),spacemacs也有变量或自定义(spacemacs/toggle-something-on)
以及(custom-set-variables)
的方法,我想要做的大部分工作都是使用" hooks" 实现的。
spacemacs文档让我完全无能为力,因为它主要是让你知道事情是如何运作的,而emacs就像核工厂维护指南一样。
有人可以轻松地使用spacemacs给我一个"入口点" 来理解这些概念?
我希望能够回答这些问题:"哦,我想自定义该行为,我需要在哪里编码?我应该叫什么方法?我不应该叫什么方法?我可以更改/创建哪个变量?我把代码放在这里时实际执行了什么?...等等#34;