我的emacs配置

;;删除匹配括号间内容 (defun kill-match-paren (arg) (interactive "p") (cond ((looking-at "[([{]") (kill-sexp 1) (backward-char)) ((looking-at "[])}]") (forward-char) (backward-kill-sexp 1)) (t (self-insert-command (or arg 1))))) (loop for x downfrom 40 to 1 do (setq tab-stop-list (cons (* x 4) tab-stop-list))) (setq sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*") (setq sentence-end-double-space nil) (setq enable-recursive-minibuffers t) (setq scroll-margin 3 scroll-conservatively 10000) ;;类似 vi 的在当前行下面新建一行,无论光标在哪 (defun vi-newline-below nil "open new line below current line no matter where current point is" (interactive) (end-of-line) (newline) (indent-according-to-mode)) (defun zl-delete-line nil "delete the whole line" (interactive) (beginning-of-line) (push-mark) (beginning-of-line 2) (kill-region (point) (mark))) ;;;C-c C-w 复制整行, 而"C-u 5 C-c w"复制 5 行 (defun copy-lines(&optional arg) (interactive "p") (save-excursion (beginning-of-line) (set-mark (point))match (next-line arg) (kill-ring-save (mark) (point)) ) ) (defun move-line (n) "Move the current line up or down by N lines." (interactive "p") (setq col (current-column)) (beginning-of-line) (setq start (point)) (end-of-line) (forward-char) (setq end (point)) (let ((line-text (delete-and-extract-region start end))) (forward-line n) (insert line-text) ;; res×e point to original column in moved line (forward-line -1) (forward-char col))) (defun move-line-up (n) "Move the current line up by N lines." (interactive "p") (move-line (if (null n) -1 (- n)))) (defun move-line-down (n) "Move the current line down by N lines." (interactive "p") (move-line (if (null n) 1 n))) (require 'windmove) (when (featurep 'windmove) (global-set-key (kbd "S-<down>") 'windmove-down) (global-set-key (kbd "S-<up>") 'windmove-up) (global-set-key (kbd "S-<left>") 'windmove-left) (global-set-key (kbd "S-<right>") 'windmove-right) (windmove-default-keybindings)) ;;公共配置 (setq inhibit-startup-message nil) ;;光标显示成一个竖线 (setq-default cursor-type 'box) (custom-set-variables '(inhibit-startup-screen t)) ;; 支持emacs和外部程序的粘贴 (setq x-select-enable-clipboard t) (setq frame-title-format "%b@emacs") ;;启用备份功能 (setq make-backup-files t) ;;使用版本控制系统的时候也启用备份功能 (setq vc-make-backup-files t ) ;;启用版本控制,即可以备份多次 (setq version-control t) ;;备份最原始的版本两次,即第一次编辑前的文档,和第二次编辑前的文档 (setq kept-old-versions 2) ;;备份最新的版本6次,理解同上 (setq kept-new-versions 6) ;;删掉不属于以上3中版本的版本 (setq delete-old-versions t) ;;设置备份文件的路径 (setq backup-directory-alist '(("." . "/opt/devtools/emacs/bak"))) ;;备份设置方法,直接拷贝 (setq backup-by-copying t) ;关闭自动保存模式 (setq auto-save-mode nil) ;不生成 #filename# 临时文件 (setq auto-save-default nil) ;; 自动的在文件末增加一新行 (setq require-final-newline t) ;; 当光标在行尾上下移动的时候,始终保持在行尾。 (setq track-eol t) ;; 当浏览 man page 时,直接跳转到 man buffer。 (setq Man-notify-method 'pushy) (ansi-color-for-comint-mode-on) (setq display-time-day-and-date t) (setq display-time-24hr-format t) (setq visible-bell t) (setq mouse-yank-at-point t) (setq kill-ring-max 200) (setq default-indent-tabs-mode nil) (setq default-tab-width 4) (setq tab-stop-list ()) (auto-image-file-mode) ;;设置有用的个人信息。这在很多地方有用。 (setq user-mail-address "[email protected]") (setq user-full-name "Che Chi") ;;让 dired 可以递归的拷贝和删除目录。 (setq dired-recursive-copies 'top) (setq dired-recursive-deletes 'top) (setq default-fill-column 100) ;(semantic-load-enable-minimum-features) ;(semantic-load-enable-code-helpers) ;(semantic-load-enable-guady-code-helpers) ;(semantic-load-enable-excessive-code-helpers) ;(semantic-load-enable-semantic-debugging-helpers) (setq semanticdb-default-save-directory (expand-file-name "/opt/devtools/emacs/semanticdb")) (setq semanticdb-project-roots (list (expand-file-name "/"))) (autoload 'senator-try-expand-semantic "senator") ; (add-hook 'semantic-init-hooks 'semantic-idle-completions-mode) (setq-default semantic-idle-scheduler-idle-time 432000) ;;java_dev_mode (require 'jde) (require 'ecb) ;;tabb_mode (require 'tabbar) (tabbar-mode) ;;color_mode (require 'color-theme) (color-theme-subtle-hacker) ;;cc_mode ;;(require 'cc-mode) ;;(c-set-offset 'inline-open 0) ;;(c-set-offset 'friend '-) ;;(c-set-offset 'substatement-open 0) ;;gdb-mode ;;(setq gdb-many-windows t) ;;rails_mode (require 'rails) ;;从做模式 (require 'ido) (ido-mode t) ;;回复模式 (require 'redo) ;;pager_mode (require 'pager) ;;(require 'javadecomp) ;;(require 'xcscope) ;;(require 'sunrise-commander) ;;(require 'sunrise‐x‐tabs) ;;dict (autoload 'dictionary-search "dictionary" "Ask for a word and search it in all dictionaries" t) (autoload 'dictionary-match-words "dictionary" "Ask for a word and search all matching words in the dictionaries" t) (autoload 'dictionary-lookup-definition "dictionary" "Unconditionally lookup the word at point." t) (autoload 'dictionary "dictionary" "Create a new dictionary buffer" t) (autoload 'dictionary-mouse-popup-matching-words "dictionary" "Display entries matching the word at the cursor" t) (autoload 'dictionary-popup-matching-words "dictionary" "Display entries matching the word at the point" t) (autoload 'dictionary-tooltip-mode "dictionary" "Display tooltips for the current word" t) (autoload 'global-dictionary-tooltip-mode "dictionary" "Enable/disable dictionary-tooltip-mode for all buffers" t) (add-to-list 'auto-mode-alist '("\\.pdf\\'" . no-pdf)) (defun no-pdf () "Run pdftotext on the entire buffer." (interactive) (let ((modified (buffer-modified-p))) (erase-buffer) (shell-command (concat "pdftotext " (buffer-file-name) " -") (current-buffer) t) (set-buffer-modified-p modified))) ;;session_mode (require 'session) (add-hook 'after-init-hook 'session-initialize) ;;dektop_mode (load "desktop") (desktop-save-mode) (desktop-read) (global-set-key [f1] 'info) (global-set-key [f2] 'global-semantic-stickyfunc-mode) (global-set-key [f3] 'shell) (global-set-key [f4] 'kill-this-buffer) (global-set-key [f5] 'senator-clear-tag) (global-set-key [f6] 'enlarge-window) (global-set-key [f7] 'shrink-window-horizontally) (global-set-key [f9] 'menu-bar-mode) (global-set-key [f10] 'tool-bar-mode) (global-set-key [f11] 'cua-mode) (global-set-key [f12] 'ecb-activate) (global-set-key [C-f6] 'shrink-window) (global-set-key [C-f7] 'enlarge-window-horizontally) (global-set-key [C-f12] 'ecb-deactivate) (global-set-key [home] 'beginning-of-buffer) (global-set-key [end] 'end-of-buffer) (global-set-key [(control l)] 'goto-line) (global-set-key [(control +)] 'redo) (global-set-key [(control z)] 'undo) (global-set-key [(control shift f)] 'indent-region) (global-set-key [(control shift e)] 'senator-unfold-tag) (global-set-key [(control shift c)] 'senator-fold-tag) (global-set-key [(control shift n)] 'senator-next-tag) (global-set-key [(control shift p)] 'senator-previous-tag) (global-set-key [(control shift r)] 'senator-toggle-read-only) (global-set-key [(control shift h)] 'tabbar-mode) (global-set-key [(control shift up)] 'tabbar-backward-group) (global-set-key [(control shift down)] 'tabbar-forward-group) (global-set-key [(control shift left)] 'tabbar-backward) (global-set-key [(control shift right)] 'tabbar-forward) (global-set-key [(meta 1)] 'color-theme-subtle-hacker) (global-set-key [(meta 2)] 'color-theme-arjen) (global-set-key [(meta n)] 'set-mark-command) (global-set-key [(meta g)] 'setnu-mode) (global-set-key [(meta up)] 'move-line-up) (global-set-key [(meta down)] 'move-line-down) (global-set-key (kbd "C-x b") 'ibuffer); (global-set-key (kbd "C-x v") 'browse-kill-ring); (global-set-key (kbd "C-c e l") 'emms-playlist-mode-go) (global-set-key (kbd "C-c e s") 'emms-start) (global-set-key (kbd "C-c e e") 'emms-stop) (global-set-key (kbd "C-c e n") 'emms-next) (global-set-key (kbd "C-c e p") 'emms-pause) (global-set-key (kbd "C-c e f") 'emms-play-playlist) (global-set-key (kbd "C-c e o") 'emms-play-file) (global-set-key (kbd "C-c e d") 'emms-play-directory-tree) (global-set-key (kbd "C-c e a") 'emms-add-directory-tree) </right></left></up></down>

你可能感兴趣的:(C++,c,C#,Rails,emacs)