自己整理的emacs配置文件
好吧
每次考试前都要手写60+行的配置了
(setq default-frame-alist
'((vertical-scroll-bars)
(top . 25)
(left . 45)
(width . 120)
(height . 40)
(background-color . "black")
(foreground-color . "grey")
(cursor-color . "gold1")
(mouse-color . "gold1")
(tool-bar-lines . 0)
(menu-bar-lines . 1)
(scroll-bar-lines . 0)
(right-fringe)
(left-fringe)))
(set-face-foreground 'highlight "white")
(set-face-background 'highlight "blue")
(set-face-foreground 'region "cyan")
(set-face-background 'region "blue")
(set-face-foreground 'secondary-selection "skyblue")
(set-face-background 'secondary-selection "darkblue")
(defun my-c-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)
)
(add-hook'c++-mode-hook'my-c-mode-auto-pair)
(add-hook'c-mode-hook'my-c-mode-auto-pair)
(column-number-mode t)
(global-linum-mode t)
(setq make-backup-files nil)
(setq auto-save-mode nil)
(show-paren-mode t)
(setq show-paren-style'parenthesis)
(setq inhibit-splash-screen t)
(defun my-compile()
(interactive)
(save-some-buffers t)
(let((file(file-name-nondirectory buffer-file-name)))
(compile (format "g++ %s -g -o %s" file (file-name-sans-extension file))))
(switch-to-buffer-other-window"*compilation*")
)
(global-set-key(kbd"RET")'newline-and-indent)
(global-set-key[f4]'other-window)
(global-set-key[f5]'my-compile)
(global-set-key[f6]'gdb)
(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.
'(column-number-mode t)
'(cua-mode t nil (cua-base))
'(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.
)
考试用精简版
(setq default-frame-alist
'((vertical-scroll-bars)
(tool-bar-lines . 0)
(menu-bar-lines . 1)
(scroll-bar-lines . 0)
(right-fringe)
(left-fringe))
)
(defun my-c-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)
)
(add-hook'c++-mode-hook'my-c-mode-auto-pair)
(add-hook'c-mode-hook'my-c-mode-auto-pair)
(column-number-mode t)
(global-linum-mode t)
(setq make-backup-files nil)
(setq auto-save-mode nil)
(show-paren-mode t)
(setq show-paren-style'parenthesis)
(setq inhibit-splash-screen t)
(defun my-compile()
(interactive)
(save-some-buffers t)
(let((file(file-name-nondirectory buffer-file-name)))
(compile (format "g++ %s -g -o %s" file (file-name-sans-extension file))))
(switch-to-buffer-other-window"*compilation*")
)
(global-set-key(kbd"RET")'newline-and-indent)
(global-set-key[f4]'other-window)
(global-set-key[f5]'my-compile)
(global-set-key[f6]'gdb)
(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.
'(column-number-mode t)
'(cua-mode t nil (cua-base))
'(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.
)