我的emacs配置文件

;;----------------------------------------------- ;; cedet (load-file "~/tools/emacs/cedet/common/cedet.el") ;;----------------------------------------------- ;; ecb (add-to-list 'load-path "~/tools/emacs/ecb") (require 'ecb) ;; 启动时开启 (setq ecb-auto-activate t) ;; 关闭tip (setq ecb-tip-of-the-day nil) ;; 各窗口间切换 (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窗口 (C-F1,C-F2) (define-key global-map [(control f1)] 'ecb-hide-ecb-windows) (define-key global-map [(control f2)] 'ecb-show-ecb-windows) ;; 使某一ecb窗口最大化 (C-c1,C-c2,C-c3,C-c4) (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) ;; 恢复ecb窗口原始布局 (C-c`) (define-key global-map "/C-c`" 'ecb-restore-default-window-sizes) ;; 自动补全检索范围 ;;(setq semanticdb-project-roots ;;(list ;;(expand-file-name "~/project"))) ;; 自动补全按键绑定 ;;(global-set-key [(control tab)] 'senator-complete-symbol); ;;(global-set-key [(control tab)] ' senator-completion-menu-popup) ;; (global-set-key [(control tab)] 'semantic-ia-complete-symbol-menu) ;;------------------------------------------------ ;; cscope (load-file "~/tools/emacs/xcscope.el") ;; 不要自动更新数据库文件 ;;(setq cscope-do-not-update-database t) ;;----------------------------------------------- ;; 颜色主题 (load-file "~/tools/emacs/color-theme.el") ;; 我的主题 (color-theme-gnome2) ;;----------------------------------------------- ;; 自动编译(快捷键F9) (defun quick-compile () "A quick compile funciton for C" (interactive) (compile (concat "gcc " (buffer-name (current-buffer)) " -g "))) (global-set-key [(f9)] 'quick-compile) ;;----------------------------------------------- ;; gdb (setq gdb-many-windows t) ;;gdb many windows mode (setq gdb-use-separate-io-buffer nil) ;;----------------------------------------------- ;; emacs ;; 关闭启动信息 (setq inhibit-startup-message t) ;; 行号 ;;(load-file "~/tools/emacs/linum.el") ;;(global-linum-mode t) ;; 列号 (column-number-mode t) ;; 去掉工具栏 (tool-bar-mode nil) ;; 去掉菜单栏 (C-Mouse2:显示菜单项) (menu-bar-mode nil) ;; 滚动条在右边 ;;(set-scroll-bar-mode 'right) ;; 去掉滚动条 (scroll-bar-mode nil) ;; 标题栏显示文件路径 (setq frame-title-format '("%S" (buffer-file-name "%f" (dired-directory dired-directory "%b")))) ;; 删除区域 (delete-selection-mode 1) ;; 打开剪贴板 (setq x-select-enable-clipboard t) ;; 设置标记 (F12) (global-set-key [f12] 'set-mark-command) ;; 关闭鼠标加速 (setq mouse-wheel-progressive-speed nil) ;; 平滑滚动屏幕 (setq scroll-margin 3 scroll-conservatively 10000) ;; 显示括号匹配时光标不跳转 (show-paren-mode t) (setq show-paren-style 'parentheses) ;; 当鼠标挡住光标时自动移开 ;;(mouse-avoidance-mode 'animate) ;; 语法加亮 (global-font-lock-mode t) ;; 全屏显示 (defun fullscreen (&optional f) (interactive) (set-frame-parameter f 'fullscreen (if (frame-parameter f 'fullscreen) nil 'fullboth))) (global-set-key [f11] 'fullscreen) (add-hook 'after-make-frame-functions 'fullscreen) ;; 启动emacs时窗口最大化 (defun my-maximized () (interactive) (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)) (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))) (my-maximized) ;;----------------------------------------------- ;; 编程 ;; C代码采用内核风格排版 (defun c-lineup-arglist-tabs-only (ignored) "Line up argument lists by tabs, not spaces" (let* ((anchor (c-langelem-pos c-syntactic-element)) (column (c-langelem-2nd-pos c-syntactic-element)) (offset (- (1+ column) anchor)) (steps (floor offset c-basic-offset))) (* (max steps 1) c-basic-offset))) (add-hook 'c-mode-common-hook (lambda () ;; Add kernel style (c-add-style "linux-tabs-only" '("linux" (c-offsets-alist (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist-tabs-only)))))) (add-hook 'c-mode-hook (lambda () ;; (let ((filename (buffer-file-name))) ;; Enable kernel mode for the appropriate files ;; (when (and filename ;; (string-match (expand-file-name "/") ;; filename)) (setq indent-tabs-mode t) (c-set-style "linux-tabs-only"))) ;;)) ;; 自动补全代码 (global-set-key [(meta ?/)] 'hippie-expand) (setq hippie-expand-try-functions-list '(try-expand-dabbrev try-expand-dabbrev-visible try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-complete-file-name-partially try-complete-file-name try-expand-all-abbrevs try-expand-list try-expand-line try-complete-lisp-symbol-partially try-complete-lisp-symbol)) ;; python mode ;;----------------------------------------------- ;; 自动添加 ;; ecb (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. '(ecb-fix-window-size t) '(ecb-layout-window-sizes nil) '(ecb-options-version "2.40") '(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2)) '(ecb-windows-width 0.3)) (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. ) (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil)

你可能感兴趣的:(我的emacs配置文件)