绝世emacs配置for Ubuntu

  反正过不了几天就要退役了,把emacs配置放出来造福(祸害)大众?

  浓浓的OIER风格,除了方便打代码就没别的用处(F8并不这样认为?),只可惜windows下的弄丢了,只有Ubuntu下的。

  F1不解释谁用谁知道。

  F2是个好东西,没有一键编译都不能没有它,谁用谁知道。

  F3和F4对处理码农题有奇效,眼不见心不烦。

  F5开O2,可以测数组越界或者什么奇怪的东西,或者加快拍的速度。Iria同学用血的教训告诉我们:O2会自动把一些没定义初始值的东西自动赋值成0,所以一些可能打挂的地方,嗯哼,拍不出来,一测就挂?所以要先不开O2拍,拍一会儿再开O2。

  F6是啥?表示不用gdb这个东西……

  F7是emacs下自带calc计算器,后缀表达式形式的输入,没事拿来玩玩,还不如计算器。

  F8……想东西的时候按下F8有强大的加成,多按几次就想出来了?为什么机房里没人赞同我这一点呢……

  F9一键编译,编译命令自己看算了,只支持cpp?

  F10打开.in文件,没有的话会自动生成一个新的,前缀同源文件。注意如果使用前gedit没有打开,按下F10后emacs将动不了,但你的按键会在关闭gedit之后反映到emacs上。所以……呵呵。

  F11运行当前程序。在没有加文件输入输出、有读入的情况下按下它是在作死……一般拿来看造数据的东西,按下F10下面会显示输出。

  F12运行并打开.out,规矩同F11。

  一键撤销什么的我也不知道有没有啊……没有自动保存,写几下按下F9再按下F2就是当保存了。没有撤销,自己设置就可以了。

  没有括号匹配,但有匹配显示。括号匹配是人类退步的源头!拒绝括号匹配从我做起!

(global-hl-line-mode t)
(ido-mode t)
(set-background-color "black")
(set-foreground-color "pink")
(scroll-bar-mode -1)
(global-linum-mode t)
(set-scroll-bar-mode nil)
(setq-default cursor-type 'bar)
(add-hook 'c-mode-hook 'hs-minor-mode)
(add-hook 'c++-mode-hook 'hs-minor-mode)  
(setq kill-ring-max 200)
(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.
 '(default ((t (:family "Courier 10 Pitch" :foundry "bitstream" :slant normal :weight normal :height 120 :width normal)))))
(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.
 '(blink-cursor-mode nil)
 '(column-number-mode t)
 '(cua-mode t nil (cua-base))
 '(display-time-mode t)
 '(inhibit-startup-screen t)
 '(show-paren-mode t)
 '(tool-bar-mode nil))

(set-face-foreground 'highlight "white")
(set-face-background 'highlight "Blue")
(set-face-foreground 'region "cyan")
(set-face-background 'region "dark slate gray")
(setq-default indent-tabs-mode nil)
(setq default-tab-width 2)
(setq c-basic-offset 2)
(setq tab-stop-list ())
(display-time-mode 1)

(setq scroll-margin 3 scroll-conservatively 10000)
(setq frame-title-format "emacs %b by_Fenghr")
(setq-default kill-whole-line t)
(setq make-backup-files nil)
(setq-default make-backup-files nil)
(setq user-full-name "Fenghr")

(defun common-compile ()
  (interactive)
  (compile (format "g++ -o %s %s -g -Wall"  (file-name-sans-extension (buffer-name))(buffer-name))))
(defun wuxianzhan+O2 ()
  (interactive)
  (compile (format "g++ -o %s %s -g -Wall -O2"  (file-name-sans-extension (buffer-name))(buffer-name))))
(defun open-in-file()
  (interactive)
  ;;(shell-command (format "if not exist %s.in cd.script -f %s.in" (file-name-sans-extension (buffer-name))(file-name-sans-extension (buffer-name))))
  (shell-command (format "touch %s.in" (file-name-sans-extension (buffer-name))))
  (shell-command (format "xdg-open %s.in" (file-name-sans-extension (buffer-name))))
  (shell-command (format "rm %s.in~" (file-name-sans-extension (buffer-name))))
)
(defun only-run ()
  (interactive)
  (shell-command (format "./%s" (file-name-sans-extension (buffer-name))))
)
(defun run-and-show-result ()
  (interactive)
  (shell-command (format "./%s" (file-name-sans-extension (buffer-name))))
  (shell-command (format "xdg-open %s.out" (file-name-sans-extension (buffer-name))))
)
(global-set-key [f1] 'speedbar)
(global-set-key [f2] 'delete-other-windows)
(global-set-key [f3] 'hs-hide-block)
(global-set-key [f4] 'hs-show-block)
(global-set-key [f5] 'wuxianzhan+O2)
(global-set-key [f6] 'gud-gdb)
(global-set-key [f7] 'calc)
(global-set-key [f8] 'zone)
(global-set-key [f9] 'common-compile)
(global-set-key [f10] 'open-in-file)
(global-set-key [f11] 'only-run)
(global-set-key [f12] 'run-and-show-result)
(set-frame-parameter (selected-frame) 'alpha (list 85 55))
(add-to-list 'default-frame-alist (cons 'alpha (list 85 55)))
(put 'scroll-left 'disabled nil)
.emacs

 

posted @ 2017-11-09 20:36  Fenghr  阅读(1211)  评论(2编辑  收藏  举报