码迷,mamicode.com
首页 > 系统相关 > 详细

我的emacs设置文件.emacs

时间:2016-10-03 00:00:15      阅读:759      评论:0      收藏:0      [点我收藏+]

标签:

;;; emacs配置文件

;;设置行高
(setq-default line-spacing 5)


(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.
‘(package-selected-packages (quote (php-mode)))
‘(truncate-partial-width-windows 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.
)
(tool-bar-mode 0)
(set-default-font "16")
(setq inhibit-startup-message t)

;;加载sr-speedbar.el文件所在路径
(add-to-list ‘load-path "~/emacsExtensions/")


;;atom主题
;;(require ‘github-theme)

;;(require ‘andreas-theme)

 

(require ‘sr-speedbar)
(setq sr-speedbar-right-side nil)
;;(setq sr-speedbar-max-width 150)
;;(setq sr-speedbar-width-console 100)
;;(global-set-key (kbd "<C-return") ‘sr-speedbar-toggle)
(setq speedbar-show-unknown-files t)


;; all backups goto ~/.backups instead in the current directory
(setq backup-directory-alist (quote (("." . "~/.backups"))))
(setq make-backup-files nil)
;; 设定不产生备份文件,file-name~

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

;;临时文件,#file-name#
(setq auto-save-default nil)
;; 默认值是t, 要关闭直接用nil更改默认值
;;(setq-default make-backup-files nil)
;; 不生成临时文件

;;右边显示行号
(setq global-linum-mode t)
(setq column-number-mode t)
(setq line-number-mode t)


;;启动设置
;; (setq default-frame-alist
;; ‘((vertical-scroll-bars)
;; (top . 0)
;; (left . 280)))

(setq initial-frame-alist ‘((top . 0) (left . 280)))

;;格式化整个文件函数
(defun indent-whole ()
(interactive)
(indent-region (point-min) (point-max))
(message "format successfully"))
;;绑定到F7键
(global-set-key [f7] ‘indent-whole)
;;(global-set-key (kbd "RET") ‘newline-and-indent)

;;(defun indent-buffer ()
;;"Indent the whole buffer."
;;(interactive)
;;(save-excursion
;;(indent-region (point-min) (point-max) nil)))

;;html代码缩进4个字符
;;(setq indent-tabs-mode nil)
;;(setq default-tab-width 4)
;;(setq-default indent-tabs-mode nil)
;;(setq tab-width 4)
;;(custom-set-variables ‘(tab-width 4))

;;(setq-default indent-tabs-mode nil)
;;(setq default-tab-width 4);;tab键为8个字符宽度
;;(setq tab-stop-list ())
;;(c-set-style "ellemtel")
;;(setq c-default-style "ellemtel" c-basic-offset 4)
;;(setq tab-width 4 indent-tabs-mode nil)
(setq html-mode-markup-indent-offset 4)
(setq html-mode-code-indent-offset 4)


;;MELPA is a growing collection of package.el-compatible Emacs Lisp packages built automatically on our server from the upstream source code using simple recipes.

(require ‘package)
(add-to-list ‘package-archives
‘("melpa" . "https://melpa.org/packages/") t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list ‘package-archives ‘("gnu" . "https://elpa.gnu.org/packages/")))
(package-initialize)


;;不自动换行设置
(set-default ‘truncate-lines t)
(setq truncate-partial-width-windows nil)
(add-hook ‘diff-mode-hook (lambda () (setq truncate-lines t)))

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

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

;;以y/n 代替 yes/no
(fset ‘yes-or-no-p ‘y-or-n-p)

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

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

;;在标题栏提示当前位置
(setq frame-title-format "xdd@%p%b")

;;设置tab为4个空格的宽度
(setq default-tab-width 4)

;;代码折叠
(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 ‘cperl-mode-hook ‘hs-minor-mode)
(add-hook ‘php-mode-hook ‘hs-minor-mode)
(add-hook ‘emacs-lisp-mode-hook ‘hs-minor-mode)

;;快捷键设置
(global-set-key [f10] ‘my-fullscreen);F12 全屏

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


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

;; web-mode设置
(require ‘web-mode)
;; (add-to-list ‘auto-mode-alist ‘("\\.phtml\\‘" . web-mode))
;; (add-to-list ‘auto-mode-alist ‘("\\.tpl\\.php\\‘" . web-mode))
;; (add-to-list ‘auto-mode-alist ‘("\\.[agj]sp\\‘" . web-mode))
;; (add-to-list ‘auto-mode-alist ‘("\\.as[cp]x\\‘" . web-mode))
;; (add-to-list ‘auto-mode-alist ‘("\\.erb\\‘" . web-mode))
;; (add-to-list ‘auto-mode-alist ‘("\\.mustache\\‘" . web-mode))
;; (add-to-list ‘auto-mode-alist ‘("\\.djhtml\\‘" . web-mode))
(add-to-list ‘auto-mode-alist ‘("\\.html?\\‘" . web-mode))
(add-to-list ‘auto-mode-alist ‘("\\.css\\‘" . web-mode))
(add-to-list ‘auto-mode-alist ‘("\\.js\\‘" . web-mode))
(add-to-list ‘auto-mode-alist ‘("\\.php\\‘" . web-mode))

;;安装emmet-mode
(add-hook ‘sgml-mode-hook ‘emmet-mode) ;; Auto-start on any markup modes
(add-hook ‘css-mode-hook ‘emmet-mode) ;; enable Emmet‘s css abbreviation.
(add-hook ‘web-mode-hook ‘emmet-mode) ;; enable Emmet‘s on web-mode
(add-hook ‘php-mode-hook ‘web-mode)

;;安装projecttile,添加项目管理
(add-to-list ‘load-path "~/emacsExtensions/projectile-master")
(require ‘projectile)
(projectile-global-mode) ;;默认全局使用
;;(add-hook ‘web-mode ‘projectile-mode)
(setq projectile-enable-caching t) ;;默认打开缓存
(global-set-key [f5] ‘projectile-find-file) ;;使用f5键打开默认文件搜索


;;设置背景色
;;(set-foreground-color "grey")
;;(set-background-color "#f5f5f5")


;;光标显示为一竖线
;;(setq-default cursor-type ‘bar)

;;启用时间显示设置,在minibuffer上面的那个杠上(忘了叫什么来着)
(display-time-mode 1)

;;时间使用24小时制
(setq display-time-24hr-format t)
;;时间显示包括日期和具体时间
(setq display-time-day-and-date t)

 

;; ----------------------
;;设置中文语言环境
;;(set-language-environment ‘Chinese-GB)

;;写文件的编码方式
;;(set-buffer-file-coding-system ‘gb2312)
(set-buffer-file-coding-system ‘utf-8)

;;新建文件的编码方式
;;(setq default-buffer-file-coding-system ‘gb2312)
(setq default-buffer-file-coding-system ‘utf-8)

;;终端方式的编码方式
(set-terminal-coding-system ‘utf-8)

;;键盘输入的编码方式
;;(set-keyboard-coding-system ‘gb2312)
(set-keyboard-coding-system ‘utf-8)

;;读取或写入文件名的编码方式
(setq file-name-coding-system ‘utf-8)


;; ;;自动补全括号
;; (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)
;; (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)
;; (add-hook ‘web-mode-hook ‘my-c-mode-auto-pair)
;; ;;输入左边的括号,就会自动补全右边的部分.包括(), "", [] , {} , 等等

;;在文档最后自动插入空白一行,好像某些系统配置文件是需要这样的
(setq require-final-newline t)
(setq track-eol t)


;;fringe设置
;; (set-fringe-mode ‘(0 . 0))
;; (setq-default left-fringe-width 10)
;; (setq-default right-fringe-width 0)
;; (set-face-attribute ‘fringe nil :background "white" :foreground "white")

;;linum左边显示行号设置
;; (setq linum-format "%d") ;; alternative solution to intermittent line numbers
;; (custom-set-faces ‘(linum ((t (:foreground "#000000" :background "#ffffff" :box nil)))) )
;; (setq linum-format " %d ")
;; (global-linum-mode 1)

;;flycheck的安装
(require ‘flycheck)
(global-flycheck-mode) ;;默认全局使用

 

我的emacs设置文件.emacs

标签:

原文地址:http://www.cnblogs.com/htmlphp/p/5928193.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!