(绝大部分是来自网上别人的配置文件,自己略加修改罢了。)
将会保持更新!!
windows:
//linenums won't be copied
;;Load_path (add-to-list 'load-path' "~/.emacs.d/lisp") ;;todo_path (setq todo-file-do "~/emacs/todo/do") (setq todo-file-done "~/emacs/todo/done") (setq todo-file-top "~/emacs/todo/top") ;;Personal information (setq user-full-name "Lazycal") (setq user-mail-address "Lazycal12@gmail.com") ;;外观设置 ;;颜色设置,其实有个color-theme.el可以将Emacs设置丰富多彩,非常漂亮,不过启动有些慢,我只是选择了一些颜色设置。 ;;高亮行 (require 'hl-line) (global-hl-line-mode t) ;;历史 ;;(require 'session-settings) ;(require 'color-theme) ;(color-theme-aalto-light) ;;开启时最大化 ;;Thanks http://zhaojunde1976.blog.163.com/blog/static/121998668201041131130734/ (run-with-idle-timer 0 nil 'w32-send-sys-command 61488) ;; 回车缩进 (global-set-key "\C-m" 'newline-and-indent) (global-set-key (kbd "C-<return>") 'newline-and-indent) ;;font (set-default-font "YaHei Consolas Hybrid") (add-to-list 'default-frame-alist '(font . "YaHei Consolas Hybrid-11")) ;;;;;去掉工具栏 (tool-bar-mode nil) ;;光标显示为一竖线 (setq-default cursor-type 'bar) ;;;;;去掉菜单栏,我将F10绑定为显示菜单栏,万一什么东西忘了,需要菜单栏了可以摁F10调出,再摁F10就去掉菜单 (menu-bar-mode nil) ;;;;;不要滚动栏,现在都用滚轴鼠标了,可以不用滚动栏了 (scroll-bar-mode nil) ;;;;;改变emacs标题栏的标题 (setq frame-title-format "%b") ;;;;;允许emacs和外部其他程序的粘贴 (setq x-select-enable-clipboard t) ;; 显示列号 (setq column-number-mode t) ;;开启语法高亮。 (global-font-lock-mode 1) ;;设置tab为4个空格的宽度 (setq default-tab-width 4) (setq c-basic-offset 4) ;;;;;;;;; 设置界面 start (setq inhibit-startup-message t) (set-cursor-color "Wheat") (set-mouse-color "Wheat") (set-foreground-color "Wheat") (set-background-color "DarkSlateGray") (if window-system (setq default-frame-alist (append '( (top . 0) (left . 100) (width . 110) (height . 35)) default-frame-alist)) ) ;;;;;启用时间显示设置,在minibuffer上面的那个杠上(忘了叫什么来着) (display-time-mode 1) ;;设置缺省目录 (setq default-directory "D:/lazycal") ;;;;;时间使用24小时制 (setq display-time-24hr-format t) ;;;;;时间显示包括日期和具体时间 (setq display-time-day-and-date t) ;;;;;时间的变化频率,单位多少来着? (setq display-time-interval 10) ;;;;;鼠标自动避开指针,如当你输入的时候,指针到了鼠标的位置,鼠标有点挡住视线了 (mouse-avoidance-mode 'animate) ;;;;;指针不要闪,我得眼睛花了 (blink-cursor-mode -1) ;;====================== Load linum ===================== ;;调用linum.el(line number)来显示行号: ;;(add-to-list 'load-path"~/.emacs.d/plugins") (require 'linum) (global-linum-mode 1) ;;---------------------- END linum --------------------- ;;;高亮显示要拷贝的内容 (transient-mark-mode 1) ;;;;;当指针到一个括号时,自动显示所匹配的另一个括号 (show-paren-mode 1) ;;;;;是用滚轴鼠标 (mouse-wheel-mode t) ;;;;;备份设置 ;;;;;emacs还有一个自动保存功能,默认在~/.emacs.d/auto-save-list里,这个非常有用,我这里没有改动,具体可以参见Sams teach yourself emacs in 24hours(我简称为sams24) ;;;;;启用版本控制,即可以备份多次 (setq version-control t) ;;;;;备份最原始的版本两次,记第一次编辑前的文档,和第二次编辑前的文档 (setq kept-onld-versions 2) ;;;;;备份最新的版本五次,理解同上 (setq kept-new-versions 5) ;;;;;删掉不属于以上7中版本的版本 (setq delete-old-versions t) ;;;;;设置备份文件的路径 (setq backup-directory-alist '(("." . "~/.emacs.tmp"))) ;;;;;备份设置方法,直接拷贝 (setq backup-by-copying t) ;; 自动存盘 (setq auto-save-mode t) ;; C-k 删除整行包括回车 (setq-default kill-whole-line t) ;;(blink-cursor-mode -1) ;; 存盘的时候,要求最后一个字符时换行符。 (setq require-final-newline t) ;;;;;去掉烦人的警告铃声 (setq visible-bell nil) (defun kill-the-whole-line() "rt" (interactive) (save-excursion (beginning-of-line) (kill-line) ) ) ;;(global-unset-key (kbd "C-k")) ;;;;;滚动页面时比较舒服,不要整页的滚动 (setq scroll-step 1 scroll-margin 3 scroll-conservatively 10000) ;;;;;标记 (global-set-key [(control ?\.)] 'ska-point-to-register) (global-set-key [(control ?\,)] 'ska-jump-to-register) (defun ska-point-to-register() "Store cursorposition _fast_ in a register. Use ska-jump-to-register to jump back to the stored position." (interactive) (setq zmacs-region-stays t) (point-to-register 8)) (defun ska-jump-to-register() "Switches between current cursorposition and position that was stored with ska-point-to-register." (interactive) (setq zmacs-region-stays t) (let ((tmp (point-marker))) (jump-to-register 8) (set-register 8 tmp))) (defun string<=(a b) (or (string< a b) (string= a b)) ) (defun string>(a b) (not (string<= a b)) ) (defun string>=(a b) (or (string> a b) (string= a b)) ) (defun the_first_char_is_num(a) (let ((sa (substring a 0 1))) (and (string<= sa "9") (string>= sa "0")) ) ) (defun filename() (buffer-name) ) (defun filename_non_suffix() (substring (filename) 0 (string-match (regexp-quote ".") (filename))) ) ;;热键设置 (global-set-key (kbd "C-k") (lambda () (interactive) (beginning-of-line) (kill-line) ) ) (defun my-pascal-mode-hook() ;(setq filename (buffer-name)) ;(setq filename_non_suffix (substring filename 0 (string-match (regexp-quote ".") filename))) (setq-default compile-command (concat "fpc " (filename_non_suffix) ".pas")) (local-set-key [C-f2] (lambda() (interactive ) (split-window-vertically) (find-file (concat (filename_non_suffix) ".out"))) ) (local-set-key [C-f1] (lambda() (interactive ) (split-window-vertically) (find-file (concat (filename_non_suffix) ".in"))) ) ) (add-hook 'pascal-mode-hook 'my-pascal-mode-hook) (defun my-c++-mode-hook() ;(setq filename (buffer-name)) ;(setq filename_non_suffix (substring filename 0 (string-match (regexp-quote ".") filename))) (local-set-key [f7] '(lambda() (interactive) (compile (concat "g++ " (filename_non_suffix) ".cpp -o " (filename_non_suffix) ".exe -g -Wall && start " (filename_non_suffix) ".exe")) ) ) ;;c++编写文件的快捷键(edited by very lazy Lazycal) (local-set-key (kbd "C-c C-f") ;(define-key c++-mode-base-map (kbd "C-c C-f") (lambda () (interactive) (insert "#ifndef ONLINE_JUDGE") (newline-and-indent) (insert "freopen(\"" (filename_non_suffix) ".in\",\"r\",stdin);") (newline-and-indent) (insert "freopen(\"" (filename_non_suffix) ".out\",\"w\",stdout);") (newline-and-indent) (insert "#endif") (newline-and-indent) ) ) (local-set-key [f8] (lambda() (interactive ) (shell-command (concat "start " (filename_non_suffix) ".exe"))) ) (local-set-key [f12] (lambda() (interactive ) (split-window-vertically) (find-file (concat (filename_non_suffix) ".out"))) ) (local-set-key [f11] (lambda() (interactive ) (split-window-vertically) (find-file (concat (filename_non_suffix) ".in"))) ) ) (add-hook 'c++-mode-hook 'my-c++-mode-hook) (global-set-key [M-f5] (lambda() (interactive ) (kill-this-buffer) (delete-window) ) ) (global-set-key [M-f6] 'speedbar) (global-set-key [f5] 'delete-window) (global-set-key [f6] 'other-window) (global-set-key [f9] 'gdb) (global-set-key [M-f9] 'gdb-many-windows) (global-set-key [M-f7] 'previous-error) (global-set-key [M-f8] 'next-error) ;;;;;设定删除保存记录为200,可以方便以后无pp限恢复 (setq kill-ring-max 200) ;;;;;是用aspell程序作为Emacs的拼写检查成学 (setq-default ispell-program-name "aspell") (require 'chm-view) (require 'w3m-load) (setq w3m-use-favicon nil) (setq w3m-command-arguments '("-cookie" "-F")) (setq w3m-use-cookies t) (setq w3m-home-page "http://www.baidu.com") (setq w3m-default-display-inline-images t) ;(require 'session) ;(add-hook 'after-init-hook 'session-initialize) ;(require 'wcy-desktop) ;(wcy-desktop-init)
linux:
//linenums won't be copied
;;Load_path (add-to-list 'load-path' "~/.emacs.d/lisp") ;;todo_path ;(setq todo-file-do "~/emacs/todo/do") ;(setq todo-file-done "~/emacs/todo/done") ;(setq todo-file-top "~/emacs/todo/top") ;;Personal information (setq user-full-name "Lazycal") (setq user-mail-address "Lazycal12@gmail.com") ;;外观设置 ;;颜色设置,其实有个color-theme.el可以将Emacs设置丰富多彩,非常漂亮,不过启动有些慢,我只是选择了一些颜色设置。 ;;高亮行 (require 'hl-line) (global-hl-line-mode t) ;;历史 ;;(require 'session-settings) ;(load "/home/lazycal/Yunio/solarized/emacs-colors-solarized/color-theme-solarized.el") ;(require 'color-theme) ;(color-theme-solarized-lignt) ;(color-theme-aalto-light) ;;开启时最大化 ;;Thanks http://zhaojunde1976.blog.163.com/blog/static/121998668201041131130734/ ;(run-with-idle-timer 0 nil 'w32-send-sys-command 61488) ;; 回车缩进 (global-set-key "\C-m" 'newline-and-indent) (global-set-key (kbd "C-") 'newline-and-indent) ;;font (set-default-font "Ubuntu Mono") (add-to-list 'default-frame-alist '(font . "Ubuntu Mono-11")) ;;;;;去掉工具栏 (tool-bar-mode nil) ;;光标显示为一竖线 (setq-default cursor-type 'bar) ;;;;;去掉菜单栏,我将F10绑定为显示菜单栏,万一什么东西忘了,需要菜单栏了可以摁F10调出,再摁F10就去掉菜单 (menu-bar-mode nil) ;;;;;不要滚动栏,现在都用滚轴鼠标了,可以不用滚动栏了 ;(scroll-bar-mode nil) ;;;;;改变emacs标题栏的标题 (setq frame-title-format "%b") ;;;;;允许emacs和外部其他程序的粘贴 (setq x-select-enable-clipboard t) ;; 显示列号 (setq column-number-mode t) ;;开启语法高亮。 (global-font-lock-mode 1) ;;设置tab为4个空格的宽度 (setq default-tab-width 4) (setq c-basic-offset 4) ;;;;;;;;; 设置界面 start (setq inhibit-startup-message t) (set-cursor-color "Black") (set-mouse-color "Black") (set-foreground-color "Black") (set-background-color "White") ;(if window-system ; (setq default-frame-alist ; (append ; '( (top . 0) ; (left . 100) ; (width . 110) ; (height . 35)) ; default-frame-alist)) ; ) ;;;;;启用时间显示设置,在minibuffer上面的那个杠上(忘了叫什么来着) (display-time-mode 1) ;;设置缺省目录 (setq default-directory "~/桌面/OI") ;;;;;时间使用24小时制 (setq display-time-24hr-format t) ;;;;;时间显示包括日期和具体时间 (setq display-time-day-and-date t) ;;;;;时间的变化频率,单位多少来着? (setq display-time-interval 10) ;;;;;鼠标自动避开指针,如当你输入的时候,指针到了鼠标的位置,鼠标有点挡住视线了 (mouse-avoidance-mode 'animate) ;;;;;指针不要闪,我得眼睛花了 (blink-cursor-mode -1) ;;====================== Load linum ===================== ;;调用linum.el(line number)来显示行号: ;;(add-to-list 'load-path"~/.emacs.d/plugins") (require 'linum) (global-linum-mode 1) ;;---------------------- END linum --------------------- ;;;高亮显示要拷贝的内容 (transient-mark-mode 1) ;;;;;当指针到一个括号时,自动显示所匹配的另一个括号 (show-paren-mode 1) ;;;;;是用滚轴鼠标 (mouse-wheel-mode t) ;;;;;备份设置 ;;;;;emacs还有一个自动保存功能,默认在~/.emacs.d/auto-save-list里,这个非常有用,我这里没有改动,具体可以参见Sams teach yourself emacs in 24hours(我简称为sams24) ;;;;;启用版本控制,即可以备份多次 (setq version-control t) ;;;;;备份最原始的版本两次,记第一次编辑前的文档,和第二次编辑前的文档 (setq kept-onld-versions 2) ;;;;;备份最新的版本五次,理解同上 (setq kept-new-versions 5) ;;;;;删掉不属于以上7中版本的版本 (setq delete-old-versions t) ;;;;;设置备份文件的路径 (setq backup-directory-alist '(("." . "~/.emacs.tmp"))) ;;;;;备份设置方法,直接拷贝 (setq backup-by-copying t) ;; 自动存盘 (setq auto-save-mode t) ;; C-k 删除整行包括回车 (setq-default kill-whole-line t) ;;(blink-cursor-mode -1) ;; 存盘的时候,要求最后一个字符时换行符。 (setq require-final-newline t) ;;;;;去掉烦人的警告铃声 (setq visible-bell nil) (defun kill-the-whole-line() "rt" (interactive) (save-excursion (beginning-of-line) (kill-line) ) ) ;;(global-unset-key (kbd "C-k")) ;;;;;滚动页面时比较舒服,不要整页的滚动 (setq scroll-step 1 scroll-margin 3 scroll-conservatively 10000) ;;;;;标记 (global-set-key [(control ?\.)] 'ska-point-to-register) (global-set-key [(control ?\,)] 'ska-jump-to-register) (defun ska-point-to-register() "Store cursorposition _fast_ in a register. Use ska-jump-to-register to jump back to the stored position." (interactive) (setq zmacs-region-stays t) (point-to-register 8)) (defun ska-jump-to-register() "Switches between current cursorposition and position that was stored with ska-point-to-register." (interactive) (setq zmacs-region-stays t) (let ((tmp (point-marker))) (jump-to-register 8) (set-register 8 tmp))) (defun string<=(a b) (or (string< a b) (string= a b)) ) (defun string>(a b) (not (string<= a b)) ) (defun string>=(a b) (or (string> a b) (string= a b)) ) (defun the_first_char_is_num(a) (let ((sa (substring a 0 1))) (and (string<= sa "9") (string>= sa "0")) ) ) (defun filename() (buffer-name) ) (defun filename_non_suffix() (substring (filename) 0 (string-match (regexp-quote ".") (filename))) ) ;;热键设置 (global-set-key (kbd "C-k") (lambda () (interactive) (beginning-of-line) (kill-line) ) ) (defun my-pascal-mode-hook() ;(setq filename (buffer-name)) ;(setq filename_non_suffix (substring filename 0 (string-match (regexp-quote ".") filename))) (setq-default compile-command (concat "fpc " (filename_non_suffix) ".pas")) (local-set-key [C-f2] (lambda() (interactive ) (split-window-vertically) (find-file (concat (filename_non_suffix) ".out"))) ) (local-set-key [C-f1] (lambda() (interactive ) (split-window-vertically) (find-file (concat (filename_non_suffix) ".in"))) ) ) (add-hook 'pascal-mode-hook 'my-pascal-mode-hook) (defun my-c++-mode-hook() ;(setq filename (buffer-name)) ;(setq filename_non_suffix (substring filename 0 (string-match (regexp-quote ".") filename))) (local-set-key [f7] '(lambda() (interactive) (compile (concat "g++ " (filename_non_suffix) ".cpp -o " (filename_non_suffix) " -g -Wall && gnome-terminal -e ./" (filename_non_suffix) )) ) ) ;;c++编写文件的快捷键(edited by very lazy Lazycal) (local-set-key (kbd "C-c C-f") ;(define-key c++-mode-base-map (kbd "C-c C-f") (lambda () (interactive) (insert "#ifndef ONLINE_JUDGE") (newline-and-indent) (insert "freopen(\"" (filename_non_suffix) ".in\",\"r\",stdin);") (newline-and-indent) (insert "freopen(\"" (filename_non_suffix) ".out\",\"w\",stdout);") (newline-and-indent) (insert "#endif") (newline-and-indent) ) ) (local-set-key [f8] (lambda() (interactive ) (shell-command (concat "exo-open --launch TerminalEmulator ./" (filename_non_suffix)))) ) (local-set-key [f12] (lambda() (interactive ) (split-window-vertically) (find-file (concat (filename_non_suffix) ".out"))) ) (local-set-key [f11] (lambda() (interactive ) (split-window-vertically) (find-file (concat (filename_non_suffix) ".in"))) ) ) (add-hook 'c++-mode-hook 'my-c++-mode-hook) (global-set-key [M-f5] (lambda() (interactive ) (kill-this-buffer) (delete-window) ) ) (global-set-key [M-f6] 'speedbar) (global-set-key [f5] 'delete-window) (global-set-key [f6] 'other-window) (global-set-key [f9] 'gdb) (global-set-key [M-f9] 'gdb-many-windows) (global-set-key [M-f7] 'previous-error) (global-set-key [M-f8] 'next-error) ;;;;;设定删除保存记录为200,可以方便以后无pp限恢复 (setq kill-ring-max 200) ;;;;;是用aspell程序作为Emacs的拼写检查成学 (setq-default ispell-program-name "aspell") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; 设置emacs-w3m浏览器 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;(add-to-list 'load-path "~/emacs-w3m/") ;(require 'w3m-load) ;(require 'mime-w3m) ;(autoload 'w3m "w3m" "interface for w3m on emacs" t) ;; 设置w3m主页 ;(setq w3m-home-page "http://www.baidu.com") ;; 默认显示图片 ;(setq w3m-default-display-inline-images t) ;(setq w3m-default-toggle-inline-images t) ;; 使用cookies ;(setq w3m-use-cookies t) ;;设定w3m运行的参数,分别为使用cookie和使用框架 ;(setq w3m-command-arguments '("-cookie" "-F")) ;; 使用w3m作为默认浏览器 ;(setq browse-url-browser-function 'w3m-browse-url) ;(setq w3m-view-this-url-new-session-in-background t) ;;显示图标 ;(setq w3m-show-graphic-icons-in-header-line t) ;(setq w3m-show-graphic-icons-in-mode-line t) ;;C-c C-p 打开,这个好用 ;(setq w3m-view-this-url-new-session-in-background t) ;(add-hook 'w3m-fontify-after-hook 'remove-w3m-output-garbages) ;(defun remove-w3m-output-garbages () ;"去掉w3m输出的垃圾." ;(interactive) ;(let ((buffer-read-only)) ;(setf (point) (point-min)) ;(while (re-search-forward "[\200-\240]" nil t) ;(replace-match " ")) ;(set-buffer-multibyte t)) ;(set-buffer-modified-p nil)) ;(require 'chm-view) ;(require 'session) ;(add-hook 'after-init-hook 'session-initialize) ;(require 'wcy-desktop) ;(wcy-desktop-init)