Emacs第一天安装和简单配置

博主分享了初次使用Emacs的体验,包括安装、基本配置和快捷键学习。文章提到了用Emacs替代Typora的原因,并计划深入学习org-mode。配置中涉及关闭工具栏、开启全局补全、显示行号等,还介绍了如何自定义快捷键打开配置文件。

Emacs第一天安装和简单配置

背景

学习Emacs是我一直以来想挑战的,一个经久不衰的东西,学习这套经典的东西就好像vi编辑器一样,肯定有很强的生命力。

  • 可以把大部分工作流打通,无需频繁折腾切换。
  • 免费开源(最近Typora收费了,心累),打算切换到org-mode

学习资料

  • emacs china的21天Emacs学习的 http://book.emacs-china.org/

  • 子龙山人的视频学习https://www.bilibili.com/video/BV1sp4y1Y73S?p=1

下载安装都忽略,没啥坑

遇到的一些注意点

按照教程学习即可,下面只是记录我个人的一下笔记。如eLisp只是粗浅学习,留待日后补充

常用的快捷键

和vi编辑器一样,emacs的快捷键和windows下的我们熟悉的不一样,我们需要熟悉emacs的风格。由于快捷键太多,我只学习简单的

  • 基础键位

    • ctrl 他们简写为C
    • Alt 他们简写为M(Meta)
  • 光标移动

    • C-f 为前移一个字符, f 代表 forward。

      C-b 为后移一个字符, b 代表 backward。

      C-p 为上移至前一行, p 代表 previous。

      C-n 为上移至下一行, n 代表 next。

      C-a 为移至行首, a 代表 ahead。

      C-e 为移至行尾, e 代表 end

  • 复制粘贴

    M-w为复制

    C-y为粘贴

  • 保存文件C-x C-s

  • 搜索c-s

  • 中止命令的输入:c-g,比如我输入了c-x 后面不想再继续,就用这个命令

修改Emacs默认配置

Emacs 的配置文件默认保存在 ~/.emacs.d/init.el 文件中,我们的配置就写在里面。不过教程里面都是使用mac或者linux

  • window下的.emacs.d目录在哪里?

使用如下命令

c+x+d ~/

在这里插入图片描述

默认路径:在C:\Users\Administrator\AppData\Roaming\.emacs.d
在这里插入图片描述

下面是我的.init.el配置,第一天的。其中关闭工具栏,显示行号等都让emacs不至于这么丑,通过配置,也有一种折腾的快感 :-p

;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.
(package-initialize)

;; 关闭工具栏,tool-bar-mode 即为一个 Minor Mode
(tool-bar-mode -1)

;开启全局补全
(global-company-mode 1)

;; 关闭文件滑动控件
(scroll-bar-mode -1)

;; 显示行号
(global-linum-mode 1)

;; 更改光标的样式(不能生效,解决方案见第二集)
(setq cursor-type 'bar)

;; 关闭启动帮助画面
(setq inhibit-splash-screen 1)

;; 更改显示字体大小 16pt
;; http://stackoverflow.com/questions/294664/how-to-set-the-font-size-in-emacs
(set-face-attribute 'default nil :height 110)

;; 快速打开配置文件
(defun open-init-file()
  (interactive)
  (find-file "~/.emacs.d/init.el"))

;; 这一行代码,将函数 open-init-file 绑定到 <f2> 键上
(global-set-key (kbd "<f2>") 'open-init-file)
(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.
 '(package-selected-packages '(company)))
(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.
 )

安装company,自动补全

这个按照教程一步一步操作即可,没坑,不过我的补全触发需要等待2s,先用着

org-mode

我会重点学习这个,作为typora的替代。但第一天还不会用,而且我喜欢带图片,暂时不知道怎么把截图直接拷贝到org-mode。如果用typora就不会这问题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值