Spacemacs 安装和简要配置

  • SPACEMACS 和 EMACS
    • 安装
    • 基本配置
    • 其它设置

SPACEMACS 和 EMACS

SPACEMACS 只是 EMACS 的配置。好处在于安装之后,几乎不需要另外设置配置。SPACEMACS 配置了很多快捷键,用leader键(空格键)触发。由于 EVIL 插件,EMACS 可以使用很多 VIM 的快捷键。VIM 的基本快捷键在网络上很多,用几次就差不多了。EMACS 不好的地方就是太多 C/ALT+key 的组合,手指很疼。用 VIM 快捷键会缓解很多,也很方便。e.g. 删除引号中的一段, di" or ci”。另外,对初学者(包括我),别折腾太多功能。譬如,用 EMACS 听歌,浏览网页,ORG 模式,等等,这些用手机挺好的。仅仅用 EMACS 编辑代码就可以了。

安装

在 mac 或 linux 系统中:

brew install emacs
// or
sudo apt install emacsrm -rf ~/.emacs.d .emacs
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
emacs

在启动 emacs 中会提示选择编辑模式,我选择了 emacs。但是我在配置文件中改成 hybrid 模式。这个模式要用 i, 进入编辑模式,可以利用 emacs 的组合键。可以用 ESC 退出编辑模式,用 VIM 的快捷键。

基本配置

打开~/.spacemacs。

nvim ~/.spacemacs

编辑模式

  dotspacemacs-editing-style 'hybrid不太喜欢这个 line-number 显示,由于我把有的字体加粗后,linenumber 有些变形;; dotspacemacs-line-numbers '(:visual t;;                             :relative t;;                             :disabled-for-modes dired-mode pdf-view-mode;;                                     )dotspacemacs-smartparens-strict-mode t

添加 需要安装的 layer

   dotspacemacs-configuration-layers'(javascriptpython(c-c++:variablesc-c++-backend 'lsp-clangdc-c++-enable-clang-format-on-save t)shaderscommon-lisposx;; ----------------------------------------------------------------;; Example of useful layers you may want to use right away.;; Uncomment some layer names and press <SPC f e R> (Vim style) or;; <M-m f e R> (Emacs style) to install them.;; ----------------------------------------------------------------helm(auto-completion :variablesspacemacs-default-company-backends '(company-files company-capf company-tabnine company-lsp)auto-completion-tab-key-behavior 'cycle)better-defaultsemacs-lispgitmarkdown;; org(shell :variablesshell-default-height 30shell-default-position 'bottom);;spell-checkingsyntax-checkingversion-control(ranger :variablesranger-show-preview tranger-show-hidden tranger-cleanup-eagerly tranger-cleanup-on-disable tranger-ignored-extensions '("mkv" "flv" "iso" "mp4")))

添加需要安装的 additional packages

   dotspacemacs-additional-packages '(highlight-indent-guidesslimehelm-slimehelm-gitcompany-tabninelsp-modelsp-ui;;company-lsppython-modecomment-dwim-2electric-operatoryasnippet-snippetscmake-mode;;multiple-cursorsiedit ; C-; activate/cancel,  10C-; 10 matcheskey-chordall-the-iconstreemacstreemacs-eviltreemacs-projectiletreemacs-icon-diredtreemacs-magittry)

其它设置

(defun dotspacemacs/user-init ()"Initialization function for user code.
It is called immediately after `dotspacemacs/init', before layer configuration
executes.This function is mostly useful for variables that need to be set
before packages are loaded. If you are unsure, you should try in setting them in
`dotspacemacs/user-config' first."(setq-default dotspacemacs-colorize-cursor-according-to-state nil)(setq configuration-layer--elpa-archives'(("melpa-cn" . "http://elpa.emacs-china.org/melpa/")("org-cn"   . "http://elpa.emacs-china.org/org/")("gnu-cn"   . "http://elpa.emacs-china.org/gnu/")))(setq-default display-line-numbers-width 2))(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."(setq-default tab-width 4)(setq-default indent-tabs-mode nil)(setq c-default-style "bsd"c-basic-offset 4)(global-hl-line-mode t);;下划线,可以快速找到正在编辑的行(set-face-attribute hl-line-face nil :underline "magenta")(set-face-background 'highlight nil)(global-set-key (kbd "M-;") 'comment-dwim-2) ;;注释用的(setq spacemacs-show-trailing-whitespace nil)(setq inferior-lisp-program "/usr/local/bin/sbcl");; (use-package company;;   :ensure t;;   :config;;   (setq company-idle-delay 0);;   (setq company-minimum-prefix-length 3);;   (global-company-mode t));; (use-package company-tabnine;;   :ensure t;;   :config;;   (add-to-list 'company-backends #'company-tabnine));; (use-package company-lsp;;   :ensure t;;   :config;;   (add-to-list 'company-backends #'company-lsp))(use-package electric-operator:ensure t:config(electric-operator-add-rules-for-mode 'c-mode(cons "*" nil)));; (add-hook 'python-mode-hook (lambda () (set (make-local-variable 'company-backends) '(#'company-tabnine))))(electric-indent-mode t);; (add-hook 'c++-mode-hook (lambda ();;                            (electric-indent-local-mode -1)));;(electric-pair-mode 1), because of smartparens;;(global-set-key (kbd "RET") 'newline-and-indent);; add space around to opera(add-hook 'python-mode-hook #'electric-operator-mode)(setq company-show-numbers t)(add-hook 'after-init-hook 'global-company-mode)(blink-cursor-mode t)(set-cursor-color "yellow")(setq-default line-space 0.3)(add-hook 'prog-mode-hook 'which-function-mode);; display-line-numbers 并非必需的。我把配置文件中的 dosspace-line-numbers 注释掉了(use-package display-line-numbers:init(setq display-line-numbers-width 2)(setq display-line-numbers-grow-only t)(setq display-line-numbers-type 'relative)(set-face-background 'line-number "#313335")(set-face-foreground 'line-number-current-line "#FF0000")(add-hook 'prog-mode-hook #'display-line-numbers-mode)(add-hook 'text-mode-hook #'display-line-numbers-mode)(add-hook 'web-mode-hook #'display-line-numbers-mode));;(load-file "~/.emacs.d/keybinding.el");;(load-file "~/.emacs.d/pretty-symbols.el");;这个看个人喜好,可以注释掉
(custom-set-faces'(font-lock-function-name-face ((t (:height 1.2))) t)'(font-lock-constant-face ((t (:height 1.1 :Width 1.1))) t)'(font-lock-keyword-face ((t (:height 1.1))) t)'(font-lock-builtin-face ((t (:height 1.1))) t)'(font-lock-type-face ((t (:height 1.2))) t)'(font-lock-string-face ((t (:Width 1.1 :height 1.1))) t))
)

Spacemacs 安装和简要配置相关推荐

  1. hyper-v server 2008安装及简要配置

    如需转载,请经我充许后方可.By RickyFang/下里巴人 微软九月底如约发布了hyper-v server 2008,偶是那种对微软产品勇于尝鲜的人.嘿嘿,从网站下载下来就迫不急待的试验了下安装 ...

  2. ubuntu安装Linux网络配置,CentOS和Ubuntu系统简要网络配置及常用网络管理工具汇总...

    鉴于不同的用户群体.不同的业务在使用Linux系统时共同的首要问题是解决网络连接的问题,写下这篇博文. 本文主要总结CentOS和Ubuntu系统关于网卡的简要配置以及管理网卡时常用的三个工具的区别( ...

  3. sonarqube连mysql_.net持续集成sonarqube篇之sonarqube安装与基本配置

    原标题:.net持续集成sonarqube篇之sonarqube安装与基本配置 Sonarqube下载与安装 Sonarqube下载地址是:https://www.sonarqube.org/down ...

  4. geant4安装以及Root配置

    geant4安装以及Root配置 先贴一个豆瓣链接:https://www.douban.com/note/431788626/ ROOT 按照cern root 安装:https://leeyeel ...

  5. java配置mq环境变量_RocketMQ学习-01安装及环境配置

    安装jdk环境 yum install java-1.8.0-openjdk java -version which java 输出 /usr/bin/java #软连接 ls -l /usr/bin ...

  6. Exchange Server 2013 安装完成后配置外部URL

    Exchange Server 2013 安装完成后配置外部URL 比如 mail.contoso.com  1.转到 EAC →  "服务器",然后单击"配置外部访问域 ...

  7. Linux Tomcat安装,Linux配置Tomcat,Linux Tomcat修改内存,Linux tomcat修改端口

    Linux Tomcat安装,Linux配置Tomcat,Linux Tomcat修改内存,Linux tomcat修改端口 >>>>>>>>>& ...

  8. Centos7安装Miniconda及配置jupyter

    Conda是什么? Conda是一个开源的包.环境管理器,可以用于在同一个机器上安装不同版本的软件包及其依赖,并能够在不同的环境之间切换. Anaconda包括Conda.Python以及一大堆安装好 ...

  9. VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装

    VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装 在阿里云开源镜像地址下载镜像 Index of /centos/7.2.1511/isos/x86_64/ http://mi ...

  10. 下载和安装Nginx之配置选项

    为什么80%的码农都做不了架构师?>>>    你已经成功下载并解压了Nginx安装包.现在,为了适应操作系统,为了获得二进制的运行,要对Nginx进行编译配置处理.创建一个应用程序 ...

最新文章

  1. 为什么 CAPTCHA 变得越来越难?因为 AI 更聪明了
  2. java动漫网站开题报告_基于java的校园论坛网站的开发与设计开题报告.doc
  3. JavaScript设计的漂亮的玫瑰花
  4. Pytorch(5)-梯度反向传播
  5. 关于VISIO工具栏、菜单栏消失的解决办法
  6. 用计算机表白的数字,用数字表白的句子大全 如何用数字表白一段话
  7. 容器编排技术 -- Kubernetes Volume
  8. 如何起oracle,如何使用Oralce企业管理(Oracle Enterprise Manager)控制台
  9. 《精通Spring MVC 4》——1.3 start.Spring.io简介
  10. Zabbix监控解决方案
  11. ros topic 命令
  12. Educational Codeforces Round 12 F. Four Divisors 求小于x的素数个数(待解决)
  13. 极客公园创新大会 IF 2018,用科技主义和独立思维击退喧嚣
  14. git将项目提交到本地创库
  15. Python中jieba库的使用
  16. 什么显卡是个人计算机的基本配置和市场主流,现在()显卡已经成为了个人计算机的基本配置和市场主流。 - 问答库...
  17. vue封装请求 获取上传文件进度及设置超时时间
  18. mongodb-更新操作符
  19. Vue开发环境搭建和vue-cli脚手架
  20. java项目遇到风险漏洞示例与解决方案

热门文章

  1. iOS平台游戏安全之IPA破解原理及防御(第三弹)
  2. 锂电池升压-SX1308
  3. [PHP] 新浪企业邮箱登录功能难点梳理
  4. 解决使用python-igraph绘制网络图时报错AttributeError: plotting not available
  5. Cron范式每日凌晨一点执行
  6. Unity 武器拖尾效果
  7. 计算机视觉、机器学习、深度学习相关开源代码集合归纳总结(二)(收藏用)
  8. Root Mi note lte with SuperSU without flashing TWRP Recovery permanently (by quqi99)
  9. P4850 [IOI2009] 葡萄干 raisins 题解
  10. dns配置异常怎么修复_电脑出现dns错误不能上网怎么办?dns错误修复方法