突发奇想,贴一下自己的emacs配置(所用的组件大家可以自己去下,就不给链接了):
(custom-set-variables
'(cua-mode t nil (cua-base))
'(inhibit-startup-screen t)
'(js2-enter-indents-newline t)
'(js2-indent-on-enter-key nil)
'(lintnode-port 3003)
'(show-paren-mode t)
'(tool-bar-mode nil))
(custom-set-faces
)
;; Debug
(setq debug-on-error t)
;; Backup Files
(setq make-backup-files nil)
;; Autosave Files
(setq delete-auto-save-files t)
;; Oldversion Files
(setq delete-old-versions t)
;; External Clipboard
(setq x-select-enable-clipboard t)
;; Parentheses Setting
(setq show-paren-style 'parenthese)
;; Selection Highlight
(setq transient-mark-mode t)
;; M-x Setting
(icomplete-mode 1)
(define-key minibuffer-local-completion-map (kbd "SPC") 'minibuffer-complete-word)
;; Pic Viewing
(auto-image-file-mode t)
;; Semantic Mode
(global-font-lock-mode t)
(setq semantic-default-submodes '(global-semanticdb-minor-mode
global-semantic-idle-scheduler-mode
global-semantic-idle-summary-mode
global-semantic-idle-completions-mode
global-semantic-decoration-mode
global-semantic-highlight-func-mode
global-semantic-stickyfunc-mode
global-semantic-mru-bookmark-mode))
;;(semantic-mode 1)
;;(require 'semantic/analyze/refs)
;;(global-set-key "\C-q" 'senator-completion-menu-popup)
;;(global-set-key "\C-l" 'senator-complete-symbol)
;; Enable EDE
(global-ede-mode 1)
;; Window Shift
(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)
;; Chinese Support
(set-keyboard-coding-system 'chinese-iso-8bit-dos)
(set-selection-coding-system 'chinese-iso-8bit-dos)
;; Code Error
(setq ansi-color-for-comint-mode t)
;; Access Shell via F1
(global-set-key [f1] 'shell)
(global-set-key [C-f3] 'python-shell)
;; Color Theme
(setq frame-background-mode 'dark)
(set-foreground-color "white")
(set-background-color "black")
(set-cursor-color "yellow")
;; Title
(setq frame-title-format "Emacs@%b")
(setq user-mail-address "LostAbaddon@gmail.com")
(setq user-full-name "LostAbaddon")
;; default browser
(setq browse-url-browser-function (quote browse-url-generic))
(setq browse-url-generic-program "google-chrome")
(add-to-list 'load-path "~/.emacs.d")
(require 'history)
(global-set-key (kbd "C-h") 'history)
(require 'linum)
(global-linum-mode t)
;; El-Get
(add-to-list 'load-path "~/.emacs.d/el-get")
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(require 'el-get)
;; Auto-Complete
(add-to-list 'load-path "~/.emacs.d/auto-complete")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/site-lisp/auto-complete-1.3.1/ac-dict")
(ac-config-default)
;; Org-Mode
(add-to-list 'load-path "~/.emacs.d/Org/lisp")
(require 'org-install)
(global-set-key (kbd "C-c t") 'org-time-stamp)
(global-set-key (kbd "C-c a") 'org-agenda)
;; YASnippet
(add-to-list 'load-path "~/.emacs.d/yasnippet/")
(add-to-list 'load-path "~/.emacs.d/yasnippet/snippets")
(require 'yasnippet)
(setq yas/root-directory "~/.emacs.d/yasnippet/snippets")
(yas/load-directory yas/root-directory)
(yas/global-mode 1)
;; Auto-Complete & YASnippet
(require 'auto-complete-yasnippet)
;; Zencoding
(add-to-list 'load-path "~/.emacs.d/zencoding")
(require 'zencoding-mode)
(add-hook 'sgml-mode-hook 'zencoding-mode)
;; JS and JSON Mode
(require 'js2)
(autoload 'js2-mode "js2" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.json$" . js2-mode))
;; Use JS mode as Flex Develop mode
(add-to-list 'auto-mode-alist '("\\.as$" . js2-mode))
;; Auto Indent
(global-set-key (kbd "RET") 'align-newline-and-indent)
;; Buffer Switcher
(iswitchb-mode 1)
(require 'wcy-swbuff)
;; then you can use <C-tab> and <C-S-kp-tab> to switch buffer.
(global-set-key (kbd "<C-tab>") 'wcy-switch-buffer-forward)
(global-set-key (kbd "<C-S-iso-lefttab>") 'wcy-switch-buffer-backward)
(setq wcy-switch-buffer-active-buffer-face 'highlight)
(setq wcy-switch-buffer-inactive-buffer-face 'secondary-selection )
(load-library "hideshow")
(add-hook 'c-mode-hook 'hs-minor-mode)
(add-hook 'c++-mode-hook 'hs-minor-mode)
(add-hook 'java-mode-hook 'hs-minor-mode)
(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
(add-hook 'lisp-mode-hook 'hs-minor-mode)
(add-hook 'scheme-mode-hook 'hs-minor-mode)
(add-hook 'css-mode-hook 'hs-minor-mode)
(add-hook 'html-mode-hook 'hs-minor-mode)
(add-hook 'sgml-mode-hook 'hs-minor-mode)
(add-hook 'javascript-mode-hook 'hs-minor-mode)
(add-hook 'js2-mode-hook 'hs-minor-mode)
(add-hook 'js-mode-hook 'hs-minor-mode)
(global-set-key (kbd "C-c e") 'hs-show-block);; Expand
(global-set-key (kbd "C-c f") 'hs-hide-block);; Fold
(global-set-key (kbd "C-c l") 'hs-hide-level);; Hide Level
;; Auto Pair
(defun my-common-mode-auto-pair ()
(interactive)
(make-local-variable 'skeleton-pair-alist)
(setq skeleton-pair-alist '(
(? ? _ "''")
(? ? _ """")
(? ? _ "()")
(? ? _ "[]")
(?{ \n > _ \n ?} >)))
(setq skeleton-pair t)
(local-set-key (kbd "(") 'skeleton-pair-insert-maybe)
(local-set-key (kbd "\"") 'skeleton-pair-insert-maybe)
(local-set-key (kbd "{") 'skeleton-pair-insert-maybe)
(local-set-key (kbd "\'") 'skeleton-pair-insert-maybe)
(local-set-key (kbd "[") 'skeleton-pair-insert-maybe))
;; Frame Mode
(add-hook 'after-make-frame-functions
(lambda (new-frame)
(select-frame new-frame)
(tool-bar-mode 0)
(scroll-bar-mode 0)
(setq frame-background-mode 'dark)
(set-foreground-color "grey")
(set-background-color "black")
(set-cursor-color "gold1")
(set-mouse-color "gold1")
)
)
;; Transparent Background
(set-frame-parameter (selected-frame) 'alpha '(80 75))
(add-to-list 'default-frame-alist '(alpha 80 75))
;; Calendar
(setq calendar-latitude +31.11)
(setq calendar-longitude +121.29)
(setq calendar-location-name "Shanghai")
;; Auto Expand
(global-set-key [(M-/)] 'hippie-expand)
(setq hippie-expand-try-functions-list
'(try-expand-line
try-expand-line-all-buffers
try-expand-list
try-expand-list-all-buffers
try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name
try-complete-file-name-partially
try-complete-lisp-symbol
try-complete-lisp-symbol-partially
try-expand-whole-kill))
;; Make y/n be yes/no
(fset 'yes-or-no-p 'y-or-n-p)
;;;; full screen
(defun toggle-fullscreen (&optional f)
(interactive)
(let ((current-value (frame-parameter nil 'fullscreen)))
(set-frame-parameter nil 'fullscreen
(if (equal 'fullboth current-value)
(if (boundp 'old-fullscreen) old-fullscreen nil)
(progn (setq old-fullscreen current-value)
'fullboth)))))
(global-set-key [f11] 'toggle-fullscreen)
;; Suspend the Emacs-Desktop
(load "desktop")
(desktop-load-default)
(desktop-read)
;; Leave Emacs Daemon
(defun leaveemacs ()
(interactive)
(save-buffers-kill-emacs))
(global-set-key (kbd "C-x x") 'leaveemacs)
;; My Own Function and ShortKeys
(defun dotemacs ()
(interactive)
(find-file "~/.emacs"))
(global-set-key (kbd "M-s") 'dotemacs)
(defun worklist ()
(interactive)
(find-file "~/Orgs/WorkList.org"))
(global-set-key (kbd "M-w") 'worklist)
(defun gtd ()
(interactive)
(find-file "~/Orgs/Works.org"))
(global-set-key (kbd "M-g") 'gtd)
(put 'downcase-region 'disabled nil)