优化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.
 )
(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 (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 115 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))



(defconst my-c-style
  '((c-basic-offset . 4)
    (c-tab-always-indent        . nil)
    (c-comment-only-line-offset . 0)
    (c-hanging-braces-alist     . ((substatement-open after)
                                   (brace-list-open)))
    (c-hanging-colons-alist     . ((member-init-intro before)
                                   (inher-intro)
                                   (case-label after)
                                   (label after)
                                   (access-label after)))
    (c-cleanup-list             . (scope-operator
                                   empty-defun-braces
                                   defun-close-semi))
    (c-offsets-alist            . ((arglist-close . c-lineup-arglist)
                                   (substatement-open . 0)
                                   (case-label        . 4)
                                   (block-open        . 0)
                                   (inline-open . 0)
                                   (brace-list-open . +)
                                   (knr-argdecl-intro . -)))
    (c-echo-syntactic-information-p . t))
  "My C Programming Style")

;; Customizations for all of c-mode, c++-mode, and objc-mode
(defun my-c-mode-common-hook ()
  ;; add my personal style and set it for the current buffer
  (c-add-style "ME" my-c-style t)
  ;; offset customizations not in my-c-style
  (c-set-offset 'member-init-intro '++)
  ;; other customizations
  (setq tab-width 8)
  ;; this will make sure TABs can be used to replace 8-spaces
  (setq indent-tabs-mode t)
  ;; we like auto-newline and hungry-delete
  ;; (c-toggle-auto-hungry-state 1)
  ;; keybindings for all supported languages.  We can put these in
  ;; c-mode-map because c++-mode-map, objc-mode-map, and java-mode-map
  ;; inherit from it.
  (define-key c-mode-map "\C-m" 'newline-and-indent))

; the following only works in Emacs 19 and later
; Emacs 18ers can use (setq c-mode-common-hook 'my-c-mode-common-hook)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)


;; 显示行号
(add-to-list 'load-path "/usr/share/emacs23/site-lisp")
(require 'linum)
(global-linum-mode 1)
;; 显示列号
(column-number-mode t)

;; 显示时间
(display-time-mode 1)
;; 24小时格式
(setq display-time-24hr-format t)
;; 显示日期
(setq display-time-day-and-date t)
;; 将yes/no替换为y/n
(fset 'yes-or-no-p 'y-or-n-p)
;; 光标移动到鼠标下时,鼠标自动弹开
(mouse-avoidance-mode 'animate)
;; 好像没有什么用处,等待以后检验
;; insert-date
(defun insert-date ()
  "Insert date at point."
  (interactive)
  (insert (format-time-string "%Y年%m月%e日 %l:%M %a %p")))

;; 使用auto-complete
(add-to-list 'load-path "/usr/share/emacs23/site-lisp")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "/usr/share/emacs23/site-lisp/ac-dict")
(ac-config-default)
;; 使用yasnippet
(add-to-list 'load-path "/usr/share/emacs23/site-lisp/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
;;自动补全括号
(add-to-list 'load-path "/usr/share/emacs23/site-lisp") ;; comment if autopair.el is in standard load path
(require 'autopair)
(autopair-global-mode 1) ;; enable autopair in all buffers



;; 定义字体集
(create-fontset-from-fontset-spec
 "-*-dejavu sans mono-medium-r-normal--13-*-*-*-*-*-fontset-fixend")

;; 设置默认字体
(set-default-font "fontset-fixend")

;; 新建frame时也应用字体设置
(setq default-frame-alist
      (append
       '((font . "fontset-fixend")) default-frame-alist))

;; 设置中文字体
(set-fontset-font
 "fontset-default" nil
 "-*-wenquanyi bitmap song-normal-*-large--12-*-*-*-*-*-iso10646-1"
 nil 'prepend)

(set-fontset-font
 "fontset-fixend" 'kana
 "-*-wenquanyi bitmap song-normal-*-large--12-*-*-*-*-*-iso10646-1"
 nil 'prepend)

(set-fontset-font
 "fontset-fixend" 'han
 "-*-wenquanyi bitmap song-normal-*-large--12-*-*-*-*-*-iso10646-1"
 nil 'prepend)

(set-fontset-font
 "fontset-fixend" 'cjk-misc
 "-*-wenquanyi bitmap song-normal-*-large--12-*-*-*-*-*-iso10646-1"
 nil 'prepend)
;; 添加程序注释,组合键为C+;
(defun qiang-comment-dwim-line (&optional arg)  
    "Replacement for the comment-dwim command."  
    (interactive "*P")  
    (comment-normalize-vars)  
    (if (and (not (region-active-p)) (not (looking-at "[ \t]*$")))  
    (comment-or-uncomment-region (line-beginning-position) (line-end-position))  
    (comment-dwim arg)))  
(global-set-key (kbd "C-;") 'qiang-comment-dwim-line)  


;;可以用shift+箭头来改变窗口
;;(windmove-default-keybindings 'shift)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值