快捷键 C -> ctrl
M -> meta/alt
少部分是esc
编辑快捷键
C-n nextline
C-p previous line
C-f forword
C-b backforword
C-k kill (从光标位置到末尾全部删除)
C-a a (a是字母表的开始) start of line
C-e end of line
M-< 去往编辑最开始的位置
M-> 去往编辑结束的位置
C-v 向下翻一屏
M-v 向上翻一屏
C-SPC 设置标记 逐字符标记
M-SPC 设计标记 逐单词标记
C-w kill 选中内容
M-w 复制选中内容
C-y 粘贴最近一次杀死的内容
C-d 删除一个字符
M-d 删除一个单词
文件快捷键
C-x C-f 打开文件
C-x C-s 保存文件
C-x C-w 另存为
必备helper
C-h help tutorial
C-h k help Keybind
C-h f help function
elisp快捷键
给外观做点改变
图形化配置:
菜单栏 menu-bar-mode
工具栏 tool-bar-mode
滚动条 scroll-bar-mode
文件配置 ~/.emacs
1 2 3 (menu-bar-mode -1 ) (tool-bar-mode -1 ) (scroll-bar-mode -1 )
认识配置文件
~/.emacs
单一配置文件
~/.emacs.d
更符合工程化
~/.config/emacs/init.el
仅仅适用与>=27的版本
第一行配置代码 1 (setq inhibit-startup-screen t )
软件源
1 2 3 4 5 6 (setq package-archives '( ("melpa" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/" ) ("gnu" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/" ) ("org" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/org/" ) ) )
安装第一个扩展 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 (setq package-check-signature nil ) (require 'package) (unless (bound-and-true-p package--initialized) (package-initialize )) (unless package-archive-contents (package-refresh-contents )) (unless (package-installed-p 'use-package) (package-refresh-contents ) (package-install 'use-package))
使用use-package管理扩展
1 (use-package restart-emacs)
1 2 3 4 5 6 7 8 (use-package SOME-PACKAGE-NAME :ensure t :defer t :init (setq ...) :config (...) :bind (...) :hook (...) )
1 2 3 4 5 6 7 (setq use-package-always-ensure t use-package-always-defer t use-package-enable-imenu-support t use-package-expand-minimally t )
配置主题 1 2 (use-package gruvbox-theme :init (load-theme 'gruvbox-dark-soft t ))
好看的gruvbox-theme 顺便配置一个好看的Mode-line
需要提前下载好 所以需要M-x package-install gruvbox
1 2 3 4 5 (use-package smart-mode-line :init (setq sml/no-confirm-load-theme t sml/theme 'respectful) (sml/setup ))
总结我的基础配置101 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 (menu-bar-mode -1 ) (tool-bar-mode -1 ) (scroll-bar-mode -1 ) (setq inhibit-startup-screen t ) (setq package-archives '( ("melpa" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/" ) ("gnu" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/" ) ("org" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/org/" ) ) ) (setq package-check-signature nil ) (require 'package) (unless (bound-and-true-p package--initialized) (package-initialize )) (unless package-archive-contents (package-refresh-contents )) (unless (package-installed-p 'use-package) (package-refresh-contents ) (package-install 'use-package)) (setq use-package-always-ensure t use-package-always-defer t use-package-enable-imenu-support t use-package-expand-minimally t ) (use-package restart-emacs) (use-package gruvbox-theme :init (load-theme 'gruvbox-dark-soft t ))