代码: 全选
(set-default-font "YaHei Mono-10")
;设置所有窗口字体。
(add-to-list 'default-frame-alist '(font . "YaHei Mono-10"))
(global-set-key (kbd "s-2") 'set-mark-command)
(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.
'(blink-cursor-mode nil)
'(column-number-mode t)
'(cua-mode t nil (cua-base))
'(display-time-mode t)
'(fringe-mode 0 nil (fringe))
'(scroll-bar-mode (quote right))
'(show-paren-mode t)
'(speedbar-show-unknown-files t))
(tool-bar-mode -1);去掉那个大大的工具栏
(blink-cursor-mode 0);不要光标闪烁
(auto-image-file-mode t); 打开图片显示功能
;;行号显示
(setq linum-format "%4d|")
(add-hook 'find-file-hook (lambda () (linum-mode 1)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;; 显示时间设置 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq display-time-24hr-format t);;时间使用24小时制
(setq display-time-day-and-date t);;时间显示包括日期和具体时间
(display-time-mode 1);;启用时间显示设置,在minibuffer上面的那个杠上
;; title format
(setq-default frame-title-format
(concat
" %b - %f"(concat" @ "system-name) )
icon-title-format frame-title-format)
(setq auto-save-list-file- nil)
(setq mouse-yank-at-point t); 支持中键粘贴
(setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴
(add-to-list 'load-path "~/.emacs.d")
;(require 'color-theme)
;(color-theme-initialize)
;(color-theme-clarity)
(ansi-color-for-comint-mode-on)
(set-cursor-color "red")
(set-face-foreground 'font-lock-comment-face "#95917E")
(set-face-foreground 'font-lock-string-face "#61ce3c")
(set-face-foreground 'font-lock-keyword-face "#f8dd2d")
(set-face-foreground 'font-lock-function-name-face "#e3611f")
(set-face-foreground 'font-lock-variable-name-face "#98fbff")
(set-face-foreground 'font-lock-type-face "#A6E22E")
(set-face-background 'region "gray40")
(set-face-foreground 'font-lock-constant-face "#66d9ef")
(setq default-frame-alist
'((background-color . "#0b0f20")
(foreground-color . "#f8f8f2")
(cursor-color . "red")
(cursor-type . bar)))
;;---------------------------tabbar--------------------------
(require 'tabbar)
;;不显示以*打头的buffer
(when (require 'tabbar nil t)
(setq tabbar-buffer-groups-function
(lambda (buffer) (list "All Buffers")))
(setq tabbar-buffer-list-function
(lambda ()
(remove-if
(lambda(buffer)
(find (aref (buffer-name buffer) 0) " *"))
(buffer-list))))
(tabbar-mode))
;;设置tabbar字体
(set-face-attribute 'tabbar-default-face nil :family "YaHei Mono")
(global-set-key (kbd "s-<up>") 'tabbar-backward-group)
(global-set-key (kbd "s-<down>") 'tabbar-forward-group)
(global-set-key (kbd "s-<left>") 'tabbar-backward)
(global-set-key (kbd "s-<right>") 'tabbar-forward)
;;-------------------------括号匹配--------------------------
;;括号匹配时显示另一端的括号,而不是跳过去
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;-------------------------关闭启动时的开机画面------------
(setq inhibit-startup-message t)
;;-------------------------misc-------------------------
(setq-default indent-tabs-mode nil)
(setq default-tab-width 4)
(setq track-eol t) ;; 当光标在行尾上下移动的时候,始终保持在行尾。
;(setq visible-bell t) ;;关闭错误提示的Beep音
(fset 'yes-or-no-p 'y-or-n-p)
(setq default-major-mode 'text-mode)
(transient-mark-mode 1)
;;不产生备份文件
(setq make-backup-files nil)
;;不要自动保存
(setq auto-save-default nil)
;;防止页面滚动时跳动, scroll-margin 3 可以在靠近屏幕边沿3行时
;;就开始滚动,可以很好的看到上下文
;(setq scroll-step 1
; scroll-margin 3
; scroll-conservatively 10000)
(global-set-key [(super s)] 'speedbar)
(global-set-key [(super a)] 'speedbar-get-focus)
;;ibuffer
(require 'ibuffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)
;;expand
(global-set-key [(meta /)] 'hippie-expand)
(require 'hippie-exp)
(setq hippie-expand-try-functions-list
'(try-expand-dabbrev
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name-partially
try-complete-file-name
try-complete-lisp-symbol-partially
try-complete-lisp-symbol
try-expand-whole-kill))
;;session和desktop
(require 'session)
(add-hook 'after-init-hook 'session-initialize)
;;使用M-x desktop-save保存回话,使用M-x desktop-clear清除上次保存的回话
(load "desktop")
(desktop-load-default)
(desktop-read);
;;ctypes高亮数据类型
;(require 'ctypes)
;(ctypes-auto-parse-mode 1)
;;自动缩进
(add-hook 'c-mode-hook (lambda () (local-set-key [(return)] 'newline-and-indent) ))
(add-hook 'c++-mode-hook (lambda () (local-set-key [(return)] 'newline-and-indent) ))
;;---------------------auctex配置-----------------
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
(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.
'(highlight ((t (:background "#585A55"))))
;'(linum ((t (:background "#1a1a1a" :foreground "gray40"))))
'(mode-line ((t (:background "red4" :foreground "gray100" :box (:line-width -1 :style released-button)))))
'(region ((t (:background "gray40"))))
'(tabbar-selected-face ((t (:background "gray30" :foreground "green1" :box (:line-width 2 :color "white" :style pressed-button)))))
'(tabbar-unselected-face ((t (:background "gray40" :foreground "gray70" :box (:line-width 2 :color "white" :style released-button))))))
;;control-k删除当前行
(defvar previous-column nil "Save the column position")
(defun nuke-line()
"Kill an entire line, including the trailing newline character"
(interactive)
(setq previous-column (current-column))
(end-of-line)
(if (= (current-column) 0)
(delete-char 1)
(progn
(beginning-of-line)
(kill-line)
;(delete-char 1)
(move-to-column previous-column))))
(global-set-key (kbd "C-k") 'nuke-line)
;;高亮当前行
(global-hl-line-mode 1)
;;w3m
(require 'w3m-load)
;(setq w3m-display-inline-image t)
(setq w3m-home-page "http://www.baidu.com")
;;yasnippet
(require 'yasnippet)
(yas/initialize)
(yas/load-directory "/home/mozt/.emacs.d/snippets")