几个小技巧: [F2]左右分屏; 哪个缓冲区高亮, 按alt+x之后调出来的东西就在哪里; gdb回车默认重复上一条命令; gdb运行时工具栏可以点击操作(设断点, 显示大数组, 跳行等等).
注意: gdb调试时必须关闭O2; windows下编译命令中的单引号要去掉, 文件名不能有空格.
(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)) '(custom-enabled-themes (quote (tango-dark))) '(inhibit-startup-screen t) '(show-paren-mode t) '(size-indication-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. '(default ((t (:family "Monaco" :foundry "APPL" :slant normal :weight normal :height 113 :width normal))))) ;;以上为emacs设置后自动生成 (global-set-key [f9] 'compile-file) (global-set-key [f12] 'compile-file-O2) (global-set-key [f10] 'gud-gdb) (global-set-key (kbd "C-s") 'save-buffer) (global-set-key (kbd "C-z") 'undo) (define-key key-translation-map (kbd "C-a") (kbd "C-x h")) ;;以上为各种快捷键 (global-linum-mode t) (setq-default cursor-type 'bar) (setq frame-title-format "%b") ;;显示行号 线型光标 标题 (setq c-default-style "awk") (setq default-tab-width 4) (setq c-basic-offset 4) ;;缩进 ;;允许emacs和外部其他程序的粘贴 (setq x-select-enable-clipboard t) ;;;;;滚轴鼠标 (mouse-wheel-mode t) ;;;;;滚动页面时比较舒服,不要整页的滚动 (setq scroll-step 1 scroll-margin 3 scroll-conservatively 10000 ) (setq kill-ring-max 200) ;;;;;设定删除保存记录为200,可以方便以后无限恢复 (setq auto-save-mode t) ;;自动保存 (global-auto-revert-mode t) ;;自动reload文件 ;;(set-frame-parameter (selected-frame) 'alpha (list 90 80)) ;;(add-to-list 'default-frame-alist (cons 'alpha (list 90 80))) ;;上面两行为透明度 ;;编译函数 (defun compile-file () (interactive) (compile (format "g++ -o '%s' '%s' -g -lm -Wall -std=c++11" (file-name-sans-extension (buffer-name))(buffer-name)))) (defun compile-file-O2 () (interactive) (compile (format "g++ -o '%s' '%s' -g -lm -Wall -std=c++11 -O2" (file-name-sans-extension (buffer-name))(buffer-name))))
(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)) '(custom-enabled-themes (quote (tango-dark))) '(inhibit-startup-screen t) '(show-paren-mode t) '(size-indication-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. '(default ((t (:family "Monaco" :foundry "APPL" :slant normal :weight normal :height 113 :width normal))))) ;;以上为emacs设置后自动生成 (global-set-key [f9] 'compile-file) (defun compile-file()(interactive) (compile (format "g++ -o %s %s -lm -Wall" (file-name-sans-extension(buffer-name)) (buffer-name) ) ) ) (global-set-key [f10] 'gud-gdb) (global-set-key (kbd "C-s") 'save-buffer) (global-set-key (kbd "C-z") 'undo) (global-set-key (kbd "C-a") 'mark-whole-buffer) (global-linum-mode t) (show-paren-mode t) (setq kill-ring-max 200) (setq c-default-style "awk") (setq default-tab-width 4) (blink-cursor-mode -1) (setq-default cursor-type 'bar)
PS: 许多配置可以直接在Options选项里面设置, 不用手写.
hello!如何高亮显示列?谢谢!sinalym@163.com
@SamLee 可以参考这个https://emacs-china.org/t/how-to-confiugre-highlight-column/1018/6