(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) '(display-time-mode t) '(global-linum-mode t) '(show-paren-mode t nil (paren)) '(size-indication-mode t) '(transient-mark-mode nil)) (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 "#7a7a7a" :foreground "#0d0d0d" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 102 :width normal :foundry "apple" :family "Monaco"))))) ;我的Emacs配置;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;http://alexpogosyan.com/color-theme-creator/ (defun my-color-theme () (interactive) (color-theme-install '(my-color-theme ((background-color . "#7a7a7a") (background-mode . light) (border-color . "#a1a399") (cursor-color . "#000000") (foreground-color . "#0d0d0d") (mouse-color . "black")) (fringe ((t (:background "#a1a399")))) (mode-line ((t (:foreground "#f8f6f6" :background "#726e6e")))) (region ((t (:background "#e3a0a0")))) (font-lock-builtin-face ((t (:foreground "#d8189b")))) (font-lock-comment-face ((t (:foreground "#0f950f")))) (font-lock-function-name-face ((t (:foreground "#d9bb0d")))) (font-lock-keyword-face ((t (:foreground "#0d1191")))) (font-lock-string-face ((t (:foreground "#dc2409")))) (font-lock-type-face ((t (:foreground"#510b0c")))) (font-lock-variable-name-face ((t (:foreground "#cb5206")))) (minibuffer-prompt ((t (:foreground "#0b35bc" :bold t)))) (font-lock-warning-face ((t (:foreground "Red" :bold t)))) ))) (provide 'my-color-theme) (add-to-list 'load-path "/usr/local/share/emacs/my_plus");自己的插件包 (require 'color-theme);主题颜色 ;(color-theme-initialize) (my-color-theme) ;(color-theme-dark-blue) (require 'setnu);第行前显示行号 (setnu-mode t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;设置颜色;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;(set-cursor-color "Wheat") ;(set-mouse-color "Wheat") ;(set-foreground-color "Wheat") ;(set-background-color "DarkSlateGray");DarkSlateGray ;;设置时间格式;;;;;;;;;;;;;;;;;;;;;;;;;;; (display-time-mode t) (setq display-time-12hr-format t) (setq display-time-day-and-date t) (setq visible-bell t);关闭出错提示声 (setq inhibit-startup-message t);关闭开启画面 (setq backup-inhibited t);;不产生备份 (setq auto-save-default nil);不生成名为#filename#的临时文件 (setq default-major-mode 'text-mode);;设置默认模式是text mode (global-font-lock-mode t);语法高亮 (auto-image-file-mode t);打开图片显示功能 (setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴 (setq frame-title-format '("" buffer-file-name));标题栏显示buffer名 (setq default-directory "/home/blueboy/Program");设置缺省目录 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;鼠标滚轮,默认的滚动太快,这里改为3行;;;;;; (defun up-slightly () (interactive) (scroll-up 3)) (defun down-slightly () (interactive) (scroll-down 3)) (global-set-key [mouse-4] 'down-slightly) (global-set-key [mouse-5] 'up-slightly) ;;自定义按键;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (global-set-key [f1] 'shell);F1进入Shell (global-set-key [C-f5] 'previous-error) (global-set-key [f5] 'next-error) (global-set-key [C-f3] 'python-shell);F3进入Python-Shell (global-set-key [C-f6] 'gdb);调试 (setq compile-command "make -f Makefile") (global-set-key [f7] 'compile);F7编译文件 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;Python配置;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;(require 'python-mode) (setq auto-mode-alist (cons '("//.py$" . python-mode) auto-mode-alist) );自动关联文件 (setq interpreter-mode-alist (cons '("python" . python-mode) interpreter-mode-alist) ) (autoload 'python-mode "python-mode" "Python editing mode." t) ;;C语言配置;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun linux-c-mode() ;;;将回车代替C-j的功能,换行的同时对齐;;;;;; (define-key c-mode-map [return] 'newline-and-indent) (interactive) (c-set-style "k&r");设置C程序的对齐风格 ;(c-toggle-auto-state);在此种模式下当你键入{时,会自动根据你设置的对齐风格对齐 (c-toggle-hungry-state);此模式下,当按Backspace时会删除最多的空格,使得if缩进正常 (setq c-basic-offset 4);缩进设置为4 (imenu-add-menubar-index);在菜单中加入当前Buffer的函数索引 (which-function-mode);在状态条上显示当前光标在哪个函数体内部 ) ;;C++语言配置;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun linux-cpp-mode () (define-key c++-mode-map [return] 'newline-and-indent) (interactive) (c-set-style "Stroustrup") (setq c-basic-offset 4) ;(c-toggle-auto-state) (c-toggle-hungry-state) (imenu-add-menubar-index) (which-function-mode) ) (add-hook 'c-mode-hook 'linux-c-mode) (add-hook 'c++-mode-hook 'linux-cpp-mode) (setq imenu-sort-function 'imenu--sort-by-name);设置imenu的排序方式为按名称排序 (setq auto-mode-alist (append '(("//.h$" . c++-mode)) auto-mode-alist)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;配置星际译王 ;;如果选中了region 就查询 region 的内容,否则查询当前光标所在的单词 ;;按 q 可以把这个 buffer 放到 buffer 列表末尾,按 d 可以查询单词 (global-set-key (kbd "C-c d") 'kid-sdcv-to-buffer) (defun kid-sdcv-to-buffer() (interactive) (let((word (if mark-active (buffer-substring-no-properties (region-beginning) (region-end)) (current-word nil t)))) (setq word (read-string (format "Search the dictionary for (default %s): " word) nil nil word)) (set-buffer (get-buffer-create "*sdcv*")) (buffer-disable-undo) (erase-buffer) (let((process (start-process-shell-command "sdcv" "*sdcv*" "sdcv" "-n" word))) (set-process-sentinel process (lambda(process signal) (when(memq (process-status process) '(exit signal)) (unless(string=(buffer-name) "*sdcv*") (setq kid-sdcv-window-configuration (current-window-configuration)) (switch-to-buffer-other-window "*sdcv*") (local-set-key (kbd "d") 'kid-sdcv-to-buffer) (local-set-key (kbd "q") (lambda() (interactive) (bury-buffer) (unless(null (cdr (window-lis t)));only one window (delete-window))))) (goto-char (point-min)))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;CEDET conf (load-file "/home/blueboy/下载/cedet-1.0pre7/common/cedet.el") (semantic-load-enable-code-helpers) ;ecb conf (add-to-list 'load-path "/home/blueboy/ecb-2.32") (require 'ecb) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;鼠标左键单击一个函数或变量名,在“*preview*" buffer中显示出函数或变量的定义 ;鼠标中键点击一个函数或变量名,在“*preview*" buffer中显示出函数或变量被调用的地方 ;当跳转到一个函数的定义后,单击鼠标右键可以返回到跳转前的地方 (require 'yp-preview) (pv-enable) (defun my-pv-c-map () (interactive) (define-key c-mode-map [mouse-1] 'pv-find-def-and-delay) (define-key c-mode-map [mouse-2] 'pv-find-ref-or-paste) (define-key c-mode-map [mouse-3] 'pv-pop-mark) ) (add-hook 'c-mode-hook 'my-pv-c-map) (add-hook 'c++-mode-hook 'my-pv-c-map) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;