;;;;;;;;;今天最新添加org-mode Emacs 23自带的功能,非常棒,做笔记最好,今天尝试了下..
;;;;;;;;;配置参考Emacs中文网的各位高手,,主要参考DEA 的作者ahei和
;;;;;;;;;common lisp开发环境配置由重庆的common lisp程序员(曾大哥)给我配置的第一次,
;;;;;;;;;后面自己进行升级和改进
;;;;;;;;;其 它快捷键参考VIM 的基本常用的功能自己通过M-x 进行设置的。
;;;;;;;;;下次更新GNUS 的新闻阅读 和MP3,MPLAYER的功能!
;;;;;;;;;里面注释比较多,主要是很多插件的使用快捷键.
;;;;;;;;;由于 我很懒,不想去记,不知道 可以看看,,hoho
;;;;;;;;;目前根据以前的代码 整理了下,但还有部分漏掉了。。
;;;;;;;;; 只要不影响Emacs正常工作,我就没管了,大家可以看看,最好不要直接COPY,
;;;;;;;;;因为我和你的操作系统环境可能不一 样;
;;;;;;;;;非常感谢DEA 的作者ahei和曾大哥 他俩所提供的配置源代码(
;;;;;;;;;都上了W行,看着眼花缭乱)
;解决emacs shell 乱码
(setq ansi-color-for-comint-mode t)
(customize-group 'ansi-colors)
(kill-this-buffer);关闭customize窗口
(setq default-major-mode 'text-mode);一打开就起用 text 模式
;自定义按键
(global-set-key [f1] 'shell);F1进入Shell
;;目的是开一个shell的小buffer,用于更方便地测试程序(也就是运行程序了),我经常会用到。
;;f1就是另开一个buffer然后打开shell,C-f1则是在当前的buffer打开shell
(global-set-key [C-f5] 'previous-error)
(global-set-key [f5] 'next-error)
(setq backup-inhibited t);;不产生备份
(setq auto-save-default nil);不生成名为#filename# 的临时文件
(defun open-eshell-other-buffer ()
"Open eshell in other buffer"
(interactive)
(split-window-vertically)
(eshell))
(global-set-key [C-f1] 'open-eshell-other-buffer)
;;(global-set-key [C-f1] 'eshell)
;;加载cedet
(add-to-list 'load-path "~/lisp/cedet/speedbar")
(add-to-list 'load-path "~/lisp/cedet/eieio")
(add-to-list 'load-path "~/lisp/cedet/semantic")
(add-to-list 'load-path "~/lisp/cedet/common")
(add-to-list 'load-path "~/.emacs.d/")
(require 'cedet)
;;加载ecb
(add-to-list 'load-path "~/lisp/ecb")
;;(require 'ecb)
(require 'ecb-autoloads)
;;(ecb-activate)
(when (require 'ecb nil 'noerror)
(setq ecb-tip-of-the-day nil)
(setq ecb-auto-compatibility-check nil)
(setq ecb-primary-secondary-mouse-buttons 'mouse-1--C-mouse-1))
;; 用M-x执行某个命令的时候,在输入的同时给出可选的命令名提示
(icomplete-mode 1)
(define-key minibuffer-local-completion-map (kbd "SPC") 'minibuffer-complete-word)
(setq column-number-mode t)
(setq line-number-mode t)
(global-linum-mode 'linum-mode);;在左边显示行号
;;(global-set-key (kbd "C-a") 'view-file-other-window)
(global-font-lock-mode t);语法高亮
(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-default kill-whole-line t);;C-k 删除该行
(fset 'yes-or-no-p 'y-or-n-p);以 y/n代表 yes/no
(column-number-mode t);显示列号
(show-paren-mode t);显示括号匹配
(setq show-paren-mode t) ;;打开括号匹配显示模式
(setq show-paren-style 'parenthesis)
(display-time-mode 1);显示时间,格式如下
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(setq display-time-use-mail-icon t);;时间栏旁边启用邮件设置
(setq display-time-interval 10);;时间的变化频率,单位多少来着?
(tool-bar-mode nil);去掉那个大大的工具栏
(scroll-bar-mode nil);去掉滚动条
(auto-save-mode nil);;禁止自动保存
(put 'scroll-left 'disabled nil);;允许屏幕左移
(put 'scroll-right 'disabled nil);;允许屏幕右移
(put 'set-goal-column 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'LaTeX-hide-environment 'disabled nil)
(mouse-avoidance-mode 'animate);光标靠近鼠标指针时,让鼠标指针自动让开
(setq mouse-yank-at-point t);支持中键粘贴
(transient-mark-mode t);允许临时设置标记
;; 高亮显示C/C++中的可能的错误(CWarn mode)
(global-cwarn-mode 1)
(global-set-key (kbd "
(global-set-key (kbd "
(global-set-key (kbd "
(global-set-key [C-f2] 'slime-compile-file);slime编译文件
(global-set-key [C-f3] 'python-shell);F3进入Python-Shell
(global-set-key [C-f6] 'gdb);F5调试程序
(setq compile-command "make -f Makefile")
;;(global-set-key [f7] 'compile);F7编译文件
;; C-f7, 设置编译命令; f7, 保存所有文件然后编译当前窗口文件
(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-f7] 'compile)
(global-set-key [f7] 'du-onekey-compile)
(setq speedbar-show-unknown-files t);;可以显示所有目录以及文件
;;让 dired 可以递归的拷贝和删除目录。
(setq dired-recursive-copies 'top)
(setq dired-recursive-deletes 'top)
(global-set-key (kbd "C-e") 'ecb-activate);;启动Ecb
(global-set-key [C-f9] 'dired);;设置[C-f9]为调用dired命令
(global-set-key [C-f10] 'undo);;设置C-F10为撤销
(global-set-key [C-f11] 'calendar) ;;设置C-F11快捷键指定Emacs 的日历系统
(global-set-key [C-f12] 'list-bookmarks);;设置C-F12 快速察看日程安排
(global-set-key (kbd "C-|") 'other-window);窗口间跳转
(global-set-key [f2] 'kill-this-buffer);F2关闭当前buffer
(global-set-key [M-return] 'kill-this-buffer);M-return关闭当前buffer
(global-set-key [C-return] 'kill-this-buffer);C-return关闭当前buffer
(global-set-key [f10] 'split-window-vertically);F10分割窗口
(global-set-key [f11] 'delete-other-windows);F11 关闭其它窗口
(global-set-key [f12] 'my-fullscreen);F12 全屏
(global-set-key (kbd "C-,") 'backward-page);文件首
(global-set-key (kbd "C-.") 'forward-page);文件尾
(global-set-key (kbd "C-'") 'next-buffer);转到下一个buffer
(global-set-key (kbd "C-;") 'previous-buffer);转到上一个buffer
(global-set-key (kbd "C-/") 'next-multiframe-window);;转到下一个窗口
(global-set-key (kbd "C-?") 'previous-multiframe-window);;转到上一个窗口
(global-set-key (kbd "C-<") 'beginning-of-line);;跳转到行首
(global-set-key (kbd "C->") 'end-of-line);;跳转到行尾
(global-set-key (kbd "C-c C-g") 'goto-char) ;;跳转到行任意位子
(setq mouse-drag-copy-region nil);;取消鼠标选择即复制
;普通设置
(setq inhibit-startup-message t);关闭起动时闪屏
(setq visible-bell t);关闭出错时的提示声
(menu-bar-mode nil);;关闭菜单
;;shell,gdb退出后,自动关闭该buffer
(defun kill-buffer-when-shell-command-exit ()
"Close current buffer when `shell-command' exit."
(let ((process (ignore-errors (get-buffer-process (current-buffer)))))
(when process
(set-process-sentinel process
(lambda (proc change)
(when (string-match "\\(finished\\|exited\\)" change)
(kill-buffer (process-buffer proc))))))))
;; 退出gdb的时候关闭gdb对应的buffer
(add-hook 'gdb-mode-hook 'kill-buffer-when-shell-command-exit)
;; 退出term的时候关闭term对应的buffer
(add-hook 'term-mode-hook 'kill-buffer-when-shell-command-exit)
;;编译成功后自动关闭*compilation* 函数
(defun kill-buffer-when-compile-success (process)
"Close current buffer when `shell-command' exit."
(set-process-sentinel process
(lambda (proc change)
(when (string-match "finished" change)
(delete-windows-on (process-buffer proc))))))
;; 编译成功后自动关闭*compilation* buffer
(add-hook 'compilation-start-hook 'kill-buffer-when-compile-success)
;;退出时寻问
(setq kill-emacs-query-functions
(lambda ()
(y-or-n-p "Do you really want to quit? ")))
;; 设置时间戳,标识出最后一次保存文件的时间。
(setq time-stamp-active t)
(setq time-stamp-warn-inactive t)
(setq time-stamp-format "%:y-%02m-%02d %3a %02H:%02M:%02S chunyu")
(global-set-key (kbd "M-g") 'goto-line);;设置M-g为goto-line
;; 尽快显示按键序列
(setq echo-keystrokes 0.1)
(setq system-time-locale "C")
;;加载template
(defconst my-emacs-path "~/.emacs.d/" "我的emacs相关配置文件的路径")
(load "template-settings")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 设置日历 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;设置日历的一些颜色
(setq calendar-load-hook
'(lambda ()
(set-face-foreground 'diary-face "skyblue")
(set-face-background 'holiday-face "slate blue")
(set-face-foreground 'holiday-face "white")))
;;设置我所在地方的经纬度,calendar里有个功能是日月食的预测,和你的经纬度相联系的。
;; 让emacs能计算日出日落的时间,在 calendar 上用 S 即可看到
(setq calendar-latitude +39.54)
(setq calendar-longitude +116.28)
(setq calendar-location-name "北京")
;; 设置阴历显示,在 calendar 上用 pC 显示阴历
(setq chinese-calendar-celestial-stem
["甲" "乙" "丙" "丁" "戊" "己" "庚" "辛" "壬" "癸"])
(setq chinese-calendar-terrestrial-branch
["子" "丑" "寅" "卯" "辰" "巳" "戊" "未" "申" "酉" "戌" "亥"])
;; 设置 calendar 的显示
(setq calendar-remove-frame-by-deleting t)
(setq calendar-week-start-day 1);; 设置星期一为每周的第一天
(setq mark-diary-entries-in-calendar t);; 标记calendar上有diary的日期
(setq mark-holidays-in-calendar nil); ; 为了突出有diary的日期,calendar上不标记节日
(setq view-calendar-holidays-initially nil) ; 打开calendar的时候不显示一堆节日
;; 去掉不关心的节日,设定自己在意的节日,在 calendar 上用 h 显示节日
(setq christian-holidays nil)
(setq hebrew-holidays nil)
(setq islamic-holidays nil)
(setq solar-holidays nil)
(setq general-holidays '((holiday-fixed 1 1 "元旦")
(holiday-fixed 2 14 "情人节")
(holiday-fixed 3 14 "白色情人节")
(holiday-fixed 4 1 "愚人节")
(holiday-fixed 5 1 "劳动节")
(holiday-float 5 0 2 "母亲节")
(holiday-fixed 6 1 "儿童节")
(holiday-float 6 0 3 "父亲节")
(holiday-fixed 7 1 "建党节")
(holiday-fixed 8 1 "建军节")
(holiday-fixed 9 10 "教师节")
(holiday-fixed 10 1 "国庆节")
(holiday-fixed 12 25 "圣诞节")))
;;Calendar模式支持各种方式来更改当前日期
;;(这里的“前”是指还没有到来的那一天,“后”是指已经过去的日子)
;; q 退出calendar模式
;; C-f 让当前日期向前一天
;; C-b 让当前日期向后一天
;; C-n 让当前日期向前一周
;; C-p 让当前日期向后一周
;; M-} 让当前日期向前一个月
;; M-{ 让当前日期向后一个月
;; C-x ] 让当前日期向前一年
;; C-x [ 让当前日期向后一年
;; C-a 移动到当前周的第一天
;; C-e 移动到当前周的最后一天
;; M-a 移动到当前月的第一天
;; M-e 多动到当前月的最后一天
;; M-< 移动到当前年的第一天
;; M-> 移动到当前年的最后一天
;;Calendar模式支持移动多种移动到特珠日期的方式
;; g d 移动到一个特别的日期
;; o 使某个特殊的月分作为中间的月分
;; . 移动到当天的日期
;; p d 显示某一天在一年中的位置,也显示本年度还有多少天。
;; C-c C-l 刷新Calendar窗口
;; Calendar支持生成LATEX代码。
;; t m 按月生成日历
;; t M 按月生成一个美化的日历
;; t d 按当天日期生成一个当天日历
;; t w 1 在一页上生成这个周的日历
;; t w 2 在两页上生成这个周的日历
;; t w 3 生成一个ISO-SYTLE风格的当前周日历
;; t w 4 生成一个从周一开始的当前周日历
;; t y 生成当前年的日历
;;EMACS Calendar支持配置节日:
;; h 显示当前的节日
;; x 定义当天为某个节日
;; u 取消当天已被定义的节日
;; e 显示所有这前后共三个月的节日。
;; M-x holiday 在另外的窗口的显示这前后三个月的节日。
;; 另外,还有一些特殊的,有意思的命令:
;; S 显示当天的日出日落时间(是大写的S)
;; p C 显示农历可以使用
;; g C 使用农历移动日期可以使用
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 设置日记 ;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;
(setq diary-file "~/文档");; 默认的日记文件
(setq diary-mail-addr "BB.Qnyd@gmail.com")
(add-hook 'diary-hook 'appt-make-list)
;;当你创建了一个'~/diary'文件,你就可以使用calendar去查看里面的内容。你可以查看当天的事件,相关命令如下 :
;; d 显示被选中的日期的所有事件
;; s 显示所有事件,包括过期的,未到期的等等
;; 创建一个事件的样例:
;; 02/11/1989
;; Bill B. visits Princeton today
;; 2pm Cognitive Studies Committee meeting
;; 2:30-5:30 Liz at Lawrenceville
;; 4:00pm Dentist appt
;; 7:30pm Dinner at George's
;; 8:00-10:00pm concert
;; 创建事件的命令:
;; i d 为当天日期添加一个事件
;; i w 为当天周创建一个周事件
;; i m 为当前月创建一个月事件
;; i y 为当前年创建一个年事件
;; i a 为当前日期创建一个周年纪念日
;; i c 创建一个循环的事件
(setq compile-command "make")
;;emacs的默认compile命令是调用make -k,我把它改成了make。你也可以把它改成其他的,比如gcc之类的.
;;把c语言风格设置为k&r风格
(add-hook 'c-mode-hook
'(lambda ()
(c-set-style "k&r")))
;;把C++语言风格设置为stroustrup风格
(add-hook 'c++-mode-hook
'(lambda()
(c-set-style "stroustrup")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;C/C++设定;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;缩进策略
(defun my-indent-or-complete ()
(interactive)
(if (looking-at "\\>")
(hippie-expand nil)
(indent-for-tab-command)))
;;按键定义
(define-key c-mode-base-map [(return)] 'newline-and-indent)
(define-key c-mode-base-map [(meta \`)] 'c-indent-command)
;;能把一个代码块缩起来,需要的时候再展开
;; M-x hs-minor-mode
;; C-c @ ESC C-s show all
;; C-c @ ESC C-h hide all
;; C-c @ C-s show block
;; C-c @ C-h hide block
;; C-c @ C-c toggle hide/show
(load-library "hideshow")
(add-hook 'c-mode-hook 'hs-minor-mode)
(add-hook 'c++-mode-hook 'hs-minor-mode)
(add-hook 'java-mode-hook 'hs-minor-mode)
(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
(add-hook 'lisp-mode-hook 'hs-minor-mode)
(add-hook 'scheme-mode-hook 'hs-minor-mode)
(add-hook 'css-mode-hook 'hs-minor-mode)
(add-hook 'html-mode-hook 'hs-minor-mode)
(global-set-key (kbd "C-c C-:") 'hs-show-all);;显示
(global-set-key (kbd "C-c C-\"") 'hs-hide-all);;隐藏
;;输入左边的括号,就会自动补全右边的部分.包括(), "", [] , {} , 等等。
(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)
(add-hook 'java-mode-hook 'my-common-mode-auto-pair)
(add-hook 'lisp-mode-hook 'my-common-mode-auto-pair)
(add-hook 'php-mode-hook 'my-common-mode-auto-pair)
(add-hook 'python-mode-hook 'my-common-mode-auto-pair)
(add-hook 'html-mode-hook 'my-common-mode-auto-pair)
(add-hook 'scheme-mode-hook 'my-common-mode-auto-pair)
(add-hook 'css-mode-hook 'my-common-mode-auto-pair)
(add-hook 'sql-mode-hook 'my-common-mode-auto-pair)
(add-hook 'emacs-lisp-mode-hook 'my-common-mode-auto-pair)
(add-hook 'text-mode-hook 'my-common-mode-auto-pair)
(setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴
(setq frame-title-format '("Emacs@ " buffer-file-name " " ));在标题栏显示buffer名称
;;ido的配置,这个可以使你在用C-x C-f打开文件的时候在后面有提示;
;;这里是直接打开了ido的支持,在emacs23中这个是自带的.
(ido-mode t)
(setq visible-bell t)
;;设置 sentence-end 可以识别中文标点。不用在 fill 时在句号后插入两个空格。
(setq sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
(setq sentence-end-double-space nil)
;;可以递归的使用 minibuffer
(setq enable-recursive-minibuffers t)
;;设置个人信息
(setq user-full-name "B.Qnyd")
(setq user-mail-address "BB.Qnyd@gmail.com")
(setq track-eol t);; 当光标在行尾上下移动的时候,始终保持在行尾。
(setq Man-notify-method 'pushy);; 当浏览 man page 时,直接跳转到 man buffer。
;;设置home键指向buffer开头,end键指向buffer结尾
(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)
(setq default-fill-column 80);;把 fill-column 设为 80. 这样的文字更好读
;; 实现程序变量得自动对齐
(require 'align)
(global-set-key "\C-x\C-j" 'align)
;鼠标滚轮,默认的滚动太快,这里改为3行
(defun up-slightly () (interactive) (scroll-up 1))
(defun down-slightly () (interactive) (scroll-down 1))
(global-set-key [mouse-4] 'down-slightly)
(global-set-key [mouse-5] 'up-slightly)
(add-to-list 'load-path "/usr/share/emacs/site-lisp/xcscope.el")
;;(add-to-list 'load-path "~/lisp/cscope/contrib/xcscope/xcscope.el")
(require 'xcscope)
;;自动补全 yasnippet
(add-to-list 'load-path
"~/.emacs.d/plugins")
(require 'yasnippet-bundle)
(add-to-list 'load-path "~/.emacs.d/plugins/wcy-swbuff.el");;加载wcy-swbuff
(require 'wcy-swbuff)
;; then you can use
(global-set-key (kbd "
(global-set-key (kbd "
(setq wcy-switch-buffer-active-buffer-face 'highlight)
(setq wcy-switch-buffer-inactive-buffer-face 'secondary-selection )
;;=================================
(require 'psvn)
(require 'auto-complete+)
(require 'auto-complete-config)
(load-library "multi-gud.el")
(load-library "multi-gdb-ui.el")
(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")
(ac-config-default)
(setq gdb-many-windows t)
(require 'recentf)
;;(recentf-mode 1)
(defun recentf-open-files-compl ()
(interactive)
(let* ((all-files recentf-list)
(tocpl (mapcar (function
(lambda (x) (cons (file-name-nondirectory x) x))) all-files))
(prompt (append '("File name: ") tocpl))
(fname (completing-read (car prompt) (cdr prompt) nil nil)))
(find-file (cdr (assoc-ignore-representation fname tocpl)))))
(global-set-key [(control x)(control r)] 'recentf-open-files-compl)
;;(require 'thumbs)
(autoload 'table-insert "table" "WYGIWYS table editor")
;; session,可以保存很多东西,例如输入历史(像搜索、打开文件等的输入)、
;; register的内容、buffer的local variables以及kill-ring和最近修改的文件列表等。非常有用。
(require 'my-session)
(add-hook 'after-init-hook 'session-initialize)
;;全屏
(defun my-fullscreen ()
(interactive)
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_FULLSCREEN" 0)))
;最大化
(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)))
;; 启动emacs时窗口最大化
(when window-system
(my-maximized))
;; 启动窗口大小
(when window-system
(setq default-frame-alist
'((height . 34) (width . 158) (menu-bar-lines . 20) (tool-bar-lines . 0))))
;;;;;;;;;;;;我的 Common Lisp;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/lisp/src/slime/")
(add-to-list 'load-path "~/lisp/src/slime/contrib")
(require 'slime)
(slime-setup '(slime-fancy slime-asdf slime-tramp))
(setq inferior-lisp-program "/usr/bin/sbcl --noinform"
lisp-indent-function 'common-lisp-indent-function ;lisp-indent-function
slime-complete-symbol-function 'slime-fuzzy-complete-symbol
slime-net-coding-system 'utf-8-unix
slime-startup-animation t
slime-default-lisp 'sbcl
slime-enable-evaluate-in-emacs nil
slime-log-events t
slime-outline-mode-in-events-buffer nil
;;slime-repl-return-behaviour :send-only-if-after-complete
slime-autodoc-use-multiline-p t
slime-use-autodoc-mode t
slime-highlight-compiler-notes t
slime-fuzzy-completion-in-place nil)
(global-set-key [f4] 'slime);F4进入Slime
(defun lisp-indent-or-complete (&optional arg)
(interactive "p")
(if (or (looking-back "^\\s-*") (bolp))
(call-interactively 'lisp-indent-line)
(call-interactively 'slime-indent-and-complete-symbol)))
(eval-after-load "lisp-mode"
'(progn
(define-key lisp-mode-map (kbd "TAB") 'lisp-indent-or-complete)))
;;;;;;;;;;;;;;;;;;;;;;代码跳转;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-set-key [f8] 'semantic-ia-fast-jump)
(global-set-key [S-f8]
(lambda ()
(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))))
(define-key c-mode-base-map [M-f1] 'semantic-analyze-proto-impl-toggle)
;;;;;;;;;;;;;;;;;;可视化书签;;;;;;;;;;;;;;;;;;;;;;;;;;
(enable-visual-studio-bookmarks)
;;;;;h/cpp切换;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'eassist nil 'noerror)
(define-key c-mode-base-map [M-f12] 'eassist-switch-h-cpp)
(setq eassist-header-switches
'(("h" . ("cpp" "cxx" "c++" "CC" "cc" "C" "c" "mm" "m"))
("hh" . ("cc" "CC" "cpp" "cxx" "c++" "C"))
("hpp" . ("cpp" "cxx" "c++" "cc" "CC" "C"))
("hxx" . ("cxx" "cpp" "c++" "cc" "CC" "C"))
("h++" . ("c++" "cpp" "cxx" "cc" "CC" "C"))
("H" . ("C" "CC" "cc" "cpp" "cxx" "c++" "mm" "m"))
("HH" . ("CC" "cc" "C" "cpp" "cxx" "c++"))
("cpp" . ("hpp" "hxx" "h++" "HH" "hh" "H" "h"))
("cxx" . ("hxx" "hpp" "h++" "HH" "hh" "H" "h"))
("c++" . ("h++" "hpp" "hxx" "HH" "hh" "H" "h"))
("CC" . ("HH" "hh" "hpp" "hxx" "h++" "H" "h"))
("cc" . ("hh" "HH" "hpp" "hxx" "h++" "H" "h"))
("C" . ("hpp" "hxx" "h++" "HH" "hh" "H" "h"))
("c" . ("h"))
("m" . ("h"))
("mm" . ("h"))))
;;;F12 u 更新当前版本
(global-set-key (kbd "C-u") 'vc-next-action)
;; 为各种只读mode加入vi的按键
(require 'man)
(require 'apropos)
(require 'log-view)
(require 'diff-mode)
(let ((list (list view-mode-map Man-mode-map apropos-mode-map completion-list-mode-map
log-view-mode-map compilation-mode-map diff-mode-map)))
(require 'grep)
(setq list (append list (list grep-mode-map))))
(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)
'(cua-mode t nil (cua-base))
'(display-time-mode t)
'(show-paren-mode 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.
'(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 113 :width normal :foundry "microsoft" :family "Comic Sans MS")))))
;;用下面的办法对于编写 python, bash, per, awk, sed, 脚本的时候十分有用。在保存文件的时候,会自动给脚本增加可执行权限
(setq my-shebang-patterns
(list "^#!/usr/.*/perl\\(\\( \\)\\|\\( .+ \\)\\)-w *.*"
"^#!/usr/.*/sh"
"^#!/usr/.*/bash"
"^#!/bin/sh"
"^#!/.*/perl"
"^#!/.*/awk"
"^#!/.*/sed"
"^#!/bin/bash"))
(add-hook
'after-save-hook
(lambda ()
(if (not (= (shell-command (concat "test -x " (buffer-file-name))) 0))
(progn
;; This puts message in *Message* twice, but minibuffer
;; output looks better.
(message (concat "Wrote " (buffer-file-name)))
(save-excursion
(goto-char (point-min))
;; Always checks every pattern even after
;; match. Inefficient but easy.
(dolist (my-shebang-pat my-shebang-patterns)
(if (looking-at my-shebang-pat)
(if (= (shell-command
(concat "chmod u+x " (buffer-file-name)))
0)
(message (concat
"Wrote and made executable "
(buffer-file-name))))))))
;; This puts message in *Message* twice, but minibuffer output
;; looks better.
(message (concat "Wrote " (buffer-file-name))))))
(setq default-directory "~/");;默认目录
;; author: pluskid
;; 调用 stardict 的命令行程序 sdcv 来查辞典
;; 如果选中了 region 就查询 region 的内容,否则查询当前光标所在的单词
;; 查询结果在一个叫做 *sdcv* 的 buffer 里面显示出来,在这个 buffer 里面
;; 按 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-list))) ; only one window
(delete-window)))))
(goto-char (point-min))))))))
;;启动mew
(autoload 'mew "mew" nil t)
(autoload 'mew-send "mew" nil t)
(if (boundp 'read-mail-command)
(setq read-mail-command 'mew))
(autoload 'mew-user-agent-compose "mew" nil t)
(if (boundp 'mail-user-agent)
(setq mail-user-agent 'mew-user-agent))
(if (fboundp 'define-mail-user-agent)
(define-mail-user-agent
'mew-user-agent
'mew-user-agent-compose
'mew-draft-send-message
'mew-draft-kill
'mew-send-hook))
(setq mew-use-cached-password t)
(require 'color-theme)
(color-theme-calm-forest)
(setq user-full-name "B.Qnyd")
(setq user-mail-address "bb.qnyd@gmail.com")
;;w 写信
;;M-TAB 补齐收信人信息
;;Q 退出mew
;;i 收信
;;g 跳转邮箱
;;o 对邮件进行分类
;;d 把邮件标记为删除
;;* 作星号标记
;;u 清除标记
;;x 对所有标记进行处理
;;a 不带引用的回复,不建议使用
;;A 带引用的回复,推荐
;;f 转发邮件
;;y 保存邮件,会提示是保存整个邮件和是仅保存正文
;;SPACE 阅读邮件
;;ENTER 让阅读的邮件向上滚动一行
;;- 向下滚动一行
;;n 下一封邮件
;;p 前一封邮件
;;j 跳到某一封邮件
;;N 下一封带星号的邮件
;;P 上一封带星号的邮件
;;S 按某个指定项目对邮件排序
;;/ 按指定条件搜索邮件,并进入虚拟模式
;;tt 进入虚拟模式,根据线索查看,普通模式下是不可以的
;;C 如果设置了多个邮箱,用此切换
;;C-cC-m 编辑新邮件,放入草稿中
;;C-cC-c 发送邮件
;;C-cC-q 取消草稿
;;C-cC-a 插入附件
;;C-cTAB 插入签名
;;C-cC-l 转换当前邮件的编码格式
;;C-cC-y 复制部分邮件,带引用前缀
;;C-cC-t 复制部分邮件,不带引用前缀
;;C-cC-a 把当前的发信人加入地址薄
;;C-uC-cC-a 比C-cC-a多加入昵称和名字,推荐
(global-set-key [f6] 'mew)
(auto-image-file-mode);打开图片显示功能
(if window-system
(autoload 'keisen-mode "keisen-mouse" "MULE table" t)
(autoload 'keisen-mode "keisen-mule" "MULE table" t))
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(add-hook 'laTeX-mode-hook 'turn-on-reftex)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(setq org-todo-keywords
'((sequence "TODO(t)" "DOING(i!)" "HANGUP(h!)" "|" "DONE(d!)" "CANCEL(c!)")))
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
;;;;~/.mew.el 这个文件没有需要新建... 还有个密码保存没有,没搞定...
;;;; 谁知道enail发给我看看..email:bb.qnyd@gmail.com
;; Mew limits the size of receiveing messages to 54KB in default.
;; Messages larger than 54KB will marked 'T' by Mew. You can receive
;; the entire messages later.
;; This setting makes Mew remove the limitation. See Mew FAQ 3.2
(setq mew-pop-size 0)
;;(setq mew-imap-prefix-list '("#mh/" "#mhinbox"))
;;(setq mew-auto-get t)
(setq toolbar-mail-reader 'Mew)
;; input passwd once and won't ask anymore untill quit Mew.
(setq mew-use-cached-passwd t)
(setq mew-passwd-timer-unit 999)
(setq mew-passwd-lifetime 999)
(set-default 'mew-decode-quoted 't)
(setq mew-prog-pgp "gpg")
;; leave messages in mail server
(setq mew-pop-ssl-port t)
(setq mew-pop-delete t)
;; mark the unread mail with a 'U'
(setq mew-use-unread-mark t)
;; Send the mails in +queue when enter `i'.
;;(setq mew-auto-flush-queue t)
(setq mew-ssl-verify-level 0)
(setq mew-prog-ssl "/usr/bin/stunnel")
(setq mew-config-alist
;;Gmail
;; misc
'(
("default"
("name" . "B.Qnyd")
("user" . "bb.qnyd")
("mail-domain" . "gmail.com")
("proto" . "+")
("pop-ssl" . t)
("prog-ssl" . "/usr/bin/stunnel")
("pop-auth" . pass)
("pop-server" . "pop.gmail.com")
("pop-ssl-port" . "995")
("pop-user" . "bb.qnyd@gmail.com")
("smtp-ssl" . t)
("smtp-ssl-port". "465")
("smtp-auth-list" . ("PLAIN" "LOGIN" "CRAM-MD5"))
("smtp-user" . "bb.qnyd@gmail.com")
("smtp-server" . "smtp.gmail.com"))))
;;Thread
;;(setq mew-prog-imls-arg-list '("--thread=yes" "--indent=2"))
;;(setq mew-use-fancy-thread t)
;;(setq mew-fancy-thread-indent-strings [" +" " +" " |" " "] )
;;(setq mew-use-thread-separator nil)
;;(setq mew-thread-separator "--")
;; Open a html mail in external browser
;; You must open the browser manually first.
;; Look -> http://www.mew.org/pipermail/mew-int/2005-March/001530.html
;; only Mozilla or Firefox is valid.No support Opera.
;; Look -> http://www.mew.org/pipermail/mew-int/2007-June/001814.html
;;(setq mew-prog-text/html-ext
;;'("firefox" ("-a" "firefox" "-remote" "openFile(%s)") t))
;; Signature
(setq mew-signature-file "~/Mail/signature")
(setq mew-signature-insert-last t)
;; Biff - check new mail
(setq mew-use-biff t) ;; nil
(setq mew-use-biff-bell t) ;; nil
(setq mew-pop-biff-interval 5) ;; 5 (minutes)
;; cite
(setq mew-cite-fields '("From:" "Subject:" "Date:" "Message-ID:"))
(setq mew-cite-format "From: %s\nSubject: %s\nDate: %s\nMessage-ID: %s\n\n")
(setq mew-refile-guess-alist
'((nil . "%[Gmail]/All Mail")))
(auto-image-file-mode);打开图片显示功能
没有评论:
发表评论