Created
March 20, 2014 04:32
-
-
Save ayato-p/9657302 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; package | |
(require 'package) | |
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) | |
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) | |
(package-initialize) | |
(require 'cl) | |
(defvar installing-package-list | |
'( | |
anything | |
anything-complete | |
anything-config | |
anything-match-plugin | |
anything-obsolete | |
anything-show-completion | |
auto-complete | |
auto-install | |
e2wm | |
popup | |
ruby-end | |
ruby-mode | |
haml-mode | |
slim-mode | |
coffee-mode | |
scss-mode | |
window-layout | |
color-theme-solarized | |
)) | |
(let ((not-installed (loop for x in installing-package-list | |
when (not (package-installed-p x)) | |
collect x))) | |
(when not-installed | |
(package-refresh-contents) | |
(dolist (pkg not-installed) | |
(package-install pkg)))) | |
;; load path | |
;; (require 'auto-install) | |
(add-to-list 'load-path "~/.emacs.d/elisp") | |
(add-to-list 'load-path "~/.emacs.d/auto-install") | |
;; mozc | |
(when (require 'mozc nil t) | |
(setq default-input-method "japanese-mozc") | |
(setq mozc-candidate-style 'overlay) | |
;; faces | |
(set-face-attribute 'mozc-cand-overlay-even-face 'nil | |
:background "aquamarine" :foreground "black") | |
(set-face-attribute 'mozc-cand-overlay-odd-face 'nil | |
:background "aquamarine" :foreground "black")) | |
;; anything | |
(setq anything-c-filelist-file-name "/tmp/programming.filelist") | |
(setq anything-grep-candidates-fast-directory-regexp "^/tmp") | |
;; auto-complete | |
(require 'auto-complete) | |
(global-auto-complete-mode t) | |
(add-hook 'auto-complete-mode-hook | |
(lambda () | |
(define-key ac-completing-map (kbd "C-n") 'ac-next) | |
(define-key ac-completing-map (kbd "C-p") 'ac-previous))) | |
(add-to-list 'ac-modes 'coffee-mode) | |
(add-to-list 'ac-modes 'haml-mode) | |
;; ruby | |
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("Capfile$" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode)) | |
(require 'ruby-end) | |
;; Rsense | |
;; (setq rsense-home (expand-file-name "~/.emacs.d/opt/rsense-0.3")) | |
;; (add-to-list 'load-path (concat rsense-home "/etc")) | |
;; (require 'rsense) | |
;; (add-hook 'ruby-mode-hook | |
;; (lambda () | |
;; (ruby-end-mode) | |
;; (add-to-list 'ac-sources 'ac-source-rsense-method) | |
;; (add-to-list 'ac-sources 'ac-source-rsense-constant))) | |
(require 'rcodetools) | |
(setq rct-find-tag-if-available nil) | |
(defun ruby-mode-hook-rcodetools () | |
(define-key ruby-mode-map "\C-c\C-t" 'ruby-toggle-buffer) | |
(define-key ruby-mode-map "\C-c\C-d" 'xmp)) | |
(add-hook 'ruby-mode-hook 'ruby-mode-hook-rcodetools) | |
;; coffee | |
(defun coffee-custom () | |
"coffee-mode-hook" | |
(and (set (make-local-variable 'tab-width) 2) | |
(set (make-local-variable 'coffee-tab-width) 2)) | |
) | |
(add-hook 'coffee-mode-hook | |
'(lambda() (coffee-custom))) | |
;; css | |
(add-hook 'css-mode-hook 'ac-css-mode-setup) | |
;; scss | |
(add-hook 'scss-mode-hook 'ac-css-mode-setup) | |
(setq scss-compile-at-save nil) | |
;; gauche | |
(setq process-coding-system-alist | |
(cons '("gosh" utf-8 . utf-8) process-coding-system-alist)) | |
(setq gosh-program-name "/usr/local/bin/gosh -i") | |
(autoload 'scheme-mode "cmuscheme" "Major mode for Scheme." t) | |
(autoload 'run-scheme "cmuscheme" "Run an inferior Scheme process." t) | |
(defun scheme-other-window () | |
"Run scheme on other window" | |
(interactive) | |
(split-window-horizontally (/ (frame-width) 2)) | |
(switch-to-buffer-other-window | |
(get-buffer-create "*scheme*")) | |
(run-scheme gosh-program-name)) | |
(define-key global-map | |
"\C-cS" 'scheme-other-window) | |
(put 'and-let* 'scheme-indent-function 1) | |
(put 'begin0 'scheme-indent-function 0) | |
(put 'call-with-client-socket 'scheme-indent-function 1) | |
(put 'call-with-input-conversion 'scheme-indent-function 1) | |
(put 'call-with-input-file 'scheme-indent-function 1) | |
(put 'call-with-input-process 'scheme-indent-function 1) | |
(put 'call-with-input-string 'scheme-indent-function 1) | |
(put 'call-with-iterator 'scheme-indent-function 1) | |
(put 'call-with-output-conversion 'scheme-indent-function 1) | |
(put 'call-with-output-file 'scheme-indent-function 1) | |
(put 'call-with-output-string 'scheme-indent-function 0) | |
(put 'call-with-temporary-file 'scheme-indent-function 1) | |
(put 'call-with-values 'scheme-indent-function 1) | |
(put 'dolist 'scheme-indent-function 1) | |
(put 'dotimes 'scheme-indent-function 1) | |
(put 'if-match 'scheme-indent-function 2) | |
(put 'let*-values 'scheme-indent-function 1) | |
(put 'let-args 'scheme-indent-function 2) | |
(put 'let-keywords* 'scheme-indent-function 2) | |
(put 'let-match 'scheme-indent-function 2) | |
(put 'let-optionals* 'scheme-indent-function 2) | |
(put 'let-syntax 'scheme-indent-function 1) | |
(put 'let-values 'scheme-indent-function 1) | |
(put 'let/cc 'scheme-indent-function 1) | |
(put 'let1 'scheme-indent-function 2) | |
(put 'letrec-syntax 'scheme-indent-function 1) | |
(put 'make 'scheme-indent-function 1) | |
(put 'multiple-value-bind 'scheme-indent-function 2) | |
(put 'match 'scheme-indent-function 1) | |
(put 'parameterize 'scheme-indent-function 1) | |
(put 'parse-options 'scheme-indent-function 1) | |
(put 'receive 'scheme-indent-function 2) | |
(put 'rxmatch-case 'scheme-indent-function 1) | |
(put 'rxmatch-cond 'scheme-indent-function 0) | |
(put 'rxmatch-if 'scheme-indent-function 2) | |
(put 'rxmatch-let 'scheme-indent-function 2) | |
(put 'syntax-rules 'scheme-indent-function 1) | |
(put 'unless 'scheme-indent-function 1) | |
(put 'until 'scheme-indent-function 1) | |
(put 'when 'scheme-indent-function 1) | |
(put 'while 'scheme-indent-function 1) | |
(put 'with-builder 'scheme-indent-function 1) | |
(put 'with-error-handler 'scheme-indent-function 0) | |
(put 'with-error-to-port 'scheme-indent-function 1) | |
(put 'with-input-conversion 'scheme-indent-function 1) | |
(put 'with-input-from-port 'scheme-indent-function 1) | |
(put 'with-input-from-process 'scheme-indent-function 1) | |
(put 'with-input-from-string 'scheme-indent-function 1) | |
(put 'with-iterator 'scheme-indent-function 1) | |
(put 'with-module 'scheme-indent-function 1) | |
(put 'with-output-conversion 'scheme-indent-function 1) | |
(put 'with-output-to-port 'scheme-indent-function 1) | |
(put 'with-output-to-process 'scheme-indent-function 1) | |
(put 'with-output-to-string 'scheme-indent-function 1) | |
(put 'with-port-locking 'scheme-indent-function 1) | |
(put 'with-string-io 'scheme-indent-function 1) | |
(put 'with-time-counter 'scheme-indent-function 1) | |
(put 'with-signal-handlers 'scheme-indent-function 1) | |
(put 'with-locking-mutex 'scheme-indent-function 1) | |
(put 'guard 'scheme-indent-function 1) | |
;; uniq | |
(require 'uniquify) | |
(setq uniquify-buffer-name-style 'post-forward) | |
;; whitespace | |
(setq whitespace-style '(face tabs tab-mark spaces space-mark trailing space-before-tab space-after-tab::space)) | |
(setq whitespace-space-regexp "\\(\x3000+\\)") | |
(setq whitespace-display-mappings | |
'((space-mark ?\x3000 [?\□]) | |
(tab-mark ?\t [?\xBB ?\t]) | |
)) | |
(global-whitespace-mode t) | |
(set-face-attribute 'whitespace-trailing nil | |
:foreground "tomato" | |
:underline t) | |
(set-face-attribute 'whitespace-tab nil | |
:foreground "deep sky blue" | |
:underline t) | |
(set-face-attribute 'whitespace-space nil | |
:foreground "green" | |
:weight 'bold) | |
;; emacs style | |
;; 起動画面を非表示 | |
(setq inhibit-startup-message t) | |
;; ツールバー非表示 | |
(tool-bar-mode -1) | |
;; 現在行をハイライト | |
(global-hl-line-mode) | |
;; バックアップを作成しない | |
(setq backup-inhibited t) | |
(setq delete-auto-save-files t) | |
;; 括弧の強調表示 | |
(show-paren-mode t) | |
;; magic comment | |
(setq ruby-insert-encoding-magic-comment nil) | |
;; 括弧の自動入力 | |
(electric-pair-mode t) | |
(global-font-lock-mode t) | |
;; 補完時に大文字小文字を区別しない | |
(setq completion-ignore-case t) | |
(setq read-file-name-completion-ignore-case t) | |
;; solarized | |
(load-theme 'solarized-light t) | |
;; line number | |
(global-linum-mode t) | |
(setq linum-format "%4d: ") | |
;; fullscreen | |
(defun toggle-fullscreen () | |
(interactive) | |
(set-frame-parameter nil 'fullscreen | |
(if (frame-parameter nil 'fullscreen) | |
nil 'fullboth))) | |
(global-set-key | |
[f11] 'toggle-fullscreen) | |
;;font | |
(set-default-font "Inconsolata-12") | |
(set-face-font 'variable-pitch "Inconsolata-12") | |
(set-fontset-font (frame-parameter nil 'font) | |
'japanese-jisx0208 | |
'("Takaoゴシック" . "unicode-bmp")) | |
;; inertial-scroll | |
(require 'inertial-scroll) | |
(setq inertias-global-minor-mode-map | |
(inertias-define-keymap | |
'( | |
("<next>" . inertias-up) | |
("<prior>" . inertias-down) | |
("C-v" . inertias-up) | |
("M-v" . inertias-down) | |
) inertias-prefix-key)) | |
(inertias-global-minor-mode 1) | |
;; revert-buffer | |
(defun revert-buffer-no-confirm () | |
"Revert buffer without confirmation." | |
(interactive) (revert-buffer t t)) | |
;; auto-revert | |
;; (global-auto-revert-mode 1) | |
;; e2wm | |
(require 'e2wm) | |
(global-set-key (kbd "M-+") 'e2wm:start-management) | |
(e2wm:add-keymap | |
e2wm:pst-minor-mode-keymap | |
'(("<M-left>" . e2wm:dp-code) ; codeへ変更 | |
("<M-right>" . e2wm:dp-two) ; twoへ変更 | |
("<M-up>" . e2wm:dp-doc) ; docへ変更 | |
("<M-down>" . e2wm:dp-dashboard) ; dashboardへ変更 | |
("C-." . e2wm:pst-history-forward-command) ; 履歴を進む | |
("C-," . e2wm:pst-history-back-command) ; 履歴をもどる | |
("prefix L" . ielm) | |
("C-M-i" . e2wm:dp-code-imenu-toggle-command) | |
("M-m" . e2wm:pst-window-select-main-command) | |
) e2wm:prefix-key) | |
;; key config | |
(global-set-key (kbd "C-x b") 'anything-for-files) | |
(global-set-key (kbd "M-y") 'anything-show-kill-ring) | |
(global-set-key (kbd "C-c C-f") 'anything-filelist+) | |
(global-set-key (kbd "\C-h") 'delete-backward-char) | |
(global-set-key (kbd "\C-xrl") 'anything-bookmarks) | |
(global-set-key (kbd "C-c C-r") 'revert-buffer-no-confirm) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment