;;窗口大小代码
(setq default-frame-alist
'((height . 60) (width . 200) (menu-bar-lines . 20) (tool-bar-lines . 0)))
;;全屏代码
(defun fullscreen ()
(interactive)
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_FULLSCREEN" 0)))
(global-set-key [f11] 'fullscreen)
;;;yasnippet
(add-to-list 'load-path "~/.emacs.d/plugins")
(require 'yasnippet-bundle)
;;;auto-complete
(require 'auto-complete)
(require 'auto-complete-config)
(global-auto-complete-mode t)
(setq-default ac-sources '(ac-source-words-in-same-mode-buffers))
(add-hook 'emacs-lisp-mode-hook (lambda () (add-to-list 'ac-sources 'ac-source-symbols)))
(add-hook 'auto-complete-mode-hook (lambda () (add-to-list 'ac-sources 'ac-source-filename)))
(set-face-background 'ac-candidate-face "lightgray")
(set-face-underline 'ac-candidate-face "darkgray")
(set-face-background 'ac-selection-face "steelblue") ;;; 设置比上面截图中更好看的背景颜色
(define-key ac-completing-map "\M-n" 'ac-next) ;;; 列表中通过按M-n来向下移动
(define-key ac-completing-map "\M-p" 'ac-previous)
(setq ac-auto-start 2)
(setq ac-dwim t)
(define-key ac-mode-map (kbd "M-TAB") 'auto-complete)
;;;py-mode
(setq auto-mode-alist
(cons '("\\.py{1}quot; . python-mode) auto-mode-alist))
(setq interpreter-mode-alis
(cons '("python" . python-mode)
interpreter-mode-alist))
;;;cedet
(load-file "~/.emacs.d/plugins/cedet/common/cedet.el")
;;;; 具体说明可参考源码包下的INSTALL文件,或《A Gentle introduction to Cedet》
;; Enabling Semantic (code-parsing, smart completion) features
;; Select one of the following:
;;(semantic-load-enable-minimum-features)
;;(semantic-load-enable-code-helpers)
;;(semantic-load-enable-gaudy-code-helpers)
(semantic-load-enable-excessive-code-helpers)
;;(semantic-load-enable-semantic-debugging-helpers)
;;;; 使函数体能够折叠或展开
;; Enable source code folding
(global-semantic-tag-folding-mode 1)
;; Key bindings
(defun my-cedet-hook ()
(local-set-key [(control return)] ''semantic-ia-complete-symbol)
(local-set-key "/C-c?" ''semantic-ia-complete-symbol-menu)
(local-set-key "/C-cd" ''semantic-ia-fast-jump)
(local-set-key "/C-cr" ''semantic-symref-symbol)
(local-set-key "/C-cR" ''semantic-symref))
;;(add-hook ''c-mode-common-hook ''my-cedet-hook)
;;;; 当输入"."或">"时,在另一个窗口中列出结构体或类的成员
(defun my-c-mode-cedet-hook ()
(local-set-key "." ''semantic-complete-self-insert)
(local-set-key ">" ''semantic-complete-self-insert))
;;(add-hook ''c-mode-common-hook ''my-c-mode-cedet-hook)
;;;ecb
(add-to-list 'load-path "~/.emacs.d/plugins/ecb")
(require 'ecb)
;;;; 自动启动ecb,并且不显示每日提示
(setq ecb-auto-activate t
ecb-tip-of-the-day nil)
;;;; 各窗口间切换
(global-set-key [M-left] ''windmove-left)
(global-set-key [M-right] ''windmove-right)
(global-set-key [M-up] ''windmove-up)
(global-set-key [M-down] ''windmove-down)
;;;; 隐藏和显示ecb窗口
(define-key global-map [(control f1)] ''ecb-hide-ecb-windows)
(define-key global-map [(control f2)] ''ecb-show-ecb-windows)
;;;; 使某一ecb窗口最大化
;;(define-key global-map "/C-c1" ''ecb-maximize-window-directories)
;;(define-key global-map "/C-c2" ''ecb-maximize-window-sources)
;;(define-key global-map "/C-c3" ''ecb-maximize-window-methods)
;;(define-key global-map "/C-c4" ''ecb-maximize-window-history)
;;;; 恢复原始窗口布局
;;(define-key global-map "/C-c`" ''ecb-restore-default-window-sizes)
;; color theme
(add-to-list 'load-path "~/.emacs.d/plugins")
(require 'color-theme)
;;(require 'color-theme-library.el)
(color-theme-initialize)
(color-theme-calm-forest)
;;(color-theme-oswald)
;;改变窗口位置
(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.
'(ecb-layout-window-sizes (quote (("left8" (0.1807909604519774 . 0.30612244897959184) (0.1807909604519774 . 0.22448979591836735) (0.1807909604519774 . 0.2653061224489796) (0.1807909604519774 . 0.1836734693877551))))))
(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.
)
我的emacs配置
最新推荐文章于 2024-08-09 19:15:36 发布