当前用户的emacs配置文件 在当前用户的主目录下:
zczhangjx@zctech-zhjx:~$ ls -la .emacs
-rw-r--r-- 1 zczhangjx zczhangjx 4074 7月 27 16:43 .emacs
修改它只会改变当前用户emacs的配置,其他用户不行,比如root。
我的emacs文件内容如下:
(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.
'(inhibit-startup-screen 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.
)
(put 'upcase-region 'disabled nil)
;; added by zhjx
(tool-bar-mode nil) ;;取消工具栏
;;(setq initial-frame-alist '((top . 0) (left . 0) (width . 142) (height . 49))) ;; 启动自动最大化
;; 启动自动最大化
(defun my-max-window()
(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))
)
(run-with-idle-timer 1 nil 'my-max-window)
(add-to-list 'load-path "~/.emacs.d/")
(require 'color-theme)
(color-theme-initialize)
;;(color-theme-deep-blue)
;;(color-theme-dark-green)
;;(color-theme-dark-blue2)
;;(color-theme-charcoal-black)
;;(color-theme-word-perfect)
;;(color-theme-vim-colors)
(color-theme-deep-blue)
;; 显示括号匹配
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;括号匹配时可以高亮显示另外一边的括号,但光标不会烦人的跳到另一个括号处。
(setq show-paren-style 'parenthesis)
;;光标靠近鼠标指针时,让鼠标指针自动让开,别挡住视线。
(setq mouse-avoidance-mode 'animate)
;;在标题栏显示buffer的名字,而不是 emacs@wangyin.com 这样没用的提示。
(setq frame-title-format "emacs@%b")
;;让 Emacs 可以直接打开和显示图片。
(setq auto-image-file-mode t)
;; 去掉滚动栏
(set-scroll-bar-mode nil)
;; 一打开就起用 text 模式。
;;(setq default-major-mode 'text-mode)
;; 语法高亮
;(global-font-lock-mode t)
;; 语法高亮。除 shell-mode 和 text-mode 之外的模式中使用语法高亮。
;(setq column-number-mode t)
;(setq line-number-mode t)
;;如果是按下回车后新行没有缩进,那么把下句加入 .emacs 中,重启 emacs 即可
(global-set-key (kbd "RET") 'newline-and-indent)
(setq-default indent-tabs-mode nil) ;; 将tab换成空格,这样在别的编辑器中也能正常显示了。否则在别的编辑器中,如gedit中,如果要求12个空格,而gedit中只有一个tab,导致显示不正常。
;; 在标题栏提示你目前在什么位置
(setq frame-title-format "zhj@%b")
;; 显示行列
(setq column-number-mode t)
(setq line-number-mode t)
;;在左边显示行号
(global-linum-mode 'linum-mode)
;;在minibuffer上面可以显示列号
(column-number-mode t)
;;允许emacs和外部其他程序的粘贴
(setq x-select-enable-clipboard t)
;;设置标题
(setq frame-title-format
'(" administrator - Emacs - [ " (buffer-file-name "%f \]"
(dired-directory dired-directory "%b \]"))))
;;设定默认编码 UTF-8
(set-language-environment "UTF-8")
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-clipboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(modify-coding-system-alist 'process "*" 'utf-8)
;;关闭emacs启动时的画面
;;(setq gnus-inhibit-startup-message t)
;;------------显示时间设置------------------------------
;;(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);;时间的变化频率,单位多少来着?
;;------------显示时间设置结束--------------
;; 改变 Emacs 固执的要你回答 yes 的行为。按 y 或空格键表示 yes,n 表示 no。
(fset 'yes-or-no-p 'y-or-n-p)