Chinaunix首页 | 论坛 | 博客
  • 博客访问: 418308
  • 博文数量: 114
  • 博客积分: 3361
  • 博客等级: 中校
  • 技术积分: 1060
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-18 13:14
文章分类

全部博文(114)

文章存档

2012年(1)

2011年(84)

2010年(29)

分类: LINUX

2011-02-23 08:59:38

今天重新系统,不小心把emacs配置文件弄丢了,只得重新来过

1. 首先中文输入
使用 ibus.el
 - 安装python-xlib
  1. sudo apt-get install python-xlib
 - 配置文件
  1. (add-to-list 'load-path "~/.emacs.d/site-lisp/ibus-el-0.2.1")
  2. (require 'ibus)
  3. ;; Turn on ibus-mode automatically after loading .emacs
  4. (add-hook 'after-init-hook 'ibus-mode-on)
  5. ;; Use C-SPC for Set Mark command
  6. (ibus-define-common-key ?\C-\s nil)
  7. ;; Use C-/ for Undo command
  8. (ibus-define-common-key ?\C-/ nil)
  9. ;; Change cursor color depending on IBus status
  10. (setq ibus-cursor-color '("red" "blue" "limegreen"))
  11. ;; Use s-SPC to toggle input status
  12. (global-set-key (kbd "s-SPC") 'ibus-toggle)
现在,按 super+space 可以输入中文了

2. 保存桌面环境
使用 desktop.el ,这个emacs23自带
  1. (desktop-save-mode 1)

3. buffer管理
使用 ibuffer.el ,这个也是emacs23自带
  1. (global-set-key (kbd "C-x C-b") 'ibuffer)
  2. (autoload 'ibuffer "ibuffer" "List buffers." t)
ibuffer.el介绍:

4. tab设置

先设置tab长度为4:
  1. (setq default-tab-width 4)
使用 smart-tab.el ,参考:
================================================
因有工作任务,用到哪里配置哪里吧,持续更新中~~



不做解释,先贴出来

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;;; ibus.el
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4. (add-to-list 'load-path "~/.emacs.d/site-lisp/ibus-el-0.2.1")
  5. (require 'ibus)
  6. ;; Turn on ibus-mode automatically after loading .emacs
  7. (add-hook 'after-init-hook 'ibus-mode-on)
  8. ;; Use C-SPC for Set Mark command
  9. (ibus-define-common-key ?\C-\s nil)
  10. ;; Use C-/ for Undo command
  11. (ibus-define-common-key ?\C-/ nil)
  12. ;; Change cursor color depending on IBus status
  13. (setq ibus-cursor-color '("red" "blue" "limegreen"))
  14. ;; Use s-SPC to toggle input status
  15. (global-set-key (kbd "s-SPC") 'ibus-toggle)
  16. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  17. ;;;; desktop.el
  18. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  19. (desktop-save-mode 1)
  20. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  21. ;;;; ibuffer.el
  22. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  23. (global-set-key (kbd "C-x C-b") 'ibuffer)
  24. (autoload 'ibuffer "ibuffer" "List buffers." t)
  25. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  26. ;;;; general
  27. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  28. ;; 设置tab为4个宽度
  29. (setq-default tab-width 4)
  30. (setq tab-width 4)
  31. ;;去掉工具栏
  32. ;; hide tool-bar
  33. (tool-bar-mode nil)
  34. ;;设置菜单栏
  35. ;; hide menu-bar
  36. (menu-bar-mode nil)
  37. ;; 回答的 yes/no用 y/n來代替
  38. ;; answer y/n instand of yes/no
  39. (fset 'yes-or-no-p 'y-or-n-p)
  40. ;; 不產生臨時備份文件
  41. ;; never make backup files
  42. (setq-default make-backup-files nil)
  43. ;; 默認模式為文本 : text
  44. ;; set default majar mode to "text-mode", not fundamental
  45. (setq-default major-mode 'text-mode)
  46. ;; 關閉 emacs啟動時候提示信息
  47. ;; never show startup message
  48. (setq inhibit-startup-message t)
  49. ;; 去掉滾動條
  50. ;; donot show scroll bar
  51. (scroll-bar-mode nil)
  52. ;; 狀態欄裏面顯示時間
  53. (setq display-time-day-and-date t)
  54. (setq display-time-24hr-format t)
  55. (setq display-time-format "%Y-%m-%d %H:%M:%S")
  56. (display-time)
  57. ;; 顯示行列信息
  58. (setq column-number-mode t)
  59. (setq line-number-mode t)
  60. ;;(require 'display-line-number)
  61. ;;(global-display-line-number-mode 1)
  62. ;;(setq display-line-number-format "%4d|")
  63. ;;设置显示行号
  64. (global-linum-mode nil)
  65. ;; 高亮顯示選擇區域
  66. (setq-default transient-mark-mod t)
  67. (transient-mark-mode t)
  68. ;; 高量顯示括號匹配,括号匹配时显示另外一边的括号,而不是烦人的跳到另一个括号。
  69. (show-paren-mode t)
  70. (setq show-paren-highlihgt-openparen t)
  71. (setq show-paren-style 'parenthesis)
  72. ;; 自動載入圖片
  73. (auto-image-file-mode t)
  74. ;; 80個字符自動換行
  75. ;;(setq default-fill-column 80)
  76. ;; 標題名字
  77. (setq frame-title-format "神之编辑@%b")
  78. ;(setq frame-title-format "神的编辑器@%b %f")
  79. ;; tab鍵
  80. ;; in some mode, tab is define to do other thing
  81. (global-set-key[C-tab] "\C-q\t")
  82. ;; emacs 啟動占 CPU巨高解決方案
  83. (setq semantic-idle-scheduler-idle-time 432000)
  84. ;光标靠近鼠标指针时,让鼠标指针自动让开,别挡住视线。很好玩阿,这个功能
  85. (mouse-avoidance-mode 'animate)
  86. ;支持emacs和外部程序的粘贴
  87. (setq x-select-enable-clipboard t)
  88. ;不要在鼠标点击的那个地方插入剪贴板内容。我不喜欢那样,经常把 我的文档搞的一团糟。我觉得先用光标定位,然后鼠标中键点击要好 的多。不管你的光标在文档的那个位置,或是在 minibuffer,鼠标 中键一点击,X selection 的内容就被插入到那个位置。
  89. (setq mouse-yank-at-point t)
  90. ;用一个很大的 kill ring. 这样防止我不小心删掉重要的东西。我很 努莽的,你知道 :P
  91. (setq kill-ring-max 200)
  92. ;设置有用的个人信息。这在很多地方有用。
  93. ;Personal information
  94. (setq user-full-name "Wang Chengyi")
  95. (setq user-mail-address "alarfurrow@gmail.com")
  96. ;防止页面滚动时跳动, scroll-margin 3 可以在靠近屏幕边沿3行时就开始滚动,可以很好的看到上下文。
  97. (setq scroll-margin 3
  98. scroll-conservatively 10000)
  99. ;设置 sentence-end 可以识别中文标点。不用在 fill 时在句号后插 入两个空格。
  100. (setq sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
  101. (setq sentence-end-double-space nil)
  102. ;;Font
  103. ;(set-default-font "10x20")
  104. ;;设置中文语言环境
  105. ;;(set-language-environment 'Chinese-GB)
  106. ;;写文件的编码方式
  107. ;;(set-buffer-file-coding-system 'gb2312)
  108. (set-buffer-file-coding-system 'utf-8)
  109. ;;新建文件的编码方式
  110. ;;(setq default-buffer-file-coding-system 'gb2312)
  111. (setq default-buffer-file-coding-system 'utf-8)
  112. ;;终端方式的编码方式
  113. (set-terminal-coding-system 'utf-8)
  114. ;;键盘输入的编码方式
  115. ;;(set-keyboard-coding-system 'gb2312)
  116. ;;读取或写入文件名的编码方式
  117. (setq file-name-coding-system 'utf-8)
  118. ;;语法高亮,默认禁止的设置
  119. (global-font-lock-mode t)
  120. (put 'set-goal-column 'disabled nil)
  121. (put 'narrow-to-region 'disabled nil)
  122. (put 'upcase-region 'disabled nil)
  123. (put 'downcase-region 'disabled nil)
  124. (put 'LaTeX-hide-environment 'disabled nil)
  125. ;;按f11让Emacs进入全屏显示
  126. ;;参考: <
  127. (defun toggle-fullscreen (&optional f)
  128. (interactive)
  129. (let ((current-value (frame-parameter nil 'fullscreen)))
  130. (set-frame-parameter nil 'fullscreen
  131. (if (equal 'fullboth current-value)
  132. (if (boundp 'old-fullscreen) old-fullscreen nil)
  133. (progn (setq old-fullscreen current-value)
  134. 'fullboth)))))
  135. (global-set-key [f11] 'toggle-fullscreen)
  136. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  137. ;;;; muse.el
  138. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  139. (add-to-list 'load-path "~/.emacs.d/site-lisp/muse-3.20/lisp")
  140. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  141. ;;;; color setting
  142. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  143. ;; 指针颜色设置为白色
  144. ;;(set-cursor-color "white")
  145. ;; 鼠标颜色设置为白色
  146. ;;(set-mouse-color "white")
  147. ;; 设置背景颜色和字体颜色
  148. ;(set-foreground-color "white")
  149. ;(set-background-color "darkblue")
  150. ;; 设置另外一些颜色:语法高亮显示的背景和主题,区域选择的背景和主题,二次选择的背景和选择
  151. ;(set-face-foreground 'highlight "white")
  152. ;(set-face-background 'highlight "blue")
  153. ;(set-face-foreground 'region "cyan")
  154. ;(set-face-background 'region "blue")
  155. ;(set-face-foreground 'secondary-selection "skyblue")
  156. ;(set-face-background 'secondary-selection "darkblue")
  157. ;;设置日历的一些颜色
  158. ;(setq calendar-load-hook
  159. ;'(lambda ()
  160. ;(set-face-foreground 'diary-face "skyblue")
  161. ;(set-face-background 'holiday-face "slate blue")
  162. ;(set-face-foreground 'holiday-face "white")))
  163. ;(load-file “C:/Program Files/Emacs/color-theme.el”)
  164. ;(color-theme-blue-mood);选择 darkblue的配色方案
  165. ;(load-file “C:/Program Files/Emacs/fontset-win.el”)
  166. ;(load “fontset-win”)
  167. ;(huangq-fontset-monaco 11)
  168. (add-to-list 'load-path "~/.emacs.d/site-lisp/color-theme-6.6.0")
  169. (require 'color-theme)
  170. ;; ;; ;; ;; ;;
  171. (defun insert-comment-trac ()
  172. "插入trac的xml注释"
  173. (interactive)
  174. (insert "{{{
  175. #!xml
  176. }}}"))
  177. (global-set-key (kbd "C-}") 'insert-comment-trac)
  178. (defun insert-comment-trac-2 ()
  179. (interactive)(insert "{{{}}}"))
  180. (global-set-key (kbd "C-{") 'insert-comment-trac-2)
  181. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  182. ;;;; trac-wiki
  183. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  184. (add-to-list 'load-path "~/.emacs.d/site-lisp/trac-wiki")
  185. (require 'trac-wiki)
  186. ;(autoload 'trac-wiki "trac-wiki"
  187. ; "Trac wiki editing entry-point." t)
  188. ;; ou
  189. ;(add-to-list 'load-path "~/.emacs.d/site-lisp/trac")
  190. ;(require 'trac)
阅读(1454) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~