Skip to content

Instantly share code, notes, and snippets.

@yao2030
Created December 18, 2012 14:42
Show Gist options
  • Save yao2030/4328569 to your computer and use it in GitHub Desktop.
Save yao2030/4328569 to your computer and use it in GitHub Desktop.
;; quit message
(fset 'yes-or-no-p 'y-or-n-p)
;;把缺省的 major mode 设置为 text-mode, 而不是几乎什么功能也
;;没有的 fundamental-mode.
(setq default-major-mode 'text-mode)
(setq initial-major-mode 'text-mode)
;;光标靠近鼠标指针时,让鼠标指针自动让开,别挡住视线。
(mouse-avoidance-mode 'animate)
;;显示列号
(setq column-number-mode t)
;;防止页面滚动时跳动, scroll-margin 3 可以在靠近屏幕边沿3行时就开始滚动,可以很好的看到上下文
(setq scroll-margin 3
scroll-conservatively 10000)
;;在标题栏显示buffer的名字
;;(setq frame-title-format "emacs@%b")
(setq frame-title-format "%n%F/%b")
;;不要在鼠标点击的那个地方插入剪贴板内容。我不喜欢那样,经常把 我的文档搞的一团糟。我觉得先用光标定位,然后鼠标中键点击要好 的多。不管你的光标在文档的那个位置,或是在 minibuffer,鼠标 中键一点击,X selection 的内容就被插入到那个位置。
(setq mouse-yank-at-point t)
(define-key global-map "\C-h" 'backward-delete-char)
;;make ctrl-h work in searches, too
(setq search-delete-char (string-to-char "\C-h"))
;;bring the "help" facility somewhere else (ctrl-?)
;;make alt-h delete the previous word
(define-key global-map "\M-h" 'backward-kill-word)
(global-set-key "\M-?" 'help-command)
;;make ctl-x ctrl-u the "undo" command; this is better than ctrl-u
(define-key global-map "\C-x \C-u" 'undo)
;;loadpath
(setq load-path (append load-path '("/home/yao/.emacs.d/")))
;; c-toggle-auto-state
(add-hook 'c-mode-hook
'(lambda ()
(line-number-mode 1)
(c-toggle-auto-state)))
(add-hook 'c++-mode-hook
'(lambda ()
(c-toggle-auto-state)))
;;括号匹配时显示另一端的括号,而不是跳过去
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;-------------------------语法加亮--------------------------
(global-font-lock-mode t)
;;-------------------------关闭启动时的`开机画面'------------
(setq inhibit-startup-message t)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)
(set-face-attribute 'default nil :height 120)
(set-default 'cursor-type 'bar)
;;(setq make-backup-files nil)
(setq backup-directory-alist '(("." . "~/.emacs.d/backups")))
(require 'ido)
(ido-mode t)
(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.
'(ansi-color-names-vector ["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"])
'(custom-enabled-themes (quote (tsdh-dark))))
(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.
)
(global-set-key "\C-xg" 'goto-line)
(global-set-key "\C-xc" 'compile)
(global-set-key "\C-xr" 'replace-string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment