Chinaunix首页 | 论坛 | 博客
  • 博客访问: 448140
  • 博文数量: 88
  • 博客积分: 2677
  • 博客等级: 少校
  • 技术积分: 893
  • 用 户 组: 普通用户
  • 注册时间: 2009-06-13 08:01
文章分类

全部博文(88)

文章存档

2017年(3)

2016年(1)

2012年(4)

2011年(4)

2010年(57)

2009年(19)

我的朋友

分类: LINUX

2010-01-08 22:28:46


; Last-Update: < File [.emacs] modified by Liangbo on 2010.01.23 >
; Last-Update: < File [.emacs] modified by Liangbo on 2010.01.26 >
; Last-Update: < File [.emacs] modified by Liangbo on 2010.01.27 >
; Last-Update: < File [.emacs] modified by Liangbo on 2010.03.31 >
; Last-Update: < File [.emacs] modified by Liangbo on 2010.04.23 >
; Last-Update: < File [.emacs] modified by Liangbo on 2010.09.15 >
; Last-Update: < File [.emacs] modified by Liangbo on 2010.11.10 >

 
;
(add-to-list 'load-path "/home/diga/.emacsLoadpath")

(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.
 '(column-number-mode t)
 '(current-language-environment "Japanese")
 '(display-time-mode t)
 '(ecb-layout-window-sizes nil)
 '(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2))
 '(inhibit-startup-screen t)
 '(line-number-mode nil)
 '(show-paren-mode t)
 '(size-indication-mode t)
 '(text-mode-hook (quote (text-mode-hook-identify))))

;emacs shell messy code
;(setq ansi-color-for-comint-mode t)
(global-set-key [(f2)] 'ansi-term);F2通过ansi-term打开shell

;Time-stamp 设定文档上次保存的信息-------------------------
;需在文档的前8行中加入关键字如: Time-stamp: <> 或 Time-stamp: "",便会自动保存时间戳
(setq time-stamp-active t) ;更新timestamps
(setq time-stamp-warn-inactive t); warn if unable
;设置time-stamp的格式
;当前使用的系统用户名[%u] ;当前的操作系统名[%s]
;星期几[%:a] ;当前时刻%02H : %02M : %02S
;(setq time-stamp-format " File [%f] modified by Liangbo on %:a, %:y.%02m.%02d at %02H : %02M : %02S on %s ")
(setq-default time-stamp-start "\\(\\([Ll]ast-?[Uu]pdate\\)\\|\\([Tt]ime-?[Ss]tamp\\)\\): [^A-Za-z0-9: -\"']?[<\"'][^<>A-Za-z0-9: -\"']?")
(setq-default time-stamp-format " File [%f] modified by Liangbo on %:y.%02m.%02d ")
(setq-default time-stamp-end "\\\\?[^<>A-Za-z0-9: -\"']?[>\"'][^A-Za-z0-9: -\"']?")
(add-hook 'write-file-hooks 'time-stamp);;保存动作时更新时间戳
;-------------------------------------------------------

(setq default-tab-width 4) ;;设置TAB宽度为4
;;以下设置缩进
(setq c-indent-level 4)
(setq c-continued-statement-offset 4)
(setq c-brace-offset -4)
(setq c-argdecl-indent 4)
(setq c-label-offset -4)
(setq c-basic-offset 4)
(global-set-key "\C-m" 'reindent-then-newline-and-indent)
(setq indent-tabs-mode nil)
(setq standard-indent 4)
;(setq default-directory "~/videopf01/root/usr/src/") ;;设置默认工作目录
;(setq default-directory "~/work/newpf/root/usr/src/") ;;设置默认工作目录
;(setq default-directory (getenv "EMACS_DEFAULT_DIR")) ;;读取bash中的自定义变量作为默认工作目录
(if (getenv "EMACS_DEFAULT_DIR")
    (setq default-directory (getenv "EMACS_DEFAULT_DIR")))

;;关闭开启画面
(setq inhibit-startup-message t)
(setq indent-tabs-mode t)

(setq visible-bell t);关闭出错时的蜂鸣提示声
;(mouse-avoidance-mode'animate);当鼠标箭头与光标相近时,使鼠标箭头自动移开
;(blink-cursor-mode nil);光标不闪烁
(setq-default cursor-type 'bar);光标显示为一竖线
(tool-bar-mode -1);; 不显示emcas的工具栏
;(menu-bar-mode -1);; 不显示emcas的菜单栏,按ctrl+鼠标右键仍能调出该菜单
(setq x-select-enable-clipboard t);; 支持emacs和外部程序之间进行粘贴
(fset 'yes-or-no-p 'y-or-n-p);以 'y/n'字样代替原默认的'yes/no'字样
;(setq frame-title-format "%b");在最上方的标题栏显示当前buffer的名字
(setq frame-title-format "%f")
(setq make-backup-files nil);关闭自动备份功能
(setq auto-save-mode nil);关闭自动保存模式
(setq auto-save-default nil);不生成名为#filename# 的临时文件
(setq require-final-newline t);; 自动的在当前的buffer文件的最后加一个空行
(global-set-key "\r" 'align-newline-and-indent);;自动缩进变为
(setq echo-keystrokes 0.1);; 尽快显示按键序列
(global-font-lock-mode t);; 语法高亮
;; 用来显示当前光标在哪个函数
;(require 'which-func)
(which-func-mode 1)
(setq which-func-unknown "unknown")
;; 用M-x执行某个命令的时候,在输入的同时给出可选的命令名提示
(icomplete-mode 1)
(define-key minibuffer-local-completion-map (kbd "SPC") 'minibuffer-complete-word)

(global-hl-line-mode 1);;高亮当前行
(global-auto-revert-mode t);;在外部更新了文件后,自动更新

(require 'uniquify)
(setq uniquify-buffer-name-style 'forward);父目录/buffer名,显示同名buffer

;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

;###启动时最大化####
(require 'maxframe)
(add-hook 'window-setup-hook 'maximize-frame t)
;下载maxframe.el并放置在
;http://emacsblog.org/2007/02/22/maximize-on-startup-part-2/
;###启动时最大化^^^^


;###web方式显示行号####
(set-scroll-bar-mode 'right);滚动条在右侧
;(set-scroll-bar-mode nil)   ; 不显示滚动条, even in x-window system (recommended)
;(require 'wb-line-number)
;(wb-line-number-toggle)
;" 下载wb-line-number.el并放置在中 "
;" "
;###web方式显示行号^^^^


;###linum.el####
(require 'linum)
(global-linum-mode 1)
;http://blog.chinaunix.net/u3/98822/showart.php?id=2151091
;###linum.el^^^^


;###cc-mode####                
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)
;
;
;###cc-mode^^^^


;###global(GNU GLOBAL source code tag system)####
;to use global from Emacs, you need to load the `gtags    .        el' and execute gtags-mode function in it.
;you need to add it to load-path for `gtags                .        el'file.
;(add-to-list 'load-path "");已经在之前的代码中load完了
(autoload 'gtags-mode "gtags" "" t);;start Emacs and execute gtags-mode function.
(setq c-mode-hook
      '(lambda ()
     (gtags-mode 1)
     ;(gtags-make-complete-list)
     ));get into gtags-mode whenever you get into c-mode
;###global(GNU GLOBAL source code tag system)^^^^


;###cedet(Collection of Emacs Development Environment Tools)####
(load-file "/home/diga/.emacsLoadpath/cedet/common/cedet.el");"读取cedet.el 文件"
(global-ede-mode 1); Enable the Project management system
(semantic-load-enable-code-helpers); Enable prototype help and smart completion
(global-srecode-minor-mode 1); Enable template insertion menu
(global-set-key [(f4)] 'speedbar-get-focus);speedbar快捷键[F4]
;(setq semanticdb-project-roots
;(list
;(expand-file-name "/home/diga/work/newpf/root/usr/src")));;可以设置为项目的顶级目录
;(global-set-key [(control tab)] ' senator-completion-menu-popup)
;(define-key c-mode-base-map [(C-return)] 'semantic-ia-complete-symbol-menu);手动补全ctrl+Enter
(defun my-cedet-hook ()
  (local-set-key [(control return)] 'semantic-ia-complete-symbol)
  (local-set-key "\C-c?" 'semantic-ia-complete-symbol-menu)
  (local-set-key "\C-cd" 'semantic-ia-fast-jump)
  (local-set-key "\C-cr" 'semantic-symref-symbol)
  (local-set-key "\C-cR" 'semantic-symref))
(add-hook 'c-mode-common-hook 'my-cedet-hook)
;或设置为(control tab) or (meta ?/)
;;当遇到.或>时,在另一buffer窗口显示所有其元素
(defun my-c-mode-cedet-hook ()
  (local-set-key "." 'semantic-complete-self-insert)
  (local-set-key ">" 'semantic-complete-self-insert))
(add-hook 'c-mode-common-hook 'my-c-mode-cedet-hook)
;###cedet(Collection of Emacs Development Environment Tools)^^^^



;###ecb(Emacs Code Browser)####
(add-to-list 'load-path
                     "/home/diga/.emacsLoadpath/ecb")
(load-file "/home/diga/.emacsLoadpath/ecb/ecb.el")
(require 'ecb)
(require 'ecb-autoloads)
                    ;(setq ecb-auto-activate t);自动启动ecb
(setq ;ecb-auto-activate t;自动启动ecb
 ecb-tip-of-the-day nil;不显示每日提醒
 ecb-auto-compatibility-check nil;
 ecb-version-check nil;
 )
(global-set-key [f8] 'ecb-activate) ;;定义F8键为激活ecb
(global-set-key [f7] 'ecb-deactivate) ;;定义F7为停止ecb
;;;; 各窗口间切换
(global-set-key [M-left] 'windmove-left)
(global-set-key [M-right] 'windmove-right)
(global-set-key [M-up] 'windmove-up)
(global-set-key [M-down] 'windmove-down)
;;;; 使某一ecb窗口最大化
(define-key global-map "\C-c1" 'ecb-maximize-window-directories)
(define-key global-map "\C-c2" 'ecb-maximize-window-sources)
(define-key global-map "\C-c3" 'ecb-maximize-window-methods)
(define-key global-map "\C-c4" 'ecb-maximize-window-history)
;;;; 恢复原始窗口布局
(define-key global-map "\C-c`" 'ecb-restore-default-window-sizes)
;###ecb(Emacs Code Browser)^^^^


;###doxymacs####
(add-to-list 'load-path "/home/lb/share/emacs/site-lisp/");读取安装el的路径
(require 'doxymacs) ;; 启动doxymacs
;;;注释高亮,针对C和C++程序
(defun my-doxymacs-font-lock-hook ()
  (if (or (eq major-mode 'c-mode) (eq major-mode 'c++-mode))
      (doxymacs-font-lock)))
(add-hook 'font-lock-mode-hook 'my-doxymacs-font-lock-hook)
(doxymacs-mode);doxymacs-mode常true
(global-set-key [(f6)] 'doxymacs-mode);doxymacs-mode快捷键[F6]
(add-hook 'c-mode-common-hook 'doxymacs-mode) ;; 启动doxymacs-mode
(add-hook 'c++-mode-common-hook 'doxymacs-mode) ;; 启动doxymacs-mode
;###doxymacs^^^^


;###GDB####
(global-set-key [(f5)] 'gdb-many-windows);gdb-many-windows快捷键[F5]
(setq gdb-use-separate-io-buffer t) ; 不需要"IO buffer"时,则设为nil
;###GDB^^^^


;###session####
;
;(add-to-list 'load-path "")
;(add-to-list 'load-path "/home/diga/.emacsLoadpath/")
;(require 'session)
;(add-hook 'after-init-hook 'session-initialize);启动时初始化session

;;记录和恢复屏幕
;(load "desktop")
;(desktop-load-default)
;;(desktop-read)
;;desktop自动存盘模式,23需要加
;(desktop-save-mode 1)
;###session^^^^


;###auto compile自动编译####
;" http://blog.chinaunix.net/u3/98822/showart.php?id=2151084 "
(require 'auto-compile)
(setq auto-compile-target-path-regexp-list (list "home/lb" ))
;###auto compile自动编译^^^^


;###hide region代码折叠####
;(add-hook 'c-mode-hook 'hs-minor-mode)
;(add-hook 'c++-mode-hook 'hs-minor-mode)
(require 'hide-region)
(setq hide-region-before-string "[======================该区域已")
(setq hide-region-after-string "被折叠======================]\n")
(global-set-key (kbd "C-,") 'hide-region-hide)
(global-set-key (kbd "C-.") 'hide-region-unhide)
;" "
;###hide region代码折叠^^^^


;###color-theme####
(add-to-list 'load-path "/home/diga/.emacsLoadpath/color-theme-6.6.0")
(require 'color-theme)
(color-theme-initialize)
;(color-theme-pok-wog)
;(color-theme-aalto-dark)
;(color-theme-bharadwaj-slate)
(color-theme-aalto-light)
;(color-theme-white-on-grey)
;(color-theme-robin-hood)
;(color-theme-gray30)
;" "
;###color-theme^^^^



;### auto-complete ####
;" "
;参考其User Manual安装
(add-to-list 'load-path "/home/diga/.emacsLoadpath/auto-complete-1.3.1/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "/home/diga/.emacsLoadpath/auto-complete-1.3.1/ac-dict")
(ac-config-default)
;### auto-complete ^^^^




;###tabbar####
(require 'tabbar)
(tabbar-mode t)
(global-set-key (kbd "") 'tabbar-backward-group)
(global-set-key (kbd "") 'tabbar-forward-group)
(global-set-key (kbd "") 'tabbar-backward)
(global-set-key (kbd "") 'tabbar-forward)
;  使用[Win徽标键 + 方向键],切换tabbarbuffer
;" "
;" Debian also includes tabbar.el in the emacs-goodies-el package. "
;  For非Debian用户" http://blogimg.chinaunix.net/blog/upfile2/100123133751.zip "
;;所有的tab都在一个组中
;(setq tabbar-buffer-groups-function
;          (lambda ()
;            (list "All"))) ;; code by Peter Barabas
;###tabbar^^^^


;;自动补全括号
(defun my-c-mode-auto-pair ()
  (interactive)
  (make-local-variable 'skeleton-pair-alist)
  (setq skeleton-pair-alist  '(
                   (?` ?` _ "''")
                   (?\( _ ")")
                   (?\[  _ "]")
                   (?{ \n > _ \n ?} >)
                   (?\" _ "\"")))
  (setq skeleton-pair t)
  (local-set-key (kbd "(") 'skeleton-pair-insert-maybe)
  (local-set-key (kbd "{") 'skeleton-pair-insert-maybe)
  (local-set-key (kbd "'") 'skeleton-pair-insert-maybe)
  (local-set-key (kbd "[") 'skeleton-pair-insert-maybe)
  (local-set-key (kbd "\"") 'skeleton-pair-insert-maybe))
(add-hook 'c-mode-hook 'my-c-mode-auto-pair)
(add-hook 'c++-mode-hook 'my-c-mode-auto-pair)
;;输入左边的括号,就会自动补全右边的部分.包括(), '', [] , {} ,""

;;;;自动补齐策略
;(defun my-indent-or-complete ()
;   (interactive)
;   (if (looking-at "\\>")
;          (hippie-expand nil)
;          (indent-for-tab-command))
;)
;(global-set-key [(C-tab)] 'my-indent-or-complete)
;;;(control tab)
;(autoload 'senator-try-expand-semantic "senator")
;(setq hippie-expand-try-functions-list
;          '(
;              senator-try-expand-semantic
;                   try-expand-dabbrev
;                   try-expand-dabbrev-visible
;                   try-expand-dabbrev-all-buffers
;                   try-expand-dabbrev-from-kill
;                   try-expand-list
;                   try-expand-list-all-buffers
;                   try-expand-line
;        try-expand-line-all-buffers
;        try-complete-file-name-partially
;        try-complete-file-name
;        try-expand-whole-kill
;        )
;)

;;unicad多语言对应,避免打开文件乱码
;[]
(require 'unicad)


;; js2-mode
(autoload 'js2-mode "js2" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))


;(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 :background "grey30" :foreground "gainsboro" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant ;normal :weight normal :height 93 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))
(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 :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 90 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))













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

chinaunix网友2010-01-13 16:05:54

;(add-to-list 'load-path "");已经在之前的代码中load完了 这个在那里load完了了?