Xiaopei's DokuWiki

These are the good times in your life,
so put on a smile and it'll be alright

User Tools

Site Tools


it:emacs:start

emacs

打印 ^M 等特殊字符:'C-q C-m'(按住 C)

elisp

2013 的 emacs

github 上 emacs 相关比较火的有 emacs-starter-kit. v2 应该是全包类型的一套配置, 但最新版 v3 已“自废武功”或是说“无招胜有招”, 作者提倡自己找库组成自己的 emacs 配置.

emacs 24 后, 可用 package- 系列命令安装包. 包有以下源. 具体使用见 ELPA - EmacsWiki:

重写 emacs 配置的工程太大了, 现在用 MELPA 安装很方便

;; 使用 melpa 源
;; ~/.emacs.d/package.el
(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/") t)
(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)
 
;; 之后查看包及安装可用
; M-x package-list-packages

我现在使用的包括:

  dokuwiki-mode      20140130.936 installed  Major mode for DokuWiki document
  jade-mode          20131018.... installed  Major mode for editing .jade files
  js2-mode           20140405.... installed  Improved JavaScript editing mode
  markdown-mode      20131210.700 installed  Emacs Major mode for Markdown-formatted text files
  web-beautify       20131118.226 installed  Format HTML, CSS and JavaScript/JSON by js-beautify
  yaml-mode          20130310.... installed  Major mode for editing YAML files

DokuWiki Administrator 2014/05/01 14:41

tips

  • 匹配数字、匹配 group
    ^\([0-9]\) ; 将数字开头的,如 1
      \1       ; 增加缩进,  1
  • 正则表达式非贪婪(non-greedy)匹配
    ^.*: # 贪婪匹配行首到最后一个 : 
    ^.*?: # 非贪婪匹配行首到第一个 :
  • 正则表达式使用 group
    # 若想用 [[ ... ]] 替换 [ ... ]
    # 如 [ -d $dir ] -> [[ -d $dir ]]
    
    # 可用此正则替换
    \[\(.*?\)\] -> [[\1]] 
  • There are also commands to convert tabs to spaces or vice versa, always preserving the columns of all non-whitespace text. M-x tabify scans the region for sequences of spaces, and converts sequences of at least two spaces to tabs if that can be done without changing indentation. M-x untabify changes all tabs in the region to appropriate numbers of spaces. — Just Spaces - GNU Emacs Manual
  • 调整字体字号 font size: C-x C-+ and C-x C– to increase or decrease the buffer text size

常用功能

书签

书签是支持tramp的!

函数快捷键作用
bookmark-setC-x r m写(m for mark)
bookmark-bmenu-listC-x r l列表(l for list)

.el

ibus-mode

需要安装 python-xlib

magit

Troubleshooting

如果出现以下状况:

Head:   [33md47a03d[m my last commit message

则需要设置 git:

$ git config --global color.diff true

参考

TRAMP

Transparent Remote Access, Multiple Protocols

Quick-start tramp configuration

(setq tramp-default-method "ssh")

Usage

C-x C-f /remotehost:filename  RET (or /method:user@remotehost#port:filename)

参考

dunnet

it/emacs/start.txt · Last modified: 2017/03/13 18:22 by admin