免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1005 | 回复: 0
打印 上一主题 下一主题

My .emacs configure [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-10-30 11:16 |只看该作者 |倒序浏览
;;设置一个读取插件的默认路径(add-to-list 'load-path "/home/crazybaby/.emacs.d")
;; (load-file "/usr/local/emacs23/site-lisp/cedet-1.0pre3/common/cedet.el")
;; (semantic-load-enable-code-helpers)
;;(add-to-list 'load-path "/usr/local/emacs23/site-lisp/contrib/xcscope")
;;(require 'xcscope)
;;  (add-to-list 'load-path "/usr/local/emacs23/site-lisp/ecb_2.32")
;; (require 'ecb)
;;选择一个颜色主题
(require 'color-theme)
(color-theme-kingsajz)
;;关闭启动时开机画面
(setq inbibit-startup-message t)
;;字体设置
;;行号
(require 'linum)
(global-linum-mode t)
;;鼠标靠近时自动离开
(mouse-avoidance-mode 'animate)
;;显示时间
(display-time-mode 1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
;;用shift方向进行选择
(pc-selection-mode)
;;设置括号配对功能
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;字体设置
;;查找\打开文件时,列出文件列表 C-X C-F打开
(require 'ido)
(ido-mode t)
;;设置文件的标题栏 显示在emc上面
(require 'tabbar)
(tabbar-mode)
;;标题栏切换的快捷键
(global-set-key [M-up] 'tabbar-backward-group)
(global-set-key [M-down] 'tabbar-forward-group)
(global-set-key [M-left] 'tabbar-backward)
(global-set-key [M-right] 'tabbar-forward)
;;加载了 session 之后菜单上会多两项:最近访问过的文件和最近修改过的文件 
(require 'session)
(add-hook 'after-init-hook 'session-initialize)
;;保存上次打开的文件记录
;;如果session跟desktop配合,下次启动Emacs 的时候,就像根本没有关闭 Emacs 一样
(load "desktop")
(desktop-load-default)
(desktop-read)
;;C-x C-b 那个普通的 buffer menu 换成非常方便的 ibuffer 啦
(require 'ibuffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(setq gdb-many-windows t)
;;...
;;(load-library "multi-gud.el")
;;(load-library "multi-gdb-ui.el")
;;设置快捷键
(global-set-key [f3] 'goto-line)
;;(global-set-key [f4] 'set-mark-command)
(global-set-key [f5] 'compile)
(global-set-key [f6] 'gdb)
(global-set-key [f7] 'bookmark-set)
(global-set-key [f8] 'bookmark-jump)
(global-set-key [f9] 'cvs-update) 
;;定义F12键为激活ecb
(global-set-key [f12] 'ecb-activate) 
(global-set-key [(control tab)] 'switch-to-buffer)
(global-set-key (kbd "M-]") 'comment-dwim)
(global-set-key [delete] 'delete-region)
(global-set-key "%" 'match-paren)
          
(defun match-paren (arg)
  "Go to the matching paren if on a paren; otherwise insert %."
  (interactive "p")
  (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
 ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
 (t (self-insert-command (or arg 1)))))
(global-set-key "%" 'match-paren)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;C/C++
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun linux-cpp-mode ()
"my cpp mode define"
(interactive)
(c-set-style "K&R")
(setq c-basic-offset 4)
(c-toggle-hungry-state)
;(c-toggle-auto-state)
(define-key c++-mode-map [return] 'newline-and-indent) 
)
    
      
(add-hook 'c-mode-hook 'linux-c-mode)
(add-hook 'c++-mode-hook 'linux-cpp-mode)
;; 设置imenu的排序方式为按名称排序
(setq imenu-sort-function 'imenu--sort-by-name)
(defun linux-c-mode()
;; 将回车代替C-j的功能,换行的同时对齐
  (define-key c-mode-map [return] 'newline-and-indent)
;;  (interactive)
;; 设置C程序的对齐风格
  (c-set-style "Stroustrup")
;; 自动模式,在此种模式下当你键入{时,会自动根据你设置的对齐风格对齐
;;   (c-toggle-auto-state)
;; 此模式下,当按Backspace时会删除最多的空格,使得if缩进正常
  (c-toggle-hungry-state)
;; TAB键的宽度设置为4
  (setq c-basic-offset 4)
;; 在菜单中加入当前Buffer的函数索引
  (imenu-add-menubar-index)
;; 在状态条上显示当前光标在哪个函数体内部
  (which-function-mode)
 )
(defun geosoft-backward-word ()
   ;; Move one word backward. Leave the pointer at start of word
   ;; Treat _ as part of word
   (interactive)
   (backward-word 1)
   (backward-char 1)
   (cond ((looking-at "_") (geosoft-backward-word))
         (t (forward-char 1)))) 
(setq default-directory "/home/crazybaby")
(setq-default indent-tabs-mode nil)
(setq nxml-child-indent 4)
(global-auto-revert-mode t);
(tool-bar-mode nil);
;;(setq c-default-style
;;          '((c-mode . "Stroustrup")))
(setq-default tab-width 4)
(setq c-basic-offset 4)
(setq default-fill-column 80)
(setq column-number-mode t)
(setq make-backup-files nil)
(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.
 '(inhibit-startup-screen t))
(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.
 )

        文件:.emacs.d.tar.gz大小:210KB下载:
下载
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/105228/showart_2082677.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP