Chinaunix首页 | 论坛 | 博客
  • 博客访问: 124478
  • 博文数量: 35
  • 博客积分: 1672
  • 博客等级: 上尉
  • 技术积分: 412
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-19 15:16
文章分类

全部博文(35)

文章存档

2012年(5)

2011年(9)

2010年(21)

我的朋友

分类: LINUX

2010-07-29 21:24:34

;;LOAD_PATH
(add-to-list 'load-path' "/home/study/emacs/emacs_lib")
(add-to-list 'load-path' "/home/study/emacs/emacs_lib/cc-mode")
(add-to-list 'load-path' "/home/study/emacs/emacs_lib/ecb")



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

'(compile-command "make")
;;;;;;;;;;cc-mode-hook;;;;;;;;;;;;;;;;;
(defun my-c-mode-common-hook()
  (setq tab-width 4 indent-tabs-mode nil)
  ;;; hungry-delete and auto-newline
  (c-toggle-auto-hungry-state 1)
  (define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
  (define-key c-mode-base-map [(return)] 'newline-and-indent)
  (define-key c-mode-base-map [(meta \`)] 'c-indent-command)
;;(define-key c-mode-base-map [(tab)] 'hippie-expand)
  (define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
  (define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)

  (setq c-macro-shrink-window-flag t)
  (setq c-macro-preprocessor "cpp")
  (setq c-macro-cppflags " ")
  (setq c-macro-prompt-flag t)
  (setq hs-minor-mode t)
  (setq abbrev-mode t)
)

(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

(defun my-c++-mode-hook()
  (setq tab-width 4 indent-tabs-mode nil)
  (c-set-style "stroustrup")
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;enable cedet.el;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load-file "/home/study/emacs/emacs_lib/cedet/common/cedet.el")
(setq semanticdb-project-roots
        (list
        (expand-file-name "/")))
(defun my-indent-or-complete ()
   (interactive)
   (if (looking-at "\\>")
         (hippie-expand nil)
       (indent-for-tab-command))
)
;;(global-set-key [(control tab)] 'my-indent-or-complete)
(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
        )
)
(require 'eldoc)
(require 'semantic-gcc)

(semantic-load-enable-minimum-features)
(semantic-load-enable-code-helpers)
(semantic-load-enable-guady-code-helpers)
(semantic-load-enable-excessive-code-helpers)
(semantic-load-enable-semantic-debugging-helpers)

;;set the include path
(defconst cedet-user-include-dirs
  (list ".." "../include" "../inc" "../common" "../public"
        "../.." "../../include" "../../inc" "../../common"
    "../../public"))
(let ((include-dirs cedet-user-include-dirs))
  (mapc (lambda (dir)
          (semantic-add-system-include dir 'c++-mode)
          (semantic-add-system-include dir 'c-mode))
        include-dirs))

(global-ede-mode 1)
(require 'semantic-tag-folding nil 'noerror)
(global-semantic-tag-folding-mode 1)
(define-key semantic-tag-folding-mode-map (kbd "C-c , -")
  'semantic-tag-folding-fold-block)
(define-key semantic-tag-folding-mode-map (kbd "C-c , +")
  'semantic-tag-folding-show-block)

;;add a blue line on the function
(require 'semantic-decoration-mode nil 'noerror)
;;;;;;;;;;;;;;;;;;;;;enable ecb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'ecb)
(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(ecb-auto-activate t)
 '(ecb-compile-window-height 10)
 '(ecb-compile-window-temporally-enlarge (quote after-selection))
 '(ecb-compile-window-width (quote edit-window))
 '(ecb-layout-name "left7")
 '(ecb-layout-window-sizes nil)
 '(ecb-options-version "2.32")
 '(ecb-source-path (quote ((#("/" 0 1 (help-echo "Mouse-2 toggles maximizing, mouse-3 displays a popup-menu")) #("/" 0 1 (help-echo "Mouse-2 toggles maximizing, mouse-3 displays a popup-menu"))) ("/home/p4_IPv6/max_feng_IPv6/Ent/IWSx/Dev/IWSVA-5.1/IWSVA/IWSS" "IWSVA_DEV") ("/home/study" "HTTPLib"))))
 '(ecb-tip-of-the-day nil))

;;map key for 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)

(define-key global-map [(control f1)] 'ecb-hide-ecb-windows)
(define-key global-map [(control f2)] 'ecb-show-ecb-windows)

(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)

(defun du-onekey-compile ()
  "Save buffers and start compile"
  (interactive)
  (save-some-buffers t)
  (switch-to-buffer-other-window "*compilation*")
  (compile compile-command))
(global-set-key [C-f5] 'compile)
(global-set-key [f5] 'du-onekey-compile)
;;F6 gdb
(global-set-key [f6] 'gdb)
(global-set-key [C-f7] 'previous-error)
(global-set-key [f7] 'next-error)
;;;;;;;;;;;;;;;;;;;;;some personal operation habbit;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;COLOR_THEME
(require 'color-theme)
(color-theme-arjen)
;;(color-theme-comidia)
;;(color-theme-tty-dark)
;;display row and column  number
(require 'display-line-number)
(setq column-number-mode t)
(setq display-line-number-format "%3d ")
;;high light
(global-font-lock-mode t)
;;display the peer ()
(show-paren-mode t)
;;enable ido to show some commands
(require 'ido)
(ido-mode t)
;;set main directory
(setq default-directory "/")
(setq inhibit-startup-message t)
(setq gnus-inhibit-startup-message t)
;;change yes to y, no to n
(fset 'yes-or-no-p 'y-or-n-p)
(setq font-lock-maximum-decoration t)
(setq font-lock-global-modes '(not shell-mode text-mode))
(setq font-lock-verbose t)
(setq font-lock-maximum-size '((t . 1048576) (vm-mode . 5250000)))
(setq kill-ring-max 200)
(setq-default auto-fill-function 'do-auto-fill)
;; Autofill in all modes;;
(setq default-fill-column 120)
;;set text mode
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(setq show-paren-style 'parenthesis)
;;enable image mode
(setq auto-image-file-mode t)
;;C-x k delete the whole line
(setq-default kill-whole-line t)
;;back up settings
(setq version-control t)
(setq kept-old-versions 2)
(setq kept-new-versions 1)
(setq delete-old-versions t)
(setq backup-directory-alist '(("." . "/home/.backup")))
(setq backup-by-copying t)
(setq make-backup-files nil)
;;auto save mode
(setq auto-save-mode nil)
(setq-default make-backup-files nil)
(setq require-final-newline t)
;;set the cur at the end of each line
(setq track-eol t)
;;set home and end key
(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)
;;scroll left and right
(global-set-key (kbd "C-,") 'scroll-left)
(global-set-key (kbd "C-.") 'scroll-right)
;;set F4 jump other window
(global-set-key [f4] 'other-window)
;;open eshell in other buffer
(defun open-eshell-other-buffer ()
  "Open eshell in other buffer"
  (interactive)
  (split-window-vertically)
  (eshell))
(global-set-key [(f8)] 'open-eshell-other-buffer)
(global-set-key [C-f8] 'eshell)
;;set F10 undo!
(global-set-key [f10] 'undo)
(global-set-key [f11] 'calendar)
;;(global-set-key [f12] 'list-bookmarks)

;;M-g goto line
(global-set-key (kbd "M-g") 'goto-line)

;;other set number
(require 'setnu)
(global-set-key [f2] (quote setnu-mode))
(global-set-key [f12] 'semantic-ia-fast-jump)


(custom-set-faces
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 )

阅读(754) | 评论(0) | 转发(0) |
0

上一篇:小东西

下一篇:Linux 好习惯1

给主人留下些什么吧!~~