我的.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.
'(ansi-color-faces-vector
[default default default italic underline success warning error])
'(ansi-color-names-vector
["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"])
'(cua-mode t nil (cua-base))
'(custom-enabled-themes '(deeper-blue))
'(display-time-mode t)
'(show-paren-mode 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.
'(default ((t (:family "Consolas" :foundry "outline" :slant italic :weight normal :height 100 :width normal)))))
;; Notes
;; t -> true
;; nil -> false
;; Customization
(set-default-coding-systems 'utf-8) ;; 默认文件编码
(setq-default frame-title-format "%b") ;; 设置窗口标题为文件名
(setq-default x-select-enable-clipboard t) ;; 剪贴板共享
(cua-mode t) ;; C-x, C-c, C-v = 复制, 剪切, 粘贴
(setq-default select-active-regions 'only) ;; 避免全选大文件卡死
(xterm-mouse-mode t) ;; emacs-terminal下鼠标可用
(global-linum-mode t) ;; 行号
(global-hl-line-mode 1) ;; 高亮当前行
(show-paren-mode t) ;; 高亮匹配括号
(setq show-paren-style 'parenthesis)
(setq-default cursor-type
'bar;; 'bar or 'box
) ;; 设置光标样式 竖线 或 方块
(setq-default kill-ring-max 65535) ;; 撤销记录
(setq-default auto-save-mode t) ;; 自动备份
(setq-default backup-by-copying t)
(setq-default auto-save-timeout 30) ;; 每30s自动备份一次
;; (ido-mode t) ;; 优化文件树结构
(mouse-wheel-mode t) ;; 鼠标滚轮支持
(setq-default scroll-step 1 scroll-margin 3 scroll-conservatively 10000) ;; 优化页面滚动
(global-font-lock-mode t) ;; 语法高亮
(display-time-mode 1) ;; 显示时间
(setq-default display-time-24hr-format t) ;; 24小时格式
(setq display-time-day-and-date t) ;; 显示日期和星期
(setq-default display-time-interval 1) ;; 时间变化频率
(set-frame-parameter (selected-frame) 'alpha (list 90 70)) ;; 透明度
(add-to-list 'default-frame-alist (cons 'alpha (list 90 70)))
(setq-default c-default-style
"bsd"
;; C++ Code Style
;; "bsd": 所有大括号换行
;; "java"
;; "k&r"/"awk"
;; "stroustrup"
;; "whitesmith"
;; "gnu"
;; "linux"
) ;; C++代码样式
(setq-default c-basic-offset 4) ;; 代码缩进长度
(setq-default intent-tabs-mode t) ;; 使用tab缩进
(setq-default default-tab-width 4) ;; tab长度
(setq-default tab-width 4)
(global-set-key (kbd "RET") 'newline-and-indent) ;; 换行自动缩进