Chinaunix首页 | 论坛 | 博客
  • 博客访问: 533188
  • 博文数量: 174
  • 博客积分: 4177
  • 博客等级: 上校
  • 技术积分: 1827
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-15 14:12
文章分类

全部博文(174)

文章存档

2018年(1)

2017年(1)

2013年(3)

2012年(9)

2010年(12)

2009年(5)

2008年(106)

2007年(37)

我的朋友

分类: LINUX

2007-12-19 20:15:56

;;++++++++++++++++++++++++++++++++++++++++++++++++++++
;;                 外观设置
;;++++++++++++++++++++++++++++++++++++++++++++++++++++
;;  配色方案
(setq default-frame-alist
  '(
       (foreground-color . "Wheat")
    (background-color . "Black")
    (cursor-color     . "Orchid");光标颜色
    ;(mouse-color      . "green");鼠标颜色
   )
)
;(setq frame-background-mode 'dark)
;(set-background-color "Black")
;(set-foreground-color "White")


;; 设置窗口大小
(set-frame-height (selected-frame) 30)
(set-frame-width (selected-frame) 80)

;; 设置字体
;(set-default-font "-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso8859-1")

;;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;;    为了在 Emacs 中能正确显示中文,需要选择和设置中文字体。如果 Emacs 运行在 X 下,可以使用
;; .Xdefault进行配置,也可以写到 .emacs 里面。下面的例子是 .emacs 里配置的方法:
;;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(create-fontset-from-fontset-spec
 "-*-*-medium-r-normal-*-16-*-*-*-*-*-gb2312.1980-*")

(setq default-frame-alist
      (append '((font . "fontset-global")) default-frame-alist))


;;最新版的mule-ucs不自动加载unicode支持,须照此行方法手动载入.
(require 'un-define)  

(set-language-environment 'utf-8)
;;下面几行暂时没有必要加入
;;(setq locale-coding-system 'utf-8)
;;(prefer-coding-system 'utf-8)
;;(set-keyboard-coding-system 'utf-8)
;;(set-terminal-coding-system 'utf-8)
;;(set-selection-coding-system 'utf-8)
;;(set-clipboard-coding-system 'ctext)
;;(set-buffer-file-coding-system 'utf-8)

;;äž­æ–,Gh®Ÿçœ®(B
;(set-language-environment 'Chinese-GB)
;(set-keyboard-coding-system 'chinese-iso-8bit)
;(set-clipboard-coding-system 'chinese-iso-8bit)
;(set-terminal-coding-system 'chinese-iso-8bit)
;(set-buffer-file-coding-system 'chinese-iso-8bit)
;(set-selection-coding-system 'chinese-iso-8bit)
;(modify-coding-system-alist 'process "*" 'chinese-iso-8bit)
;(setq default-process-coding-system
;        '(chinese-iso-8bit .chinese-iso-8bit))
;(setq-default pathname-coding-system 'chinese-iso-8bit)



;; 设置标题栏
(setq frame-title-format "emacs@%b")

;; 菜单栏,滚动条,工具条
;(menu-bar-mode nil)
;(scroll-bar-mode nil)
(setq tool-bar-mode t)

;; 关闭“开机画面”
(setq inhibit-startup-message nil)

;;uncomment this line to disable loading of "default.el" at startup
(setq inhibit-default-init t)

;; 反显选中区域
(transient-mark-mode t)  

;; 进行语法加亮
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
;(setq font-lock-support-mode 'lazy-lock-mode)

;; 设置时间与日期显示方式
(display-time)                      ; Display the time
(setq display-time-24hr-format t)   ; In 24 hour format    
(setq display-time-day-and-date t)
;(setq display-time-interval 30)

;; 显示行号与列号
(setq column-number-mode t)  
(setq line-number-mode t)      
    

;;--------------------------------------------------------------;;
;;                       其它常用设置                            ;;
;;--------------------------------------------------------------;;

;; 把所有模式都设为自动填充模式  
(setq-default auto-fill-function 'do-auto-fill)  ; Autofill in all modes
(setq default-fill-column 72)

;; 自动存盘
(setq auto-save-mode t)

;; 查找与替换时加亮显示
(setq search-highlight t)  
(setq query-replace-highlight t)

;;括号匹配 括号匹配时显示另一端的括号,而不是跳过去
(show-paren-mode t)
(setq show-paren-style 'parentheses)  

;; 打开显示图片
(auto-image-file-mode)

;;不要生成临时文件
(setq-default make-backup-files nil)

;; 用"y"来代替"yes","n"来代替"no"
(fset 'yes-or-no-p 'y-or-n-p)
 
;;允许emacs和外部其他程序的粘贴
(setq x-select-enable-clipboard t)

;;若命令有组合键,则提示该组合键
(setq suggest-key-bindings t)


;;-------------------------------------------------------------;;
;; 一些方便的功能扩展
;;-------------------------------------------------------------;;
;(add-to-list 'load-path "/root/elisp/ext")

;; wb-line-number.el可以在窗口左侧分割出一个显示行号的小窗口
;(add-to-list 'load-path "/home/yk/.emacs.d/extion")
;(set-scroll-bar-mode nil)   ; no scroll bar, even in x-window system (recommended)
;(require 'wb-line-number)
;(wb-line-number-toggle)

;;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;;                            编码自动识别
;;      中文用户最头疼的问题就是乱码(其实其他非英语语言也一样)。乱码的原因基本上就是两个:
;;   字体和编码。
;;      东亚语言的编码系统尤其复杂,和汉语相关的就有 gbk, gb18030, big5, euc-tw, utf-8,
;;   utf-16le,utf-16be 等多种。编码问题不应该让用户来操心,而应该由编辑器、浏览器自行解决。
;;
;;      Unicad 就是就是基于这种想法设计的。Unicad 可以帮助 Emacs 猜测正确的编码,并且在打
;;  开文件的时候自动应用,完全不需要用户操心,而且编码识别的正确率非常高,适用的语言包括中文,
;;  日文,韩文,希腊语,俄语,保加利亚语,西欧语言,中欧语言。
;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(add-to-list 'load-path "~/.emacs.d/extension")
(require 'unicad)


;;五笔输入法的设置
(add-to-list 'load-path "~/.emacs.d/extension/wubi")
(require 'wubi)
(wubi-load-local-phrases) ; add user's Wubi phrases
(register-input-method
 "chinese-wubi" "Chinese-GB" 'quail-use-package
 "WuBi" "WuBi"
 "wubi")
(if (< emacs-major-version 21)
    (setup-chinese-gb-environment)
  (set-language-environment 'Chinese-GB))
(setq default-input-method "chinese-wubi")


;;----------------------------------------------------------------
;; 常用命令的键帮定
;;----------------------------------------------------------------
;; 功能键绑定
(global-set-key [f1] 'manual-entry)
(global-set-key [f2] 'info)
(global-set-key [f3] 'repeat-complex-command)
(global-set-key [f4] 'advertised-undo)
(global-set-key [f5] 'eval-current-buffer)
(global-set-key [f6] 'buffer-menu)
(global-set-key [f7] 'other-window)
(global-set-key [f8] 'find-file)
(global-set-key [f9] 'save-buffer)
(global-set-key [f10] 'next-error)
(global-set-key [f11] 'compile)
(global-set-key [f12] 'grep)
(global-set-key [C-f1] 'compile)
(global-set-key [C-f2] 'grep)
(global-set-key [C-f3] 'next-error)
(global-set-key [C-f4] 'previous-error)
(global-set-key [C-f5] 'display-faces)
(global-set-key [C-f8] 'dired)
(global-set-key [C-f10] 'kill-compilation)

;; ALT按键绑定 Meta
(global-set-key "\M- " 'set-mark-command)
(global-set-key "\M-\C-h" 'backward-kill-word)
(global-set-key "\M-\C-r" 'query-replace)
(global-set-key "\M-r" 'replace-string)
(global-set-key "\M-g" 'goto-line)
(global-set-key "\M-h" 'help-command)

;; 方向按键绑定 Keypad bindings
(global-set-key [up] "\C-p")
(global-set-key [down] "\C-n")
(global-set-key [left] "\C-b")
(global-set-key [right] "\C-f")
(global-set-key [home] "\C-a")
(global-set-key [end] "\C-e")
(global-set-key [prior] "\M-v")
(global-set-key [next] "\C-v")
(global-set-key [C-up] "\M-\C-b")
(global-set-key [C-down] "\M-\C-f")
(global-set-key [C-left] "\M-b")
(global-set-key [C-right] "\M-f")
(global-set-key [C-home] "\M-<")
(global-set-key [C-end] "\M->")
(global-set-key [C-prior] "\M-<")
(global-set-key [C-next] "\M->")

;;取消同时按下"ESC ESC"与"C-x C-u"
(global-unset-key "\e\e")
(global-unset-key "\C-x\C-u")

(defvar first-time t
"Flag signifying this is the first time that .emacs has been evaled")

;;---------------------------------------------------------------------
;;                      各种模式的设置                               ;;
;;---------------------------------------------------------------------
;;                  文本模式与自动填充模式
;;   下面的两行告诉Emacs,当找到一个文件时就开启文本模式,除非那个文件应当
;;    进入别的模式,如C模式等
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)

;;                 Mail Mode
;; To enter mail mode ,type "C-x m"
;; To enter RMAIL (for reading mail),type "M-x rmail"
(setq mail-aliases t)

;; 缩排模式
;; Prevent Extraneous Tabs
;(setq-default indent-tabs-mode nil)

;; 临时标记模式
;; 反显选中区域
(transient-mark-mode t)
;(setq-default transient-mark-mode t)

阅读(905) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~