Emacs 配置文件

贴一个我的emacs的配置。 lisp语言没怎么仔细研究过,这个文件是我从网上拼凑的,也就不卖弄了。配置效果不错,请自己研究吧 


(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.
 '(case-fold-search 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.
 )


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

;;关闭起动时LOGO
(setq inhibit-startup-message t)

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

;;自动换行模式。
(add-hook 'text-mode-hook 'turn-on-auto-fill)

;; 显示行列号
(column-number-mode t)
(global-linum-mode t)

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

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

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

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

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

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

;; 以 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)



;;将颜色主题加载到load-path中
;;(add-to-list 'load-path "e:\\program files\\emacs-23.3\\.emacs.d\\color-theme-6.6.0")
;;(require 'color-theme)
;;(color-theme-initialize)
;;应用gnome颜色样式主题
;;(color-theme-vim-colors)


(set-background-color "#C7EDCC") ;; 使用豌豆绿背景
(set-foreground-color "black") ;; 使用黑色前景


;; 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 "新宋体" :size 15)))

;; 设置光标为竖线
;;(setq-default cursor-type 'bar)
;; 设置光标为方块
(setq-default cursor-type 'box)

;;启动时最大化窗口
(run-with-idle-timer 0.0 nil 'w32-send-sys-command 61488)




;;显示括号匹配
(show-paren-mode t)

;;括号匹配时显示另外一边的括号,而不是跳到另一个括号
(setq show-paren-style 'parentheses)

;;显示所在行号和列号
(column-number-mode t)

;;不要生成临时文件
(setq-default make-backup-files nil)

;;自动插入匹配的括号
;;C/C++  mode
(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)    
  (backward-char))
(add-hook 'c-mode-hook 'my-c-mode-auto-pair)
(add-hook 'c++-mode-hook 'my-c-mode-auto-pair)


;;在状态条上显示当前光标在哪个函数体内部
  (which-function-mode)


(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



;;把c语言风格设置为k&r风格
 (add-hook 'c-mode-hook
 '(lambda ()
 (c-set-style "k&r")))
 (autoload 'css-mode "css-mode" "CSS editing mode" t)
 ;;css-mode.el编辑css文件
 (autoload 'htmlize-buffer "htmlize" "HTMLize mode" t)
 ;;把buffer的内容连同颜色转为html格式
 (autoload 'folding-mode          "folding" "Folding mode" t)
 (autoload 'turn-off-folding-mode "folding" "Folding mode" t)
 (autoload 'turn-on-folding-mode  "folding" "Folding mode" t)
 ;;folding.el 编辑文本的一部分,其它部分折叠起来
 (setq auto-mode-alist
       ;; 将文件模式和文件后缀关联起来
       (append '(("\\.py\\'" . python-mode)
                 ("\\.s?html?\\'" . html-helper-mode)
                 ("\\.asp\\'" . html-helper-mode)
                 ("\\.phtml\\'" . html-helper-mode)
                 ("\\.css\\'" . css-mode))
               auto-mode-alist))


;;设置默认工作目录
(setq default-directory "f:/emacs work/")





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值