快捷键
切换缓冲区: C-X B
关闭窗口/缓冲区: C-X K
打开shell/eshell: M-X shell/eshell
新建表格:M-X table-insert
查看当前字体: M-X describe-font
放大字体:C-X C-+
使配置文件立即生效(打开.emacs的情况下): M-X eval-buffer
重新从硬盘上载入文件:M-X revert-buffer
GDB: M-X gdb
命令
安装软件包:M-X el-get-install
el-get的安装
切换至scratch缓冲区,输入以下代码,按C-J,
(url-retrieve
“https://raw.githubusercontent.com/dimitri/el-get/master/el-get-install.el”
(lambda (s)
(end-of-buffer)
(eval-print-last-sexp)))
详细参见:https://github.com/dimitri/el-get
常用包的安装
sudo apt-get install:
- bzr
M-X el-get-install:
- color-theme
- color-theme-almost-monokai
- tabbar
- cedet
- ecb (http://www.cnblogs.com/wangkangluo1/archive/2011/07/25/2116306.html)
- bazaar
- emacs-for-python:https://github.com/gabrielelanaro/emacs-for-python
常见问题
- table模式下,中英文混杂时表格错乱: http://alpha-blog.wanglianghome.org/2010/06/29/align-orgmode-table/ 或者 http://www.cnblogs.com/bamanzi/p/org-mode-tips.html
- ecb 和cedet版本不匹配: http://www.cnblogs.com/machine/archive/2012/11/20/2779621.html
- tabbar在安装了cedet后,某些buffer不显示tabbar:见配置文件
- el-get安装python-mode失败,提示The command named ‘bzr’ can not be found with `executable-find’, 需先安装bzr, 使用apt-get 安装
- emacs全屏:使用 emacs -fs 运行。
配置过程
安装el-get
配置el-get, 具体见https://github.com/dimitri/el-get
通过el-get下载需要用到的软件包
配置文件
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;el-get
;;(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
;;(unless (require 'el-get nil 'noerror)
;; (with-current-buffer
;; (url-retrieve-synchronously
;; "https://raw.githubusercontent.com/dimitri/el-get/master/el-get-install.el")
;;(goto-char (point-max))
;;(eval-print-last-sexp)))
;;(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")
;;(el-get 'sync)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/.emacs.d/el-get/bazaar")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;color theme
(add-to-list 'load-path "~/.emacs.d/el-get/color-theme")
(require 'color-theme)
(add-to-list 'load-path "~/.emacs.d/el-get/color-theme-solarized")
(require 'color-theme-solarized)
(color-theme-solarized)
(add-to-list 'load-path "~/.emacs.d/el-get/color-theme-almost-monokai")
(require 'color-theme-almost-monokai)
;;(color-theme-calm-forest)
;;(color-theme-almost-monokai)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;set font and make table a good look
(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.
'(default ((t (:inherit nil :stipple nil :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :pixelsize 13 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))
(if (and (fboundp 'daemonp) (daemonp))
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(set-fontset-font "fontset-default" 'chinese-gbk "WenQuanYi Micro Hei Mono 12"))))
(set-fontset-font "fontset-default" 'chinese-gbk "WenQuanYi Micro Hei Mono 12"))
(defun wl-org-column-view-uses-fixed-width-face ()
;; copy from org-faces.el
(when (fboundp 'set-face-attribute)
;; Make sure that a fixed-width face is used when we have a column table.
(set-face-attribute 'org-column nil
:height (face-attribute 'default :height)
:family (face-attribute 'default :family))))
(when (and (fboundp 'daemonp) (daemonp))
(add-hook 'org-mode-hook 'wl-org-column-view-uses-fixed-width-face))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;cedet
;;cedet if you use 1.1 the version check will turn out to be error
(load-file "~/.emacs.d/cedet-1.1/common/cedet.el")
(global-ede-mode 1)
;;(semantic-load-enable-gaudy-code-helpers)
;;这一行打开会使得tabbar在某些buffer不可见,原因未知
(global-srecode-minor-mode 1)
;;ecb
;;;;ecb
(add-to-list 'load-path "~/.emacs.d/ecb-2.40") ;你的ecb解压目录
(require 'ecb)
(require 'ecb-autoloads)
(global-set-key (kbd "<f7>") 'ecb-minor-mode) ; 打开ejb
;;;;ejb 快捷键
(global-set-key (kbd "C-M-<left>") 'windmove-left) ;左边窗口
(global-set-key (kbd "C-M-<right>") 'windmove-right) ;右边窗口
(global-set-key (kbd "C-M-<up>") 'windmove-up) ; 上边窗口
(global-set-key (kbd "C-M-<down>") 'windmove-down) ; 下边窗口
;;ecb error
(setq stack-trace-on-error t)
;; 自动启动ecb,关闭每日提示
;;(setq ecb-auto-activate t ecb-tip-of-the-day nil)
;; 设置窗口的宽度,15%
(setq ecb-windows-width 0.2)
;; 在目录窗口显示文件
(setq ecb-show-sources-in-directories-buffer 'always)
;;(setq ecb-compile-window-height 12)
;;(setq ecb-show-sources-in-directories-buffer 'always)
(setq ecb-layout-name 'left15)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;tabbar
(add-to-list 'load-path "~/.emacs.d/el-get/tabbar")
(require 'tabbar)
(tabbar-mode)
;;set tabbar <- -> keys
(global-set-key [(meta j)] 'tabbar-backward)
(global-set-key [(meta k)] 'tabbar-forward)
;;set main&misc group
;;tabbar -- release that if you do not show *buffername*
;;(setq tabbar-buffer-list-function
;; (lambda ()
;; (remove-if
;; (lambda(buffer)
;; (find (aref (buffer-name buffer) 0) " *"))
;; (buffer-list))))
(setq tabbar-buffer-groups-function
(lambda()(list "All")))
(set-face-attribute 'tabbar-button nil)
;;color-theme-solarized的tabbar配色和其他的不太一样,似乎是反过来的,需要注意
;;set tabbar's backgroud color
(set-face-attribute 'tabbar-default nil
:family "DejaVu Sans Mono"
:background "gray"
:foreground "gray")
(set-face-attribute 'tabbar-selected nil
:family "DejaVu Sans Mono"
:inherit 'tabbar-default
:foreground "#00CD66"
:background "black"
:box '(:line-width 2 :color "#00CD66")
)
(set-face-attribute 'tabbar-unselected nil
:family "DejaVu Sans Mono"
:inherit 'tabbar-default
:foreground "gray"
:background "black"
:box '(:line-width 3 :color "gray")
)
;; USEFUL: set tabbar's separator gap && no tool bar no tool tip
(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.
'(ecb-layout-name "left15")
'(ecb-options-version "2.40")
'(scroll-bar-mode nil)
'(tabbar-separator (quote (1.5)))
'(tool-bar-mode nil)
'(tooltip-mode nil))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;python-all
(load-file "~/.emacs.d/emacs-for-python-master/epy-init.el")
(require 'epy-setup) ;; It will setup other loads, it is required!
(require 'epy-python) ;; If you want the python facilities [optional]
(require 'epy-completion) ;; If you want the autocompletion settings [optional]
(require 'epy-editing) ;; For configurations related to editing [optional]
(require 'epy-bindings) ;; For my suggested keybindings [optional]
(require 'epy-nose) ;; For nose integration
(epy-setup-checker "pyflakes %f")
;;(epy-django-snippets)
(epy-setup-ipython)
(require 'highlight-indentation)
(add-hook 'python-mode-hook 'highlight-indentation)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; tmp & backup file manage
;; all backups goto ~/.backups instead in the current directory
(setq backup-directory-alist (quote (("." . "~/.backups"))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;set full screen
;;(custom-set-variables
;; '(initial-frame-alist (quote ((fullscreen . maximized)))))