;;滚动条右至 (customize-set-variable 'scroll-bar-mode 'right) ;;设置自动换行模式 (setq-default truncate-lines 1) (desktop-save-mode 1) ;; ;;设置标题栏显示文件的完整路径名 (setq frame-title-format '("%S" (buffer-file-name "%f" (dired-directory dired-directory "%b")))) ;; (load "auctex.el" nil t t) (setq TeX-auto-save t) (setq TeX-parse-self t) (setq-default TeX-master 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. ) ;;autocomplete (add-to-list 'load-path "~/.emacs.d/") (require 'auto-complete-config) (add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict") (ac-config-default) ;;COLOR_THEME (require 'color-theme) (color-theme-classic) ;;linum (require 'linum) (global-linum-mode 1) ;; ;;括号自动配对 ;;自动补全括号 (defun my-common-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-common-mode-auto-pair) (add-hook 'c++-mode-hook 'my-common-mode-auto-pair) ;;强制TAB键使用空格 (setq-default indent-tabs-mode nil) ;;重新绑定C-z到撤销 (global-set-key (kbd "C-z") 'undo) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 配置cedet环境 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (load-file "~/.emacs.d/cedet-1.0pre7/common/cedet.el") (require 'semantic-ia) (require 'semantic-gcc) (require 'semantic-c) (semantic-load-enable-minimum-features) ;;设置提示间隔时间为0.5s (setq-default semantic-idle-scheduler-idle-time 0.5) (setq-default semantic-complete-inline-analyzer-idle-displayor-class 'semantic-displayor-tooltip) (global-semantic-idle-completions-mode 1) (global-semantic-mru-bookmark-mode 1) ;;将当前编辑函数显示在状态条上 ;;(which-function-mode) (defun semantic-ia-fast-jump-back () (interactive) (if (ring-empty-p (oref semantic-mru-bookmark-ring ring)) (error "Semantic Bookmark ring is currently empty")) (let* ((ring (oref semantic-mru-bookmark-ring ring)) (alist (semantic-mrub-ring-to-assoc-list ring)) (first (cdr (car alist)))) (if (semantic-equivalent-tag-p (oref first tag) (semantic-current-tag)) (setq first (cdr (car (cdr alist))))) (semantic-mrub-switch-tags first))) (defun my-cedet-hook () (semantic-add-system-include "/lib/modules/2.6.28ouc/build/include/" 'c-mode) ;;(local-set-key [f12] 'ecb-activate) ;;(local-set-key [(control return)] 'semantic-ia-complete-symbol) ;;修改默认make -k 命令 (setq compile-command "make") (define-key c-mode-base-map [(f7)] 'compile) (local-set-key [f1] 'semantic-ia-complete-symbol-menu) (local-set-key "/C-cj" 'semantic-ia-fast-jump) (local-set-key "/C-cb" 'semantic-mrub-switch-tags) (local-set-key "/C-c?" 'semantic-ia-complete-symbol-menu) (local-set-key "/C-c>" 'semantic-complete-analyze-inline) (local-set-key "/C-cp" 'semantic-analyze-proto-impl-toggle)) (add-hook 'c-mode-common-hook 'my-cedet-hook) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; GDB设置-类VC6设置 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq gdb-many-windows t) (defun gud-break-remove () "Set/clear breakpoin." (interactive) (save-excursion (if (eq (car (fringe-bitmaps-at-pos (point))) 'breakpoint) (gud-remove nil) (gud-break nil)))) (add-hook 'gdb-mode-hook '(lambda () (gud-tooltip-mode 1) (define-key c-mode-base-map [f5] 'gud-go) (define-key c-mode-base-map [f10] 'gud-step) (define-key c-mode-base-map [f11] 'gud-next) (define-key c-mode-base-map [f9] 'gud-break-remove))) ;;yasnippet模板补全 (add-to-list 'load-path "~/.emacs.d/yasnippet-0.6.1c") (require 'yasnippet) (yas/initialize) (yas/load-directory "~/.emacs.d/yasnippet-0.6.1c/snippets") ;; c-eldoc函数提示 ;; add in your commonly used packages/include directories here, for ;; example, SDL or OpenGL. this shouldn't slow down cpp, even if ;; you've got a lot of them ;; (setq c-eldoc-includes "`pkg-config gtk+-2.0 --cflags` -I./ -I../ ") (load "c-eldoc") (add-hook 'c-mode-hook (lambda () (set (make-local-variable 'eldoc-idle-delay) 0.20) (c-turn-on-eldoc-mode) )) ;; ;;配置sr-speedbar,F4键调出speedbar (require 'sr-speedbar) (global-set-key [(f4)] 'sr-speedbar-toggle)/ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 配置xcscope快捷键盘 同global默认键盘一致 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'xcscope) (define-key c-mode-base-map "/M-." 'cscope-find-global-definition) (define-key c-mode-base-map "/M-?" 'cscope-find-functions-calling-this-function) (define-key c-mode-base-map "/M-*" 'cscope-pop-mark) (define-key c-mode-base-map [f12] 'cscope-find-this-file)
Emacs 配置文件
注意:(global-set-key [(f4)] 'sr-speedbar-toggle)/
要在f7定义之后