EMACS配置

  1 ;; author: chinazhangjie
  2 ;; e-mail: chinajiezhang@gmail.com
  3 
  4 ;; 指針顏色設置爲白色
  5 (set-cursor-color "white")
  6 ;; 鼠標顏色設置爲白色
  7 (set-mouse-color "white")
  8 
  9 
 10 ;; 從color-theme中獲取
 11 ;; 網上下載color-theme.el,放到加載路徑(/usr/share/emacs/site-lisp )下
 12 ;; M-x color-theme-select,鼠標左鍵選中,回車查看效果
 13 ;; d查看信息,將出現以下信息:
 14 ;; color-theme-matrix is an interactive Lisp function in `color-theme.el'.
 15 ;; (color-theme-matrix)
 16 ;; Color theme by walterh@rocketmail.com, created 2003-10-16.
 17 ;; 選擇(color-theme-blue-mood)便可
 18 (require 'color-theme)
 19 (color-theme-initialize)
 20 (color-theme-gnome2)
 21 
 22 
 23 ;; 一打開就起用 text 模式。  
 24 (setq default-major-mode 'text-mode)
 25 
 26 ;; 語法高亮
 27 (global-font-lock-mode t)
 28 
 29 ;; 以 y/n表明 yes/no
 30 (fset 'yes-or-no-p 'y-or-n-p) 
 31 
 32 ;; 顯示括號匹配 
 33 (show-paren-mode t)
 34 (setq show-paren-style 'parentheses)
 35 
 36 ;; 顯示時間,格式以下
 37 (display-time-mode 1)  
 38 (setq display-time-24hr-format t)  
 39 (setq display-time-day-and-date t)  
 40 
 41 (transient-mark-mode t) 
 42 
 43 ;; 支持emacs和外部程序的粘貼
 44 (setq x-select-enable-clipboard t) 
 45 
 46 ;; 在標題欄提示你目前在什麼位置
 47 (setq frame-title-format "liruiyun@%b")  
 48 
 49 ;; 默認顯示 80列就換行 
 50 (setq default-fill-column 80) 
 51 
 52 ;; 去掉工具欄
 53 (tool-bar-mode nil)
 54 
 55 ;;去掉菜單欄
 56 ;;(menu-bar-mode nil)
 57 
 58 ;; 去掉滾動欄
 59 (scroll-bar-mode nil)
 60 
 61 ;; 設置字體
 62 ;; 方法爲: emacs->options->Set Default Font->"M-x describe-font"查看當前使用的字體名稱、字體大小
 63 (set-default-font " -bitstream-Courier 10 Pitch-normal-normal-normal-*-17-*-*-*-m-0-iso10646-1")
 64 
 65 ;; 顯示列號
 66 (setq column-number-mode t)
 67 (setq line-number-mode t)
 68 
 69 ;; 使用 C++ mode, 感謝csdn yq_118
 70 (add-to-list 'auto-mode-alist (cons "\\.h$" #'c++-mode))
 71 
 72 ;; 設置縮進
 73 (setq c-basic-offset 4)
 74 (setq indent-tabs-mode nil)
 75 (setq default-tab-width 4)
 76 (setq tab-width 4)
 77 (setq tab-stop-list ())
 78 (loop for x downfrom 40 to 1 do
 79       (setq tab-stop-list (cons (* x 4) tab-stop-list)))
 80 
 81 
 82 ;; 回車縮進
 83 (global-set-key "\C-m" 'newline-and-indent)
 84 (global-set-key (kbd "C-<return>") 'newline)
 85 
 86 ;; 實現全屏效果,快捷鍵爲f6
 87 (global-set-key [f6] 'my-fullscreen) 
 88 (defun my-fullscreen ()
 89 (interactive)
 90 (x-send-client-message
 91 nil 0 nil "_NET_WM_STATE" 32
 92 '(2 "_NET_WM_STATE_FULLSCREEN" 0))
 93 )
 94 
 95 ;; 最大化
 96 (defun my-maximized ()
 97 (interactive)
 98 (x-send-client-message
 99 nil 0 nil "_NET_WM_STATE" 32
100 '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
101 (x-send-client-message
102 nil 0 nil "_NET_WM_STATE" 32
103 '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
104 )
105 ;; 啓動emacs時窗口最大化
106 (my-maximized)
107 
108 ;; 啓動窗口大小
109 (setq default-frame-alist
110       '((height . 35) (width . 125) (menu-bar-lines . 20) (tool-bar-lines . 0))) 
111 (put 'upcase-region 'disabled nil)
112 
113 (require 'xcscope)
114 (add-hook 'c-mode-common-hook '(lambda() (require 'xcscope)))
115 
116 ;;change windows with M-left/right/up/down
117 (global-set-key [M-left] 'windmove-left)
118 (global-set-key [M-right] 'windmove-right)
119 (global-set-key [M-up] 'windmove-up)
120 (global-set-key [M-down] 'windmove-down)
121 
122 ;;set mark : shift space
123 (global-set-key [?\S- ] 'set-mark-command)
124 ;;切換輸入法: C SPACE
125 (ibus-mode t)

 

補充:html

解決花括號格式問題linux

一、輸入M+xc++

二、輸入c-set-style 回車windows

三、輸入linux或者bsd 回車工具

而後花括號會採用c語言風格oop

參考:http://www.cnblogs.com/chinazhangjie/archive/2011/06/01/2067263.html字體

相關文章
相關標籤/搜索