[Emacs] 我的Emacs配置文件 for OI

自己整理的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.
 )


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值