Emacs第二话:更舒服的编辑
Emacs第二话:更舒服的编辑
热身
用emacs,不用鼠标。额,不知道是谁说的,我浏览网页偶尔还是要用下鼠标的。
不过有 firemacs, mouseless, tab mix plus 的组合还是可以做到mouseless的。
首先,是光标移动速度要快,在linux上有xset,其次是要改 Esc为ctrl。如果你想舒服点就这么
做吧。
emacs启动太慢?
emacs --daemon
我的shrc中的alias
export EDITOR=‘emacsclient -c‘ alias e=‘emacsclient -c‘ alias emacs=‘emacs‘
emacs不能输入中文?
export LC_CTYPE=‘zh_CN.UTF-8‘
下面是我一个开机启动的脚本:
xset r rate 250 50 # Sane repeat rate xset -b # No bell xset -dpms # Keep screen on at all times xset s off # setxkbmap -option ctrl:nocaps export LC_CTYPE=‘zh_CN.UTF-8‘ # 解决在emacs中输入中文 emacs --daemon
快速的编辑
首先需要学会安装package,怎么样require。应该会了吧。
(defun kill-region-or-backward-word () (interactive) (if (region-active-p) (kill-region (region-beginning) (region-end)) (backward-kill-word 1))) (global-set-key (kdb "C-w") ‘kill-rectangle-or-backward-word) (global-set-key (kbd "M-h") ‘kill-region-or-backward-word) (defun smarter-move-beginning-of-line (arg) (interactive "^p") (setq arg (or arg 1)) ;; Move lines first (when (/= arg 1) (let ((line-move-visual nil)) (forward-line (1- arg)))) (let ((orig-point (point))) (back-to-indentation) (when (= orig-point (point)) (move-beginning-of-line 1)))) (global-set-key (kbd "C-a") ‘smarter-move-beginning-of-line) ;; Use shell-like backspace C-h, rebind help to F1 (define-key key-translation-map [?\C-h] [?\C-?]) (global-set-key (kbd "<f1>") ‘help-command) (defun save-region-or-current-line (arg) (interactive "P") (if (region-active-p) (kill-ring-save (region-beginning) (region-end)) (copy-line arg))) (global-set-key (kbd "M-w") ‘save-region-or-current-line)
你还需要这个
windows-nubering
;;; window-numbering, use M-1 M-2 ... to quick switch window (require ‘window-numbering) (custom-set-faces ‘(window-numbering-face ((t (:foreground "DeepPink" :underline "DeepPink" :weight bold))))) (window-numbering-mode 1)
这个
(require ‘hungry-delete) (global-hungry-delete-mode) (require ‘pangu-spacing) (global-pangu-spacing-mode 1)
还有这个
(require ‘multiple-cursors) (require ‘expand-region)
具体的配置在他们的github上都有说。emacs就是这么容易配置。
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。