据说超级牛,很方便,看了youku上的视频,感觉的确可以加强我自己的emacs的配置,比如主题,目录树等,还有chrome编辑插件等。今天试一下。

安装

安装很简单,先备份自己的.emacs.d目录,然后移走。

现在clone项目到~/.emacs.d目录去

git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

有点大20多兆,等等吧,没关系。

安装完成后,启动emacs。完全不认识了,不过很好看。

按右键选择holly control tower(emacs) editing styel

后面两个都选默认吧,都是功能最全,可能速度慢点或者系统资源消耗多点。

电脑好无所谓了。:)

现在等待下载package安装。

界面太美。值得一试。

创建dean layer

现在创建private layer,用来保存自己的配置,不和github上的冲突。这样以后就可以用github放心升级spacemacs了。

M-x configuration-layer/create-layer命令,然后回答几个问题,创建dean的private layer.

需要编辑~/.spacemacs文件,添加dean layer

   dotspacemacs-configuration-layers   '(     ;; ----------------------------------------------------------------     ;; 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     ;; better-defaults     emacs-lisp     ;; git     ;; markdown     ;; org     ;; (shell :variables     ;;        shell-default-height 30     ;;        shell-default-position 'bottom)     ;; spell-checking     ;; syntax-checking     ;; version-control     dean     )

dean目录会出现在.emacs.d/private/dean, 里面有一个package.el文件

配置属于dean layer的package

现在我来添加一个chinese-pyim package来支持我在emacs里面输入中文。

所有的属于dean layer的packages都可以列在下面

(defconst dean-packages  '(chinese-pyim))

专门为chinese-pyim定义了一个初始化的函数, 这个必须有,否则重启emacs不会自动安装package

(defun dean/init-chinese-pyim()    (use-package chinese-pyim)    )

设置了默认输入法和词典文件路径

(custom-set-variables '(default-input-method "chinese-pyim") '(pyim-dicts (quote((:name "BigDict-01" :file "/home/dean/.emacs.d/private/dean/pyim/dicts/pyim-bigdict.pyim" :coding utf-8-unix :dict-type pinyin-dict)))   ) )

重新启动emacs,一会儿看到下载安装,然后检查*Message*,会看到dean/package.el成功loading

到~/.emacs.d/elpa/目录下可以找到chinese-pyim package的程序,证明安装成功。

现在按C-\, 可以输入中文了。

目录树功能

M-m f t

M-m 其实就是SPC(vim用户习惯用SPC,emacs用户就是M-m了)

现在很漂亮的目录树出现了。

其实这里用的是neotree package。具体快捷键如下:

Shortcut (Only in Neotree Buffer)n next line , p previous line。SPC or RET or TAB Open current item if it is a file. Fold/Unfold current item if it is a directory.g RefreshA Maximize/Minimize the NeoTree WindowH Toggle display hidden filesC-c C-n Create a file or create a directory if filename ends with a ‘/’C-c C-d Delete a file or a directory.C-c C-r Rename a file or a directory.C-c C-c Change the root directory.

复制当前buffer的路径

M-m f y

非常实用的快捷键。

启用git layer

参考 https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Bsource-control/git

使用smart search搜索

M-m / 然后输入想要搜索的文字,就可以立刻搜索当前目录树里面的文件,非常好用。

不再需要进入eshell再grep了。

org相关

导出为odt文件

C-c C-e看不到菜单,无所谓了,命令行依旧可以工作

M-x org-odt-export-to-odt就好。

odt/html中文优化

github上有一个中文优化工具,可以这样安装。我在自己的layer里面安装不成功。所以用全局的方法。

在.spacemacs文件中

   dotspacemacs-additional-packages '(org-chinese-utils)

同时在这里加上初始化代码:

(defun dotspacemacs/user-config ()  "Configuration function for user code.This function is called at the very end of Spacemacs initialization afterlayers configuration.This is the place where most of your configurations should be done. Unless it isexplicitly specified that a variable should be set before a package is loaded,you should place your code here."  (require 'org)  (require 'org-chinese-utils)  (ocus-enable)  )

具体优化功能参考网站上的说明:

https://github.com/tumashu/org-chinese-utils

我也是装了第一次用,还没有验证功能是否很好。

编程相关

代码折叠

这里需用命令,快捷键我还没有找到。自己也懒得定制。

M-x evil-open-fold(s) 展开代码

M-x evil-close-fold(s) 折叠代码

括号匹配

什么都不用作,自带。最牛的一点是居然将当前匹配的一对括号用下划线和高亮显示。比之前我用的任何方法都好。

写lisp最头疼的是什么?就是难以在一堆括号里面迅速找到匹配的那一对。现在福音来了。

自动格式化

在~/.spacemacs中启用c-c++ layer后,然后在dean layer的package.el中添加下面一段

;; clang(defun dean/c-c++()  (use-package c-c++)  )(setq-default dotspacemacs-configuration-layers              '((c-c++ :variables                       c-c++-default-mode-for-headers 'c++-mode)))(setq-default dotspacemacs-configuration-layers              '((c-c++ :variables c-c++-enable-clang-support t)));; Bind clang-format-region to C-M-tab in all modes:(global-set-key [C-M-tab] 'clang-format-region);; Bind clang-format-buffer to tab on the c++-mode only:(add-hook 'c++-mode-hook 'clang-format-bindings)(defun clang-format-bindings ()  (define-key c++-mode-map [tab] 'clang-format-buffer))

现在只需要按下tab键,就能够自动格式化代码,效果很好。

dired mode

用外部程序打开文件

在.spacemacs中添加openwith package

   dotspacemacs-additional-packages '(org-chinese-utils openwith)

并初始化,最后三行

(defun dotspacemacs/user-config ()  "Configuration function for user code.This function is called at the very end of Spacemacs initialization afterlayers configuration.This is the place where most of your configurations should be done. Unless it isexplicitly specified that a variable should be set before a package is loaded,you should place your code here."  (require 'org)  (require 'org-chinese-utils)  (ocus-enable)  (require 'openwith)  (setq openwith-associations '(("\\.odt\\'" "libreoffice" (file))))  (openwith-mode t)  )

重启emacs后安装。配在自己的layer里面不成功。所以暂时也放在.spacemacs中了。

现在在dired 模式下,选中一个文件按Enter,libreoffice就立刻弹出来了。

默认dired mode会在emacs里面打开pdf, pptx, docx和图片。odt不能打开,所以我就处理了一下odt文件。

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

安装和使用spacemacs相关推荐

  1. 024_spacemacs支持org-pomodoro的声音提示

    这个简单的小功能配置起初有点让我觉得奇怪,我自己的配置可以通过声音提示,反倒是spacemacs的配置不支持. 我个人的emacs配置中,这个功能很久之前就实现了,当时印象中只记得配置了一个power ...

  2. win10安装emacs+spacemacs,建议用官方安装方式

    1.下载emacs最新版 26.1 官网下载地址:https://www.gnu.org/software/emacs/download.html#nonfree 2.解压emacs到你的安装目录,我 ...

  3. win10安装spacemacs

    1.下载emacs最新版 26.1 2.解压emacs到你的安装目录,我的系统是D:/Program File/.执行/bin目录下的addpm.exe 这一步会在开始菜单创建快捷方式 3.在系统环境 ...

  4. linux emacs 编译,linux 编译安装emacs和安装spacemacs

    下载 wget http://mirrors.ustc.edu.cn/gnu/emacs/emacs-25.1.tar.xz tar xvf emacs-25.1.tar.xz 编译安装 ./conf ...

  5. windows安装spacemacs

    版权声明:iamqilei@qq.com    https://blog.csdn.net/u011729865/article/details/54178388 安装emacs最新版251 编辑em ...

  6. 不论报任何错误 都是网络源有问题,安装spacemacs报错的解决方式

    不论报任何错误 都是网络源有问题 打开.spacemacs ### 这是原头部 (defun dotspacemacs/layers () "Configuration Layers dec ...

  7. spacemacs各种问题修复方法

    快捷键操作时报 tr不是内部命令 ------说明是缺少tr命令,win10可以安装coreutils for gnuwin32工具集,然后把bin目录加到系统path路径即可 没有ispell, f ...

  8. python scatter 简书_写给 Pythonist 的 Spacemacs 入门指北

    前言 最开始,使用 Sublime Text 编码,后来用 Vim 混合 PyCharm 写 Python. 前几天,Github 上的 Spacemacs 已经成功的突破一万 Star, 听说几个我 ...

  9. spacemacs email layer

    安装依赖程序 本地也需要安装mu4e和mu程序. offlinemap也要安装并且设置好.参考: offlineimap读取qq邮箱 安装layer dotspacemacs-configuratio ...

最新文章

  1. XenServer中Fast Copy与Full Copy的区别
  2. Linux内核设计与实现学习笔记目录
  3. 小试牛刀chrome来调试APP
  4. spring boot项目打包成war并在tomcat上运行的步骤
  5. Spark源码分析之Worker
  6. 无法启动baiMicrosoft Office Outlook。无法打开duOutlook窗口
  7. Spring AOP注解方式实现
  8. 转:高等数学、线性代数、概率论数理统计书籍推荐
  9. html 形状div,div+css实现各种形状(精心整理)
  10. iOS项目的完整重命名方法图文教程
  11. PAT甲级1019 回文数
  12. 帆软按钮Javascript给某个单元格赋值(例:逻辑删除)
  13. 绝对引用计算机几级,计算机一级必考的14个Excel函数,让我来告诉你
  14. HQL左外连接及排序
  15. 三星电子能从硬件公司转型成软件公司吗?
  16. C++多线程1——pthread
  17. 安徽省计算机二级水平考试试卷,安徽省计算机二级考试理论试题(附答案)
  18. 使用 COLOR THIEF 获取图片主色,实现图片渐变遮罩,颜色填充等
  19. 锤炼腹肌的好方法:健腹轮的折叠刀式俯卧撑
  20. 国家公务员行测数字推理常见规律

热门文章

  1. Grafana 轻松接入饭碗警告电话报警
  2. ASO第一步-什么是ASO,与SEO的区别?
  3. 素描人物头像写生的基本规律是有哪些
  4. 【Gazebo入门教程】第六讲 控制器插件的编写与配置(下)
  5. js 给爱的人发个邮件吧
  6. oracle执行存储过程06576,oracle的存储过程语法
  7. php程序员述职材料_php程序员述职报告
  8. 《惯性导航》第二版秦永元 知识点总结之一 《第一章 绪论》
  9. aliyun-oss-02
  10. 推荐几个能被惊艳到的程序员必备的画图工具