emacs配置

 

; 指针颜色设置为白色
(set-cursor-color "white")
;; 鼠标颜色设置为白色
(set-mouse-color "white")


;; 从color-theme中获取
;; 网上下载color-theme.el,放到加载路径(/usr/share/emacs/site-lisp )下
;; M-x color-theme-select,鼠标左键选中,回车查看效果
;; d查看信息,将出现如下信息:
;; color-theme-matrix is an interactive Lisp function in `color-theme.el'.
;; (color-theme-matrix)
;; Color theme by walterh@rocketmail.com, created 2003-10-16.
;; 选择(color-theme-blue-mood)即可
;;(require 'color-theme)
;;(setq color-theme-is-global t)
;;(color-theme-wheat)

;; 一打开就起用 text 模式。
(setq default-major-mode 'text-mode)

;; 语法高亮
(global-font-lock-mode t)

;; 以 y/n代表 yes/no
(fset 'yes-or-no-p 'y-or-n-p)

;; 显示括号匹配
(show-paren-mode t)
(setq show-paren-style 'parentheses)

;; 显示时间,格式如下
(display-time-mode 1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)

(transient-mark-mode t)

;; 支持emacs和外部程序的粘贴
(setq x-select-enable-clipboard t)

;; 在标题栏提示你目前在什么位置
(setq frame-title-format "zhj@%b")

;; 默认显示 80列就换行
(setq default-fill-column 80)

;; 去掉工具栏
(tool-bar-mode nil)

;;去掉菜单栏
(menu-bar-mode nil)

;; 去掉滚动栏
(scroll-bar-mode nil)

;; 设置字体
;; 方法为: emacs->options->Set Default Font->"M-x describe-font"查看当前使用的字体名称、字体大小
(set-default-font " -bitstream-Courier 10 Pitch-normal-normal-normal-*-16-*-*-*-m-0-iso10646-1")

;; 显示列号
(setq column-number-mode t)
(setq line-number-mode t)

;; 设置默认tab宽度为2
(setq tab-width 2
indent-tabs-mode t
c-basic-offset 2)

;; 回车缩进
(global-set-key "\C-m" 'newline-and-indent)
(global-set-key (kbd "C-<return>") 'newline)

 

 

 

;; 启动窗口大小
(setq default-frame-alist
'((height . 35) (width . 125) (menu-bar-lines . 20) (tool-bar-lines . 0)))
;; author: chinazhangjie
;; e-mail: chinajiezhang@gmail.com

;; 指针颜色设置为白色
(set-cursor-color "white")
;; 鼠标颜色设置为白色
(set-mouse-color "white")
;;------------语言环境字符集设置(utf-8)-------------
(defun qiang-font-existsp (font)
(if (null (x-list-fonts font))
nil t))
(defvar font-list '("宋体" "新宋体" "Microsoft Yahei" "文泉驿等宽微米黑" "黑体" ))
(require 'cl) ;; find-if is in common list package
(find-if #'qiang-font-existsp font-list)
(defun qiang-make-font-string (font-name font-size)
(if (and (stringp font-size)
(equal ":" (string (elt font-size 0))))
(format "%s%s" font-name font-size)
(format "%s %s" font-name font-size)))
(defun qiang-set-font (english-fonts
english-font-size
chinese-fonts
&optional chinese-font-size)
"english-font-size could be set to \":pixelsize=18\" or a integer.
If set/leave chinese-font-size to nil, it will follow english-font-size"
(require 'cl) ; for find if
(let ((en-font (qiang-make-font-string
(find-if #'qiang-font-existsp english-fonts)
english-font-size))
(zh-font (font-spec :family (find-if #'qiang-font-existsp chinese-fonts)
:size chinese-font-size)))

;; Set the default English font
;;
;; The following 2 method cannot make the font settig work in new frames.
;; (set-default-font "Consolas:pixelsize=18")
;; (add-to-list 'default-frame-alist '(font . "Consolas:pixelsize=18"))
;; We have to use set-face-attribute
(message "Set English Font to %s" en-font)
(set-face-attribute
'default nil :font en-font)

;; Set Chinese font
;; Do not use 'unicode charset, it will cause the english font setting invalid
(message "Set Chinese Font to %s" zh-font)
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font (frame-parameter nil 'font)
charset
zh-font))))
(qiang-set-font
'("Consolas" "Monaco" "DejaVu Sans Mono" "Monospace" "Courier New") ":pixelsize=15"
'("宋体" "新宋体" "Microsoft Yahei" "文泉驿等宽微米黑" "黑体" ))
;;Setting English Font
;;(set-face-attribute 'default nil :font "Consolas 12")

;; Chinese Font
;;(dolist (charset '(kana han symbol cjk-misc bopomofo)) (set-fontset-font (frame-parameter nil 'font) charset (font-spec :family "Microsoft Yahei" :size 12)))
;;处理shell-mode乱码,好像没作用

;;------语言环境字符集设置结束------------



;;--------------窗口界面设置------------------

(set-foreground-color "grey")
(set-background-color "black")
(set-cursor-color "gold1")
(set-mouse-color "gold1")

(set-scroll-bar-mode nil)
;;取消滚动栏

;;(customize-set-variable 'scroll-bar-mode 'right))
;;设置滚动栏在窗口右侧,而默认是在左侧

(tool-bar-mode nil)
;;取消工具栏

;;启动设置
;;(setq default-frame-alist '((vertical-scroll-bars) (top . 25) (left . 45) (width . 180) (height . 55)
;;(background-color . "black") (foreground-color . "grey")(cursor-color . "gold1") (mouse-color . "gold1") (tool-bar-lines . 0) (menu-bar-lines . 1) (right-fringe) (left-fringe)))

;;启动自动最大化(数据自己调整,注意格式,如(top . 0),圆点前后都要留有空格)
(setq initial-frame-alist '((top . 0) (left . 0) (width . 120) (height . 36)))


;; 设置另外一些颜色:语法高亮显示的背景和主题,区域选择的背景和主题,二次选择的背景和选择
(set-face-foreground 'highlight "white")
(set-face-background 'highlight "blue")
(set-face-foreground 'region "cyan")
(set-face-background 'region "blue")
(set-face-foreground 'secondary-selection "skyblue")
(set-face-background 'secondary-selection "darkblue")

;;------------窗口界面设置结束-----------------

;;------------显示时间设置------------------------------

(display-time-mode 1);;启用时间显示设置,在minibuffer上面的那个杠上
(setq display-time-24hr-format t);;时间使用24小时制
(setq display-time-day-and-date t);;时间显示包括日期和具体时间
(setq display-time-use-mail-icon t);;时间栏旁边启用邮件设置
(setq display-time-interval 10);;时间的变化频率,单位多少来着?

;;------------显示时间设置结束--------------

;;------------定制操作习惯--------------------

;;设置打开文件的缺省路径
;;(setq default-directory "~/")
;;(setenv "HOME" "D:/My Documents/Visual Studio 2008/Projects")
;;(setenv "PATH" "D:/My Documents/Visual Studio 2008/Projects")
;;set the default file path
(setq default-directory "~/")

;;------------------------------------------

;;ido的配置,这个可以使你在用C-x C-f打开文件的时候在后面有提示;
;;这里是直接打开了ido的支持,在emacs23中这个是自带的.
(ido-mode t)

(setq ido-save-directory-list-file nil)
;;ido模式中不保存目录列表,解决退出Emacs时ido要询问编码的问题。

;;(setq visible-bell t)
;;关闭烦人的出错时的提示声

(setq inhibit-startup-message t)
;;关闭emacs启动时的画面

(setq gnus-inhibit-startup-message t)
;;关闭gnus启动时的画面

(fset 'yes-or-no-p 'y-or-n-p)
;; 改变 Emacs 固执的要你回答 yes 的行为。按 y 或空格键表示 yes,n 表示 no。

(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)))
;; 语法高亮。除 shell-mode 和 text-mode 之外的模式中使用语法高亮。

(setq column-number-mode t)
(setq line-number-mode t)
;;显示行列号
(global-linum-mode t)
(setq mouse-yank-at-point t)
;;不要在鼠标点击的那个地方插入剪贴板内容。我不喜欢那样,经常把我的文档搞的一团糟。我觉得先用光标定位,然后鼠标中键点击要好的多。不管你的光标在文档的那个位置,或是在 minibuffer,鼠标中键一点击,X selection 的内容就被插入到那个位置。

(setq kill-ring-max 200)
;;设置粘贴缓冲条目数量.用一个很大的kill ring(最多的记录个数). 这样防止我不小心删掉重要的东西

(setq-default auto-fill-function 'do-auto-fill)
; Autofill in all modes;;
(setq default-fill-column 120)
;;把 fill-column 设为 60. 这样的文字更好读

(setq-default indent-tabs-mode nil)
(setq default-tab-width 8);;tab键为8个字符宽度
(setq tab-stop-list ())
;;不用 TAB 字符来indent, 这会引起很多奇怪的错误。编辑 Makefile 的时候也不用担心,因为 makefile-mode 会把 TAB 键设置成真正的 TAB 字符,并且加亮显示的。

(setq sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
(setq sentence-end-double-space nil)
;;设置 sentence-end 可以识别中文标点。不用在 fill 时在句号后插入两个空格。

(setq enable-recursive-minibuffers t)
;;可以递归的使用 minibuffer

(setq scroll-margin 3 scroll-conservatively 10000)
;;防止页面滚动时跳动, scroll-margin 3 可以在靠近屏幕边沿3行时就开始滚动,可以很好的看到上下文。

(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
;;设置缺省主模式是text,,并进入auto-fill次模式.而不是基本模式fundamental-mode

(show-paren-mode t)
;;打开括号匹配显示模式

(setq show-paren-style 'parenthesis)
;;括号匹配时可以高亮显示另外一边的括号,但光标不会烦人的跳到另一个括号处。

(mouse-avoidance-mode 'animate)
;;光标靠近鼠标指针时,让鼠标指针自动让开,别挡住视线。

(setq frame-title-format "emacs@%b")
;;在标题栏显示buffer的名字,而不是 emacs@wangyin.com 这样没用的提示。

(setq uniquify-buffer-name-style 'forward);;好像没起作用
;; 当有两个文件名相同的缓冲时,使用前缀的目录名做 buffer 名字,不用原来的foobar<?> 形式。

(setq auto-image-file-mode t)
;;让 Emacs 可以直接打开和显示图片。

;(auto-compression-mode 1)
;打开压缩文件时自动解压缩。

(setq global-font-lock-mode t)
;;进行语法加亮。

(setq-default kill-whole-line t)
;; 在行首 C-k 时,同时删除该行。

(add-hook 'comint-output-filter-functions
'comint-watch-for-password-prompt)
;;当你在shell、telnet、w3m等模式下时,必然碰到过要输入密码的情况,此时加密显出你的密码

;;(setq version-control t);;启用版本控制,即可以备份多次
;; (setq kept-old-versions 2);;备份最原始的版本两次,及第一次编辑前的文档,和第二次编辑前的文档
;; (setq kept-new-versions 1);;备份最新的版本1次,理解同上
;; (setq delete-old-versions t);;删掉不属于以上3中版本的版本
;; (setq backup-directory-alist '(("." . "~/backups")));;设置备份文件的路径
;; (setq backup-by-copying t);;备份设置方法,直接拷贝
;; Emacs 中,改变文件时,默认都会产生备份文件(以 ~ 结尾的文件)。可以完全去掉; (并不可取),也可以制定备份的方式。这里采用的是,把所有的文件备份都放在一个固定的地方("~/backups")。对于每个备份文件,保留最原始的两个版本和最新的1个版本。并且备份的时候,备份文件是复本,而不是原件。

(setq make-backup-files nil)
;; 设定不产生备份文件

;;(setq auto-save-mode nil)
;;自动保存模式

(setq-default make-backup-files 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)
;;把这些缺省禁用的功能打开。

;;允许emacs和外部其他程序的粘贴
(setq x-select-enable-clipboard t)

;;(setq mouse-yank-at-point t)
;;使用鼠标中键可以粘贴

(setq user-full-name "Bluesky")
(setq user-mail-address "whuchenxi2010@gmail.com")
;;设置有用的个人信息,这在很多地方有用。

(setq require-final-newline t)
;; 自动的在文件末增加一新行

(setq-default transient-mark-mode t)
;;Non-nil if Transient-Mark mode is enabled.

(setq track-eol t)
;; 当光标在行尾上下移动的时候,始终保持在行尾。

(setq Man-notify-method 'pushy)
;; 当浏览 man page 时,直接跳转到 man buffer。

;;(setq next-line-add-newlines nil)
;;Emacs 21 中已经是缺省设置。按 C-n 或向下键时不添加新行。

(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)
;;设置home键指向buffer开头,end键指向buffer结尾


(global-set-key (kbd "C-,") 'scroll-left)
;; "C-,"设为屏幕左移命令
(global-set-key (kbd "C-.") 'scroll-right)
;; "C-."设为屏幕右移命令

(global-set-key [f1] 'manual-entry)
(global-set-key [C-f1] 'info )

;;(global-set-key [f2] 'emacs-wiki-find-file)
;;打开wiki

;;(global-set-key [f3] 'repeat-complex-command)

;;(global-set-key [f4] 'other-window)
;; 跳转到 Emacs 的另一个buffer窗口

(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)
;; C-f5, 设置编译命令; f5, 保存所有文件然后编译当前窗口文件

(global-set-key [f6] 'gdb)
;;F6设置为在Emacs中调用gdb

(global-set-key [C-f7] 'previous-error)
(global-set-key [f7] 'next-error)

(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)
;;目的是开一个shell的小buffer,用于更方便地测试程序(也就是运行程序了),我经常会用到。
;;f8就是另开一个buffer然后打开shell,C-f8则是在当前的buffer打开shell

(setq speedbar-show-unknown-files t);;可以显示所有目录以及文件
(setq dframe-update-speed nil);;不自动刷新,手动 g 刷新
(setq speedbar-update-flag nil)
(setq speedbar-use-images nil);;不使用 image 的方式
(setq speedbar-verbosity-level 0)

(global-set-key [f9] 'speedbar)
;;设置f9调用speedbar命令
;;使用 n 和 p 可以上下移动,
;; + 展开目录或文件进行浏览,- 收缩,RET 访问目录或文件,g 更新 speedbar。

(setq dired-recursive-copies 'top)
(setq dired-recursive-deletes 'top)
;;让 dired 可以递归的拷贝和删除目录。
(global-set-key [C-f9] 'dired)
;;设置[C-f9]为调用dired命令

(global-set-key [f10] 'undo)
;;设置F10为撤销

(global-set-key [f11] 'calendar)
;;设置F11快捷键指定Emacs 的日历系统

(global-set-key [f12] 'list-bookmarks)
;;设置F12 快速察看日程安排

(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

(global-set-key (kbd "C-SPC") 'nil)
;;取消control+space键设为mark

(global-set-key (kbd "s-SPC") 'set-mark-command)
;;用win+space键来set-mark,这样,C-SPC就可以用来调用外部输入法了。
(setq-default cursor-type 'bar)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cedet设置结束;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ecb设置;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(setq ecb-tip-of-the-day nil)
(add-to-list 'load-path "/usr/share/emacs/site-lisp/ecb")
(load-file "/usr/share/emacs/site-lisp/ecb/ecb.el")
(require 'ecb)
(setq ecb-auto-activate t
ecb-tip-of-the-day nil
ecb-tree-indent 4
ecb-windows-height 0.5
ecb-windows-width 0.15
ecb-auto-compatibility-check nil
ecb-version-check nil
inhibit-startup-message t
)
;; Ecb的操作:
;; C-c . g d 目录列表窗口
;; C-c . g s 源码窗口
;; C-c . g m 方法和变量窗口
;; C-c . g h 历史窗口
;; C-c . g l 最后选择过的编辑窗口
;; C-c . g 1 编辑窗口1
;; C-c . g n 编辑窗口n
;; C-c . l c 选择版面
;; C-c . l r 重画版面
;; C-c . l t 拴牢版面(锁定版面)
;; C-c . l w 拴牢可见的ecb窗口
;; C-c . / 拴牢编绎窗口
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ecb设置结束;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;自动补全设置(工作不理想);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;C/C++语言启动时自动加载semantic对/usr/include的索引数据库
;(setq semanticdb-search-system-databases t)
; (add-hook 'c-mode-common-hook
; (lambda ()
; (setq semanticdb-project-system-databases
; (list (semanticdb-create-database
; semanticdb-new-database-class
; "/usr/include")))))

;; project root path
;(setq semanticdb-project-roots
; (list
; (expand-file-name "/")))
;; 避免semantic占用CPU过多
;(setq-default semantic-idle-scheduler-idle-time 432000);
;(defun my-indent-or-complete ()
; (interactive)
; (if (looking-at "\\>")
; (hippie-expand nil)
; (indent-for-tab-command)))
;(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
; )
;)

;(global-set-key [M-/] 'hippie-expand)
;右Ctrl+\ 自动补全menu

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;自动补全设置结束;;;;;;;;;;;;;;;;;;;;;;;;;;



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;补全扩弧配置(没什么用);;;;;;;;;;;;;;;;;;;;;;;;;;
;(defun my-c-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))
;(add-hook 'c-mode-hook 'my-c-mode-auto-pair)
;(add-hook 'c++-mode-hook 'my-c-mode-auto-pair)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;补全扩弧配置结束;;;;;;;;;;;;;;;;;;;;;;;;;;
;(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.
; '(scroll-bar-mode (quote right))
; '(tool-bar-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 "black" :foreground "grey" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight bold :height 120 :width normal :foundry "unknown" :family "Tlwg Typo")))))
(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-options-version "2.40"))
;; 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-options-version "2.40"))
;;(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.
; )


;===================== 文件头header设置 ===========================
;;当我们保存文件的时候,有很多信息可以自动更新.如何自动更新信息, 更新那些信息,
;也是可以完全自己配置. 包括文件名称,最后一次修改时间,文件保存次数,最后一次修改的作者等等.
;;可以用 M-x make-header 自动生成文件头信息.
;(add-to-list 'load-path "~/lisp/header")
;(require 'header)
;(setq make-header-hooks '(header-mode-line

; header-blank
; header-file-name
; header-blank
; header-copyright
; header-blank
; header-author
; header-creation-date
; header-modification-author
; header-modification-date
; header-update-count
; header-blank
; header-history
; header-blank
; ))
;(setq header-copyright-notice " 源成工作室 作品" )
;(make-local-variable 'user-full-name)
;(make-local-variable 'user-mail-address)

;===================== 文件头header设置结束 ==========================


;(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 'perl-mode-hook 'hs-minor-mode)
;(add-hook 'php-mode-hook 'hs-minor-mode)
;(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
;;能把一个代码块缩起来,需要的时候再展开
;; 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


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;定制操作习惯;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;设置打开文件的缺省路径
(setq default-directory "/")

;;ido的配置,这个可以使你在用C-x C-f打开文件的时候在后面有提示;
;;这里是直接打开了ido的支持,在emacs23中这个是自带的.
(ido-mode t)

(setq visible-bell t)
;;关闭烦人的出错时的提示声
(setq inhibit-startup-message t)
;;关闭emacs启动时的画面

(setq gnus-inhibit-startup-message t)
;;关闭gnus启动时的画面

(fset 'yes-or-no-p 'y-or-n-p)
;; 改变 Emacs 固执的要你回答 yes 的行为。按 y 或空格键表示 yes,n 表示 no。

;(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)))
;; 语法高亮。除 shell-mode 和 text-mode 之外的模式中使用语法高亮。

(setq column-number-mode t)
(setq line-number-mode t)
;;显示行列号

(setq mouse-yank-at-point t)
;;不要在鼠标点击的那个地方插入剪贴板内容。我不喜欢那样,经常把我的文档搞的一团糟。我觉得先用光标定位,然后鼠标中键点击要好的多。不管你的光标在文档的那个位置,或是在 minibuffer,鼠标中键一点击,X selection 的内容就被插入到那个位置。

(setq kill-ring-max 200)
;;设置粘贴缓冲条目数量.用一个很大的kill ring(最多的记录个数). 这样防止我不小心删掉重要的东西

(setq-default auto-fill-function 'do-auto-fill)
; Autofill in all modes;;
(setq default-fill-column 80)
;;把 fill-column 设为 60. 这样的文字更好读

;(setq-default indent-tabs-mode nil)
;(setq default-tab-width 8)
;(setq tab-stop-list ())
;;不用 TAB 字符来indent, 这会引起很多奇怪的错误。编辑 Makefile 的时候也不用担心,因为 makefile-mode 会把 TAB 键设置成真正的 TAB 字符,并且加亮显示的。

;(setq sentence-end "//([。!?]//|……//|[.?!][]/"')}]*//($//|[ /t]//)//)[ /t/n]*")
;(setq sentence-end-double-space nil)
;;设置 sentence-end 可以识别中文标点。不用在 fill 时在句号后插入两个空格。

(setq enable-recursive-minibuffers t)
;;可以递归的使用 minibuffer

(setq scroll-margin 3 scroll-conservatively 10000)
;;防止页面滚动时跳动, scroll-margin 3 可以在靠近屏幕边沿3行时就开始滚动,可以很好的看到上下文。

;(setq default-major-mode 'text-mode)
;(add-hook 'text-mode-hook 'turn-on-auto-fill)
;;设置缺省主模式是text,,并进入auto-fill次模式.而不是基本模式fundamental-mode

(setq show-paren-mode t) ;;打开括号匹配显示模式
(setq show-paren-style 'parenthesis)
;;括号匹配时可以高亮显示另外一边的括号,但光标不会烦人的跳到另一个括号处。

(setq mouse-avoidance-mode 'animate)
;;光标靠近鼠标指针时,让鼠标指针自动让开,别挡住视线。

(setq frame-title-format "emacs@%b")
;;在标题栏显示buffer的名字,而不是 emacs@wangyin.com 这样没用的提示。

;(setq uniquify-buffer-name-style 'forward);;好像没起作用
;; 当有两个文件名相同的缓冲时,使用前缀的目录名做 buffer 名字,不用原来的foobar<?> 形式。

(setq auto-image-file-mode t)
;;让 Emacs 可以直接打开和显示图片。

;(auto-compression-mode 1)
;打开压缩文件时自动解压缩。

(setq global-font-lock-mode t)
;;进行语法加亮。

(setq-default kill-whole-line t)
;; 在行首 C-k 时,同时删除该行。

;(add-hook 'comint-output-filter-functions
; 'comint-watch-for-password-prompt)
;;当你在shell、telnet、w3m等模式下时,必然碰到过要输入密码的情况,此时加密显出你的密码

; (setq version-control t);;启用版本控制,即可以备份多次
; (setq kept-old-versions 2);;备份最原始的版本两次,及第一次编辑前的文档,和第二次编辑前的文档
; (setq kept-new-versions 1);;备份最新的版本1次,理解同上
;; (setq delete-old-versions t);;删掉不属于以上3中版本的版本
;; (setq backup-directory-alist '(("." . "~/backups")));;设置备份文件的路径
;; (setq backup-by-copying t);;备份设置方法,直接拷贝
;; Emacs 中,改变文件时,默认都会产生备份文件(以 ~ 结尾的文件)。可以完全去掉
;; (并不可取),也可以制定备份的方式。这里采用的是,把所有的文件备份都放在一
;; 个固定的地方("~/backups")。对于每个备份文件,保留最原始的两个版本和最新的
;; 1个版本。并且备份的时候,备份文件是复本,而不是原件。

;(setq make-backup-files nil)
;; 设定不产生备份文件

;(setq auto-save-mode nil)
;;自动保存模式

;(setq-default make-backup-files 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)
;;把这些缺省禁用的功能打开。

;;允许emacs和外部其他程序的粘贴
(setq x-select-enable-clipboard t)

(setq mouse-yank-at-point t)
;;使用鼠标中键可以粘贴

(setq user-full-name "highspeed")
(setq user-mail-address "woshihighspeed@163.com")
;;设置有用的个人信息,这在很多地方有用。

(setq require-final-newline t)
;; 自动的在文件末增加一新行

;(setq-default transient-mark-mode t)
;;Non-nil if Transient-Mark mode is enabled.

(setq track-eol t)
;; 当光标在行尾上下移动的时候,始终保持在行尾。

(setq Man-notify-method 'pushy)
;; 当浏览 man page 时,直接跳转到 man buffer。

;(setq next-line-add-newlines nil)
;;Emacs 21 中已经是缺省设置。按 C-n 或向下键时不添加新行。

(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)
;;设置home键指向buffer开头,end键指向buffer结尾


(global-set-key (kbd "C-,") 'scroll-left)
;; "C-,"设为屏幕左移命令
(global-set-key (kbd "C-.") 'scroll-right)
;; "C-."设为屏幕右移命令

;(global-set-key [f1] 'manual-entry)
;(global-set-key [C-f1] 'info )

;(global-set-key [f3] 'repeat-complex-command)

;(global-set-key [f4] 'other-window)
;; 跳转到 Emacs 的另一个buffer窗口


(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)
;; C-f5, 设置编译命令; f5, 保存所有文件然后编译当前窗口文件

(global-set-key [f6] 'gdb)
;;F6设置为在Emacs中调用gdb

;(global-set-key [C-f7] 'previous-error)
;(global-set-key [f7] 'next-error)

(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)
;;目的是开一个shell的小buffer,用于更方便地测试程序(也就是运行程序了),我经常会用到。
;;f8就是另开一个buffer然后打开shell,C-f8则是在当前的buffer打开shell

(setq speedbar-show-unknown-files t);;可以显示所有目录以及文件
(setq dframe-update-speed nil);;不自动刷新,手动 g 刷新
(setq speedbar-update-flag nil)
(setq speedbar-use-images nil);;不使用 image 的方式
(setq speedbar-verbosity-level 0)

;(global-set-key [f9] 'speedbar)
;;设置f9调用speedbar命令
;;使用 n 和 p 可以上下移动,
;; + 展开目录或文件进行浏览,- 收缩,RET 访问目录或文件,g 更新 speedbar。

(setq dired-recursive-copies 'top)
(setq dired-recursive-deletes 'top)
;;让 dired 可以递归的拷贝和删除目录。
(global-set-key [C-f9] 'dired)
;;设置[C-f9]为调用dired命令

(global-set-key [f10] 'undo)
;;设置F10为撤销

;(global-set-key [f11] 'calendar)
;;设置F11快捷键指定Emacs 的日历系统

(global-set-key [f12] 'list-bookmarks)
;;设置F12 快速察看日程安排

(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

;(global-set-key (kbd "C-SPC") 'nil)
;;取消control+space键设为mark

(global-set-key (kbd "M-<SPC>") 'set-mark-command)
;;这样 我就不用按 C-@ 来 setmark 了, C-@ 很不好按。

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;定制操作习惯结束;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;格式化整个文件函数
(defun indent-whole ()
(interactive)
(indent-region (point-min) (point-max))
(message "format successfully"))
;;绑定到F7键
(global-set-key [f7] 'indent-whole)
(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.
)




;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;=========================================================================
(setq semantic-load-turn-everything-on t)
;(add-hook 'semantic-init-hooks 'semantic-idle-completions-mode)

(setq semanticdb-project-roots
(list
(expand-file-name "/")))
;;配置Semantic的检索范围

(setq semanticdb-default-save-directory "~/")
;;设置semantic.cache路径

(global-set-key [(meta ?/)] 'hippie-expand)
;;M-/ 绑定到 hippie-expand

(autoload 'senator-try-expand-semantic "senator")
(setq hippie-expand-try-functions-list
'(senator-try-expand-semantic ;优先调用了senator的分析结果
try-expand-dabbrev ;当前的buffer补全
try-expand-dabbrev-visible ;别的可见的窗口里寻找补全
try-expand-dabbrev-all-buffers ;所有打开的buffer
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))
;设置 hippie-expand 的补全方式。它是一个优先列表, hippie-expand 会优先使用表最前面的函数来补全。

;=========================================================================


;=====================GDB调试多窗口====================
;(setq gdb-many-windows t)

;(load-library "multi-gud.el")
;(load-library "multi-gdb-ui.el")
;====================================================

;========================================================================

;(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 'perl-mode-hook 'hs-minor-mode)
;(add-hook 'php-mode-hook 'hs-minor-mode)
;(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
;;能把一个代码块缩起来,需要的时候再展开
;; 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

;========================================================================

转载于:https://www.cnblogs.com/wuyuans/p/4214088.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/273455.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

自然连接(NATURAL JOIN)

自然连接&#xff08;NATURAL JOIN&#xff09;是一种特殊的等价连接&#xff0c;它将表中具有相同名称的列自动进行记录匹配。自然连接不必指定任何同等连接条件。图9.9给出了典型的自然连接示意图。 图9.9 自然连接 自然连接自动判断相同名称的列&#xff0c;而后形成匹配。…

iis express8 自动关闭

引用&#xff1a;http://www.cnblogs.com/chunCui/p/3522619.html 问题&#xff1a;最近使用vs2013开发个web &#xff0c; 每次调试结束时iis express 8 也会自动关闭 解决方法&#xff1a;web项目-属性-web-调试器-只选中ASP.Net就可以了 转载于:https://www.cnblogs.com/qqq…

自连接

9.3 表的连接类型 9.3.1 自连接 自连接是指表与其自身进行连接&#xff0c;这就需要用到前面介绍的表别名。下面通过一个具体实例来讲解自连接的应用。 实例5 自连接的使用方法 查询成绩中存在不及格课程的学生的姓名、所在系、所有的课程及成绩信息。如果采用前面介绍的…

从此记录

从此记录工作、学习、生活的那些事儿&#xff01;转载于:https://www.cnblogs.com/alwaysjava/p/4221362.html

LIKE运算符

6.5 使用LIKE进行模糊查询 当只知道部分字符串时&#xff0c;可使用LIKE运算符来查询数据库&#xff0c;找出与其相关的整个字符串。因此&#xff0c;当把关键字LIKE用在WHERE子句中时&#xff0c;可以比较两个字符串的部分匹配。当对字符串内容有些印象&#xff0c;但并不知…

AND运算符

6.2 组合查询条件 在前一章提到的WHERE子句进行查询时&#xff0c;WHERE子句后面的搜索条件只是单一的。实际上&#xff0c;可以通过布尔运算符AND和OR&#xff0c;将多个单独的搜索条件结合在一个WHERE子句中&#xff0c;形成一个复合的搜索条件。当对复合搜索条件求值时&a…

Cron表达式【一】

Cron表达式【一】 Cron表达式被用来配置CronTrigger实例。 Cron表达式是一个由 7个子表达式组成的字符串。每个子表达式都描述了一个单独的日程细节。这些子表达式用空格分隔&#xff0c;分别表示&#xff1a; 1. Seconds 秒 2. Minutes 分钟 3. Hours 小时 4. Day-of-Month 月…

OR运算符

6.2.2 OR运算符 OR运算符表示“或”的关系。当可能有多个条件为True&#xff0c;但只要有一个为True就满足搜索要求时&#xff0c;可以使用OR运算符来组合搜索条件。OR在结合两个布尔表达式时&#xff0c;只要其中一个条件为True时&#xff0c;便传回True。OR运算符的真值表…

Java基础---网络编程

第一讲 概述 1、网络模型&#xff1a;OSI参考模型和TCP/IP参考模型 图示&#xff1a; 一般来说开发处于传输层和网际层&#xff0c;应用层为&#xff1a;FTP和HTTP协议等&#xff0c;传输层为&#xff1a;UDP和TCP等&#xff0c;网际层为&#xff1a;IP。 通常用户操作的是…

AND、OR运算符的组合使用

6.2.3 AND、OR运算符的组合使用 在WHERE子句中&#xff0c;通过AND、OR运算符可以同时连接多个条件&#xff0c;当然AND、OR运算符也可以同时使用。但是当AND、OR运算符同时存在时&#xff0c;其优先级如何确定呢&#xff1f;与大多数语言一样&#xff0c;SQL语言认为AND运算…

Nginx配置指定媒体类型文件强制下载

由于业务需要&#xff0c;在点击显示链接&#xff08;如www.xxx.com/2015-01-15/xxx.png&#xff09;显示媒体资源&#xff08;如图片、视频、音频、文档&#xff09;&#xff0c;而在点击下载链接&#xff08;如www.xxx.com/2015-01-15/xxx.png?downloadtrue&#xff09;请求…

IN运算符的使用

6.3 IN运算符 在查询中&#xff0c;有时只要满足多个条件中的一个条件即可&#xff0c;如查询地址在北京、上海或者重庆的学生信息&#xff0c;这时候可以使用IN运算符。 6.3.1 IN运算符的使用 IN运算符允许根据一行记录中&#xff0c;是否有一列包括在一系列值之中&#…

app后端设计(php)

来源&#xff1a;http://blog.csdn.net/column/details/mobilebackend.html?page1 做了3年app相关的系统架构&#xff0c;api设计&#xff0c;先后在3个创业公司中工作&#xff0c;经历过手机网页端&#xff0c;android客户端&#xff0c;iphone客户端&#xff0c;现在从事日p…

NOT运算符与运算符

6.4.2 NOT运算符与<>运算符 对于简单的条件查询&#xff0c;NOT运算符与<>运算符的功能几乎没有什么区别&#xff0c;那么NOT运算符的优势体现在哪里呢&#xff1f;答案是它可以与其他运算符组合使用&#xff0c;这一点是<>运算符所不能实现的。在6.4.1节已…

bootstrap-wysiwyg 结合 base64 解码 .net bbs 图片操作类 (三) 图片裁剪

官方的例子 是 长方形的。 我这里 用于 正方形的头像 所以 做如下 修改 #preview-pane .preview-container {width: 73px;height: 73px;overflow: hidden;} 可惜很莫名奇妙的是 有的时候 他自动把图片 变小了&#xff0c;而且针对的都是 小图&#xff0c;大图 都显示正常 发现…

“%”通配符

6.5.2 “%”通配符 在SQL语言中最常用的通配符可能就是“%”了&#xff0c;它表示任意字符的匹配&#xff0c;且不计字符的多少。下面通过几个典型实例来说明“%”通配符的使用。 1&#xff0e;开头&#xff0f;结尾匹配 从COURSE表中查询所有以“计算机”开头的所有课程的…

Wireshark基本介绍和学习TCP三次握手

Wireshark基本介绍和学习TCP三次握手 原文&#xff1a;http://www.cnblogs.com/TankXiao/archive/2012/10/10/2711777.html wireshark介绍 wireshark的官方下载网站&#xff1a; http://www.wireshark.org/ wireshark是非常流行的网络封包分析软件&#xff0c;功能十分强大。可…

“_”通配符

6.5.3 “_”通配符 “_”通配符的功能与“%”通配符基本相同&#xff0c;只是它只表示任意一个字符的匹配。当然&#xff0c;要表示两个字符的匹配&#xff0c;就需要使用两个“_”通配符&#xff0c;即写成“__”。 只有在用户确定所要查询的字符串的个数&#xff0c;只是不…

“[]”通配符

6.5.4 “[]”通配符 “[]”通配符用于指定一系列的字符&#xff0c;只要满足这些字符其中之一&#xff0c;且位置出现在“[]”通配符的位置的字符串就满足查询条件。 当然&#xff0c;各种通配符也可以组合使用。组合使用各种通配符时&#xff0c;一定要弄清其表示的匹配条…

QT分页控件,开源,供大家使用

下载地址&#xff1a;http://files.cnblogs.com/dragonsuc/qt5.rar 转载于:https://www.cnblogs.com/dragonsuc/p/4242342.html