文档章节

just save my emacs configuration

TinkerS
 TinkerS
发布于 2013/05/22 18:06
字数 672
阅读 82
收藏 0
(add-to-list 'load-path user-emacs-directory)


(setq custom-file "~/.emacs.d/custom.el")
(load custom-file 'noerror)


;;; elpa
(package-initialize)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages"))


;;; theme
(load-theme 'wheatgrass)


;;; env
(setq exec-path (cons "/usr/local/bin" exec-path))
(setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH")))


;;; global
(dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode))
  (when (fboundp mode) (funcall mode -1)))


(setq scroll-margin 3
      scroll-conservatively 10000)


;; see matching parens
(show-paren-mode t)


;; Small fringes
;;(set-fringe-mode '(1 . 1))


;; Line-wrapping
;;(set-default 'fill-column 78)


;; Modeline info
(display-time-mode 1)


;; Display line and column numbers
;;(setq global-linum-mode t)
;;(setq line-number-mode t)
;;(setq column-number-mode t)
(global-linum-mode 1)
(column-number-mode 1)


;; Let's see what we're running on
;;(setq on-console (null window-system))
;;(setq linum-format (if on-console "%4d " "%4d"))


;; Highlight regions and add special behaviors to regions.
(setq transient-mark-mode t)
(pending-delete-mode t)
(delete-selection-mode t)


(auto-image-file-mode)
(global-font-lock-mode t)


;; Don't show the startup screen
(setq inhibit-startup-message t)


;; kill ring max size
(setq kill-ring-max 200)


;; tab
(setq default-tab-width 4)
(setq-default indent-tabs-mode nil)


;; "y or n" instead of "yes or no"
(fset 'yes-or-no-p 'y-or-n-p)


;; Explicitly show the end of a buffer
(set-default 'indicate-empty-lines t)


;; Don't truncate lines
(setq truncate-lines t)
(setq truncate-partial-width-windows nil)


;; Trash can support
(setq delete-by-moving-to-trash t)


;; enable functions that are disabled by default
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'set-goal-column 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(put 'dired-find-alternate-file 'disabled nil)


;; set default working directory
(setq default-directory "~/")


;; user info configuration
(setq user-full-name "Robert Sun")
(setq user-mail-address "sunting.bcwl@gmail.com")
(setq frame-title-format "emacs@%b")


;; Make sure all backup files only live in one place
(setq version-control t)
(setq kept-new-versions 3)
(setq delete-old-versions t)
(setq kept-old-versions 2)
(setq dired-kept-versions 1)
(setq backup-by-copying t)
(setq backup-directory-alist '(("." . "~/.emacs.d/backup")))
(setq auto-save-file-name-transforms '(("\\`/?\\([^/]*/\\)*\\([^/]*\\)\\'" "~/.emacs.d/backup/\\2" t)))


;; stop asking "Active Process Exists;; kill them and exit anyway"
;;(defadvice save-buffers-kill-emacs (around no-query-kill-emacs activate)
;;  "Prevent annoying \"Active processes exist\" query when you quit Emacs."
;;  (flet ((process-list ())) ad-do-it))


;; show extra whitespace
(setq show-trailing-whitespace t)
;; trailing whitespace is unnecessary
(add-hook 'before-save-hook 'whitespace-cleanup)


;; `brew install aspell --lang=en` (instead of ispell)
(setq-default ispell-program-name "aspell")
(setq ispell-list-command "list")
(setq ispell-extra-args '("--sug-mode=ultra"))


;; alias
(defalias 'rs 'replace-string)
(defalias 'qr 'query-replace-regexp)
(defalias 'sl 'sort-lines)
(defalias 'rr 'reverse-region)
(defalias 'lml 'list-matching-lines)
(defalias 'dml 'delete-matching-lines)
(defalias 'dnml 'delete-non-matching-lines)
(defalias 'dtw 'delete-trailing-whitespace)
(defalias 'rb 'revert-buffer)
(defalias 'eb 'eval-buffer)
(defalias 'er 'eval-region)
(defalias 'ed 'eval-defun)
(defalias 'eis 'elisp-index-search)
(defalias 'lf 'load-file)
(defalias 'wd 'wdired-change-to-wdired-mode)
(defalias 'sh 'shell-script-mode)


;; fonts
(when (eq system-type 'darwin)
  (set-face-attribute 'default nil :family "Monaco" :height 150 :weight 'normal))


;; encodings
(require 'un-define "un-define" t)
(set-buffer-file-coding-system 'utf-8 'utf-8-unix)
(set-default buffer-file-coding-system 'utf-8-unix)
(set-default-coding-systems 'utf-8-unix)
(set-terminal-coding-system 'utf-8-unix)
(set-keyboard-coding-system 'utf-8-unix)
(prefer-coding-system 'utf-8-unix)
(set-default default-buffer-file-coding-system 'utf-8-unix)


;; For emacsclient
(require 'server)
(unless (server-running-p)
  (server-start))


;;; custom functions


;; rectangle
;; http://www.emacsblog.org/2007/03/17/quick-tip-set-goal-column/#comment-183
(defun kill-save-rectangle (start end &optional fill)
  "Save the rectangle as if killed, but don't kill it.  See `kill-rectangle' for more information."
  (interactive "r\nP")
  (kill-rectangle start end fill)
  (goto-char start)
  (yank-rectangle))


(global-set-key [remap goto-line] 'goto-line-with-feedback)
(global-set-key (kbd "C-x r M-k") 'kill-save-rectangle)


;;; custom key bindings
(global-set-key "\C-x\C-m" 'execute-extended-command)
(global-set-key "\C-c\C-m" 'execute-extended-command)


(global-set-key "\C-w" 'backward-kill-word)
(global-set-key "\C-x\C-k" 'kill-region)
(global-set-key "\C-c\C-k" 'kill-region)


;;; org-mode
(setq org-startup-indented t)


;;; ediff
(setq ediff-split-window-function 'split-window-horizontally)
(setq ediff-window-setup-function 'ediff-setup-windows-plain)


(defface diff-added '((t (:inherit diff-changed :background "#70FB67" :foreground "black"))) nil)
(defface diff-file-header '((((class color) (min-colors 88) (background dark)) (:background "#5686E2" :weight bold))) nil)
(defface diff-header '((((class color) (min-colors 88) (background dark)) (:background "#3469D0"))) nil)
(defface diff-hunk-header '((t (:inherit diff-header :background "#3469D0"))) nil)
(defface diff-index '((t (:inherit diff-file-header :background "#5686E2"))) nil)
(defface diff-removed '((t (:inherit diff-changed :background "#FF453C"))) nil)


;;; iswitchb-mode
(iswitchb-mode 1)


(add-to-list 'iswitchb-buffer-ignore "^ ")
(add-to-list 'iswitchb-buffer-ignore "*ECB")
(add-to-list 'iswitchb-buffer-ignore "*Messages")
(add-to-list 'iswitchb-buffer-ignore "*Buffer")
(add-to-list 'iswitchb-buffer-ignore "*Completions")
(add-to-list 'iswitchb-buffer-ignore "*ftp ")
(add-to-list 'iswitchb-buffer-ignore "*bsh")
(add-to-list 'iswitchb-buffer-ignore "^[tT][aA][gG][sS]$")
(add-to-list 'iswitchb-buffer-ignore "*ediff")
(add-to-list 'iswitchb-buffer-ignore "*vc#")
(add-to-list 'iswitchb-buffer-ignore "*cvs-commit*")
(setq iswitchb-case nil)


;;; ido-mode
(ido-mode t)
(ido-everywhere t)


(setq ido-enable-flex-matching t)
(setq ido-enable-last-directory-history nil)
(setq ido-use-filename-at-point nil)
(setq ido-auto-merge-work-directories-length 0)
(setq ido-use-virtual-buffers t)


;;; maxframe plugin
(require 'maxframe)
(add-hook 'window-setup-hook 'maximize-frame t)


;;; smex plugin
(require 'smex)
(smex-initialize)


(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "C-x C-m") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)


;;(load "init/auto-complete")


© 著作权归作者所有

共有 人打赏支持
TinkerS
粉丝 8
博文 55
码字总数 12670
作品 0
高级程序员
私信 提问
ubuntu下面无网络的情况下安装 emacs

因为有朋友问我这个问题,所以我就实践一下,写了下来. 1, 在其它能上网的电脑上面下载 emacs : http://www.gnu.org/software/emacs/emacs.html view plaincopy to clipboardprint? wget -c h...

sevk
2010/11/24
0
0
Windows 下 Emacs 中的 zsh shell

运行跨平台 shell(例如 Bash 或 zsh)的最大优势在于你能在多平台上使用同样的语法和脚本。在 Windows 上设置(替换)shell 挺麻烦的,但所获得的回报远远超出这小小的付出。 MSYS2 子系统允...

作者: Peter Mosmans
03/12
0
0
使用 Emacs 创建 OAuth 2.0 的 UML 序列图

看起来 OAuth 2.0 框架 已经越来越广泛地应用于 web (和 移动) 应用。太棒了! 虽然协议本身并不复杂,但有很多的使用场景、流程和实现可供选择。正如生活中的大多数事物一样,魔鬼在于细节之...

作者: Peter Mosmans
03/02
0
0
Windows10下安装spacemacs

安装emacs最新版251 编辑emacs配置文件 主目录的initel一定要添加 package-initialize否则spacemacs启动时间一次比一次长 安装spacemacs spacemacs真正的启动还需要很多设置步骤 emacs和ini...

JungleKing
2018/09/02
0
0
Alchemist 0.8 发布,Emacs 的 Elixir 集成

Alchemist 0.8 发布了,Alchemist 实现了将 Elixir 函数式编程语言的相关工具集成到 Emacs 编辑器中。 该版本改进内容包括: Toggle between completion and documention lookup for current...

oschina
2014/11/30
923
2

没有更多内容

加载失败,请刷新页面

加载更多

深入 理解char * ,char ** ,char a[ ] ,char *a[] 的区别

C语言中由于指针的灵活性,导致指针能代替数组使用,或者混合使用,这些导致了许多指针和数组的迷惑,因此,刻意再次深入探究了指针和数组这玩意儿,其他类型的数组比较简单,容易混淆的是字...

天王盖地虎626
34分钟前
3
0
关于我这三年的架构历程(待完成)

从16年7月实习至今,快三年的开发经历中,经手了好几个项目。目前有幸作为一个项目的负责人,完成了一个项目的完全架构设计。因此想记录下这份架构设计中的点点面面。 总架构: 基于DNS的负载...

赵熠熠
35分钟前
1
0
springboot 使用 flyway 进行数据库版本管理

要在启动时自动运行Flyway数据库迁移,请将其添加 org.flywaydb:flyway-core到类路径中。 迁移是表单中的脚本V<VERSION>__<NAME>.sql(使用<VERSION>下划线分隔的版本,例如“1”或“2_1”)...

NotFound403
54分钟前
5
0
spring 5.1.5版本(二)

spring 5.1.5版本(一) spring 5.1.5版本(二) spring 5.1.5版本(三) 对象创建方式 方式一 applicationContext.xml <?xml version='1.0' encoding='UTF-8'?><beans xmlns="http://ww......

gwl_
56分钟前
1
0
CMake生成Mingw用的Make文件

CMake 在win下 默认会生成vc++的nmake用的make 当没安装时 就会报 -- Building for: NMake Makefiles -- The C compiler identification is unknown -- The CXX compiler identification is......

shzwork
今天
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部