Emacs Configuration

~/.Xresources

Xft.antialias: 1
# 可以尝试把hinting关了对比效果,有些显示器上不开反而更好看
Xft.hinting: 1
Xft.hintstyle: hintfull 
Xft.rgba: rgb

Emacs.FontBackend: xft
Emacs.Geometry: 100x32+4+4

执行xrdb ~/.Xresources例配置生效

~/.emacs

General Configurations

;; personal information
;;
(setq user-full-name "Jarod Liu")
(setq user-mail-address "liuyuanzhi(at)gmail.com")

;; custom loadpath
;;
(if (fboundp 'normal-top-level-add-subdirs-to-load-path)
    (let* ((my-lisp-dir "/home/jarod/.myemacs/")
           (default-directory my-lisp-dir))
      (setq load-path (cons my-lisp-dir load-path))
      (normal-top-level-add-subdirs-to-load-path)))

;; font settings for better CJK support
;;
(set-default-font "Monospace-14")
(set-fontset-font (frame-parameter nil 'font)
          'unicode '("Microsoft YaHei" . "unicode-bmp")) 
(set-fontset-font (frame-parameter nil 'font)
          'han '("Microsoft YaHei" . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
          'symbol '("Microsoft YaHei"  . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
          'cjk-misc '("Microsoft YaHei"  . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
          'bopomofo '("Microsoft YaHei"  . "unicode-bmp")) 

;; document default encoding (UTF-8)
;;
(setq current-language-environment "UTF-8")
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(setq default-input-method "chinese-py")

;; lanuch server for emacsclient
;;
(server-start)

;; custom key binding
;;
(global-set-key [f1] 'shell);F1进入Shell 
;(global-set-key (kbd "C-SPC") 'nil);用win+space为set-mark键,留出ctrl+space热键作为输入法
;(global-set-key (kbd "S-SPC") 'set-mark-command)

;;使用习惯配制
;;
(desktop-save-mode 1) ; save buffers
(setq default-major-mode 'text-mode);一打开就起用 text 模式。
(global-font-lock-mode t);语法高亮
(auto-image-file-mode t);打开图片显示功能
(fset 'yes-or-no-p 'y-or-n-p);以 y/n代表 yes/no
(setq default-fill-column 80);默认显示 xx列就换行
(column-number-mode t);显示列号
(show-paren-mode t);显示括号匹配
(setq show-paren-style 'parentheses);括号匹配时显示另外一边的括号,而不是跳到另一个括号
;(display-time-mode 1);显示时间,格式如下
;(setq display-time-24hr-format t)
;(setq display-time-day-and-date t)
(tool-bar-mode nil);去掉工具栏
(scroll-bar-mode nil);去掉滚动条,可以使用鼠标滚轮
(setq scroll-margin 3 scroll-conservatively 10000);防止页面滚动时跳动, scroll-margin 3 可以在靠近屏幕边沿3行时就开始滚动
(mouse-avoidance-mode 'animate);光标靠近鼠标指针时,让鼠标指针自动让开
(setq mouse-yank-at-point t);支持中键粘贴
(transient-mark-mode t);高亮显示要拷贝的区域
(setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value) ;
(setq frame-title-format "%b");在标题栏提示buffer名
(setq-default make-backup-files nil);不要生成临时文件
(setq visible-bell t);关闭烦人的出错时的提示声
(setq inhibit-startup-message t);关闭起动时的那个“开机画面”
(setq kill-ring-max 64);undo number
;; indent
(setq default-tab-width 4);;    设置tab为4个空格的宽度
(setq tab-width 4)
(global-set-key "\C-m" 'newline-and-indent)
(global-set-key "\C-j" 'newline);; 交换这两个按键。因为大多数情况下,回车后是要缩进的。

;; auto mode alist
;;
(mapcar
 (function (lambda (setting)
         (setq auto-mode-alist
           (cons setting auto-mode-alist))))
 '(("\\.xml$".  sgml-mode)
   ("\\\.bash" . sh-mode)
   ("\\.rdf$".  sgml-mode)
   ("\\.session" . emacs-lisp-mode)
   ("\\.l$" . c-mode)
   ("\\.css$" . css-mode)
   ("\\.cfm$" . html-mode)
   ("gnus" . emacs-lisp-mode)
   ("\\.idl$" . idl-mode)))

color-theme1

;; color-theme 
;;
(require 'color-theme) 
(color-theme-gnome2)

tarbar2

;; tabbar
;;
(require 'tabbar) 
(tabbar-mode)
;(global-set-key (kbd "") 'tabbar-backward-group)
;(global-set-key (kbd "") 'tabbar-forward-group)
(global-set-key (kbd "C-`") 'tabbar-backward) ;切换TAB的快捷键
(global-set-key (kbd "C-<tab>") 'tabbar-forward)
;(set-face-attribute 'tabbar-default-face nil :family "Tahoma") ;设置tabbar字体

Ruby

;;;; ruby                                                                         
;; based on http://www.rubygarden.org/Ruby/page/show/InstallingEmacsExtensions
;; ruby-elisp
;;
(autoload 'ruby-mode "ruby-mode" "Ruby editing mode." t)
(modify-coding-system-alist 'file "\\.rb$" 'utf-8)
(modify-coding-system-alist 'file "\\.rhtml$" 'utf-8)
(setq auto-mode-alist
      (append '(("\\.rb$" . ruby-mode)) auto-mode-alist))
(setq auto-mode-alist
      (append '(("\\.rhtml$" . ruby-mode)) auto-mode-alist))
(setq interpreter-mode-alist
      (append '(("^#!.*ruby" . ruby-mode))  interpreter-mode-alist))

(autoload 'run-ruby "inf-ruby"
  "Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby"
  "Set local key defs for inf-ruby in ruby-mode")
(add-hook 'ruby-mode-hook
          '(lambda ()
             (inf-ruby-keys)))
;; If you have Emacs 19.2x or older, use rubydb2x                              
(autoload 'rubydb "rubydb3x" "Ruby debugger" t)

Python

;;;; python
;; python-mode
;;
(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))

(add-hook 'python-mode-hook
          (lambda ()
            (set (make-variable-buffer-local 'beginning-of-defun-function)
                 'py-beginning-of-def-or-class)
            (setq outline-regexp "def\\|class ")))
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License