Emacs

Emacs

官网

GNU Emacs

初始文件

  • ~/.emacs
  • ~/.emacs.el
  • ~/.emacs.d/init.el

The Emacs Initialization File

修改主题

color-theme-modern:

1
M-x package-install [RET] color-theme-modern [RET]

手动配置加载主题:

1
2
(add-to-list 'custom-theme-load-path "~/.emacs.d/elpa/color-theme-modern-20161219.344")
(load-theme 'tango-dark t)

Alt+x customize-themes

安装 Emacs 25.2

  • 可以修复无法下载安装插件的问题,安装教程
  • 可能遇见的缺少 X 界面库的问题: 解决方案
  • 可能会提示系统缺少 autoconf: sudo apt install autoconf
  • 下载 Emacs 源码的时候,不要直接命名文件夹为 emacs,否则最后编译脚本最后 ln -s 创建一个名为 emacs 的别名的时候,会提示文件已经存在
1
2
3
4
5
6
7
8
9
sudo apt-get install build-essential texinfo libx11-dev libxpm-dev libjpeg-dev libpng-dev libgif-dev libtiff-dev libgtk2.0-dev libncurses-dev 
# for gtk3 build replace libgtk2.0-dev with libgtk-3-dev

git clone --depth=1 git://git.savannah.gnu.org/emacs.git
sudo apt-get install autoconf # not needed if it exist
cd emacs
./autogen.sh # not needed when installing from tarball
./configure --with-gnutls=no
sudo make install

The compile time is very long.

Emacs 包

1
2
3
4
5
6
7
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line

也可以尝试一下这样写 (Working):

1
2
3
4
(require 'package)
(setq package-archives '(("gnu" . "http://elpa.emacs-china.org/gnu/")
("melpa" . "http://elpa.emacs-china.org/melpa/")))
(package-initialize)

代理

1
2
3
4
(setq url-proxy-services
'(("no_proxy" . "^\\(localhost\\|10.*\\)")
("http" . "address:8001")
("https" . "address:8002")))

设置窗口大小

1
2
3
4
5
(setq initial-frame-alist
'(
(width . 112) ; character
(height . 14) ; lines
))

隐藏欢迎信息

1
2
;; no startup msg
(setq inhibit-startup-message t) ; Disable startup message

查找和匹配

1
2
3
4
# 替换
y
# 回到上一个出现的位置
^

推荐文章