Last active
October 10, 2015 13:27
-
-
Save zonuexe/3696989 to your computer and use it in GitHub Desktop.
さっきでっちあげた.emacs
This file contains 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
;; for Emacs 24 | |
(require 'cl) | |
(set-language-environment 'Japanese) | |
(prefer-coding-system 'utf-8) | |
(set-default-coding-systems 'utf-8) | |
(set-keyboard-coding-system 'utf-8) | |
(custom-set-variables | |
'(make-backup-files nil) | |
'(auto-save-default nil)) | |
(when (eq system-type 'darwin) | |
(require 'ucs-normalize) | |
(set-file-name-coding-system 'utf-8-hfs) | |
(custom-set-variables | |
'(locale-coding-system 'utf-8-hfs))) | |
(when (eq system-type 'windows-nt) | |
(set-file-name-coding-system 'cp932) | |
(custom-set-variables | |
'(locale-coding-system 'cp932))) | |
(cond | |
(window-system (tool-bar-mode -1)) | |
(t (menu-bar-mode -1))) | |
(when (and window-system (>= emacs-major-version 23)) | |
(set-face-attribute 'default nil | |
:family "Migu 2M" | |
:height 120)) | |
(require 'shellenv "~/.emacs.d/site-lisp/shellenv-el/shellenv") | |
(shellenv/setpath 'zsh) | |
(when (require 'package nil t) | |
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) | |
(when (< emacs-major-version 24) | |
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))) | |
(package-initialize)) | |
(setq vc-handled-backends ()) | |
(add-to-list 'load-path "~/.emacs.d/el-get/el-get") | |
(unless (require 'el-get nil t) | |
(url-retrieve | |
"https://raw.github.com/dimitri/el-get/master/el-get-install.el" | |
(lambda (s) | |
(let (el-get-master-branch) | |
(goto-char (point-max)) | |
(eval-print-last-sexp))))) | |
;(add-to-list 'el-get-recipe-path "~/.emacs.d/recipes") | |
(el-get 'sync) | |
(el-get 'sync 'cl-lib) | |
(el-get 'sync 'color-theme) | |
(when (require 'color-theme nil t) | |
(eval-after-load "color-theme" | |
'(progn | |
(color-theme-initialize) | |
(color-theme-dark-laptop)))) | |
(let* ((zshpath (shell-command-to-string | |
"/usr/bin/env zsh -c 'printenv PATH'")) | |
(pathlst (split-string zshpath ":"))) | |
(custom-set-variables '(exec-path pathlst) | |
'(eshell-path-env zshpath)) | |
(setenv "PATH" zshpath)) | |
(el-get 'sync 'helm) | |
(when (require 'helm nil t) | |
(require 'helm-config) | |
(global-set-key (kbd "C-c h") 'helm-mini) | |
(helm-mode t)) | |
(when (require 'eldoc nil t) | |
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode) | |
(add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode) | |
(add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)) | |
(eval-after-load "vc" | |
'(remove-hook 'find-file-hooks 'vc-find-file-hook)) | |
(el-get 'sync 'magit) | |
(require 'magit) | |
(eval-after-load 'magit | |
'(progn | |
(set-face-foreground 'magit-diff-add "green3") | |
(set-face-foreground 'magit-diff-del "red3") | |
(when (not window-system) | |
(set-face-background 'magit-item-highlight "white")))) | |
(global-set-key (kbd "C-x m") 'magit-status) | |
(el-get 'sync 'smartchr) | |
(el-get 'sync 'rst-mode) | |
(el-get 'sync 'ruby-mode) | |
(when (require 'ruby-mode nil t) | |
(custom-set-variables | |
'(ruby-deep-indent-paren nil) | |
'(ruby-encoding-map | |
'((shift_jis . cp932) | |
(shift-jis . cp932) | |
(japanese-cp932 . cp932)))) | |
(defun python-mode-hook--set-encoding () | |
(add-hook 'before-save-hook 'ruby-mode-set-encoding nil t)) | |
(add-to-list 'auto-mode-alist '("[Rr]akefile" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("\\.rake" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("Gemfile" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("Capfile" . ruby-mode)) | |
(add-to-list 'auto-mode-alist '("\\.gemspec" . ruby-mode)) | |
(add-hook 'python-mode-hook 'python-mode-hook--set-encoding)) | |
(el-get 'sync 'rinari) | |
(el-get 'sync 'rhtml-mode) | |
(require 'rinari) | |
(when (require 'rhtml-mode nil t) | |
(add-hook 'rhtml-mode-hook | |
(lambda () | |
(rinari-launch) | |
(abbrev-mode nil)))) | |
(el-get 'sync 'ruby-block) | |
(el-get 'sync 'tuareg-mode) | |
(require 'tuareg-mode nil t) | |
(el-get 'sync 'paredit) | |
(when (require 'paredit nil t) | |
(autoload 'paredit-mode "paredit" | |
"Minor mode for pseudo-structurally editing Lisp code." t) | |
(eldoc-add-command 'paredit-backward-delete | |
'paredit-close-round) | |
(add-hook 'emacs-lisp-mode-hook (lambda () (paredit-mode +1))) | |
(add-hook 'lisp-mode-hook (lambda () (paredit-mode +1))) | |
(add-hook 'lisp-interaction-mode-hook (lambda () (paredit-mode +1))) | |
(add-hook 'scheme-mode-hook (lambda () (paredit-mode +1)))) | |
(el-get 'sync '(auto-complete | |
auto-complete-ruby | |
auto-complete-yasnippet | |
auto-complete-css | |
auto-complete-emacs-lisp | |
auto-complete-etags | |
auto-complete-extension | |
auto-complete-latex)) | |
(el-get 'sync 'rcodetools) | |
(when (require 'auto-complete nil t) | |
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") | |
(require 'auto-complete-config) | |
(require 'auto-complete-ruby nil t) | |
(global-auto-complete-mode t) | |
(custom-set-variables | |
'(ac-ignore-case nil) | |
'(ac-auto-start t) | |
'(ac-sources | |
'(ac-source-filename | |
ac-source-functions | |
ac-source-yasnippet | |
ac-source-variables | |
ac-source-symbols | |
ac-source-features | |
ac-source-abbrev | |
ac-source-words-in-same-mode-buffers | |
ac-source-dictionary))) | |
(ac-config-default) | |
(add-hook 'ruby-mode-hook | |
(lambda () | |
(make-local-variable 'ac-omni-completion-sources) | |
(make-local-variable 'ac-ignore-case) | |
(setq ac-ignore-case nil) | |
(setq ac-omni-completion-sources '(("\\.\\=" . (ac-source-rcodetools))))))) | |
(el-get 'sync '(yasnippet yasnippet-config dropdown-list)) | |
(require 'dropdown-list) | |
(when (require 'yasnippet nil t) | |
(yas/load-directory "~/.emacs.d/el-get/yasnippet/snippets") | |
;(yas-global-mode t) | |
(call-interactively 'yas/reload-all) | |
(custom-set-variables | |
'(yas/prompt-functions | |
'(yas/dropdown-prompt | |
yas/completing-prompt | |
yas/ido-prompt | |
yas/no-prompt)))) | |
(el-get 'sync 'hatena-diary-mode) | |
(when (require 'hatena-diary-mode nil t) | |
(custom-set-variables | |
'(hatena-usrid "zonu_exe") | |
'(hatena-twitter-flag t))) | |
;(unless (locate-library "moinmoin-mode") | |
; (el-get 'sync 'moinmoin-mode)) | |
(define-key sgml-mode-map (kbd "C-c <left>") nil) | |
(define-key sgml-mode-map (kbd "C-c <right>") nil) | |
(add-to-list 'auto-mode-alist | |
'("\\.\\(html\\|xhtml\\|shtml\\|tpl\\)\\'" . nxml-mode)) | |
(el-get 'sync 'zencoding-mode) | |
(when (require 'zencoding-mode nil t) | |
(add-hook 'sgml-mode-hook 'zencoding-mode)) | |
(el-get 'sync 'yaml-mode) | |
;(el-get 'sync 'sass-mode) | |
(el-get 'sync 'markdown-mode) | |
(el-get 'sync 'autopair) | |
(when (require 'autopair nil t) | |
(defvar autopair-modes '(r-mode ruby-mode)) | |
(defun turn-on-autopair-mode () (autopair-mode t)) | |
(dolist (mode autopair-modes) | |
(add-hook (intern (concat (symbol-name mode) "-hook")) | |
'turn-on-autopair-mode)) | |
(require 'paredit) | |
(defadvice paredit-mode | |
(around disable-autopairs-around (arg)) | |
"Disable autopairs mode if paredit-mode is turned on" | |
ad-do-it | |
(if (null ad-return-value) | |
(autopair-mode 1) | |
(autopair-mode 0))) | |
(ad-activate 'paredit-mode)) | |
(el-get 'sync 'smart-compile) | |
(when (require 'smart-compile nil t) | |
(define-key ruby-mode-map (kbd "C-c c") 'smart-compile) | |
(define-key ruby-mode-map (kbd "C-c C-c") (kbd "C-c c C-m"))) | |
(el-get 'sync 'popwin) | |
(when (require 'popwin nil t) | |
(custom-set-variables | |
'(display-buffer-function 'popwin:display-buffer))) | |
(el-get 'sync 'open-junk-file) | |
(when (require 'open-junk-file nil t) | |
(custom-set-variables | |
'(open-junk-file-format "~/junk/%Y/%m/%Y-%m-%d-%H%M%S.")) | |
(global-set-key (kbd "C-x j") 'open-junk-file) | |
(when (require 'em-glob nil t) | |
(defvar junk-file-dir "~/junk/") | |
(defun open-last-junk-file () | |
(interactive) | |
(find-file (car (last (eshell-extended-glob | |
(concat | |
(find-name-as-directory junk-file-dir) | |
"*/*/????-??-??-??????.*")))))))) | |
(el-get 'sync 'auto-async-byte-compile) | |
(when (require 'auto-async-byte-compile nil t) | |
(require 'auto-async-byte-compile) | |
(custom-set-variables '(auto-async-byte-compile-exclude-files-regexp "/junk/")) | |
(add-hook 'emacs-lisp-mode-hook 'enable-auto-async-byte-compile-mode)) | |
(defun backward-kill-word-or-kill-region () | |
(interactive) | |
(if (or (not transient-mark-mode) (region-active-p)) | |
(kill-region (region-beginning) (region-end)) | |
(backward-kill-word 1))) | |
(global-set-key (kbd "C-w") 'backward-kill-word-or-kill-region) | |
(el-get 'sync 'emacs-w3m) | |
(el-get 'sync 'navi2ch) | |
(global-set-key (kbd "C-c <left>") 'windmove-left) | |
(global-set-key (kbd "C-c <down>") 'windmove-down) | |
(global-set-key (kbd "C-c <up>") 'windmove-up) | |
(global-set-key (kbd "C-c <right>") 'windmove-right) | |
(show-paren-mode t) | |
(when (require 'uniquify nil t) | |
(setq uniquify-buffer-name-style 'post-forward-angle-brackets) | |
(setq-default show-trailing-whitespace t)) | |
(custom-set-variables | |
'(scss-compile-at-save nil)) | |
(el-get 'sync 'web-mode) | |
;(el-get 'sync 'cucumber-mode) | |
(el-get 'sync 'php-mode) | |
(el-get 'sync 'anything) | |
(el-get 'sync 'php-completion) | |
(require 'flymake) | |
(add-hook 'php-mode-hook | |
(lambda () | |
(require 'php-completion) | |
(php-completion-mode t) | |
(define-key php-mode-map (kbd "C-o") 'phpcmp-complete) | |
(define-key php-mode-map (kbd "[") (smartchr "[]" "array()" "[[]]")) | |
(define-key php-mode-map (kbd "]") (smartchr "array " "]" "]]")) | |
(when (require 'auto-complete nil t) | |
(make-variable-buffer-local 'ac-sources) | |
(add-to-list 'ac-sources 'ac-source-php-completion) | |
(auto-complete-mode t)))) | |
;; flymake | |
(defun flymake-php-init () | |
(let* ((temp-file (flymake-init-create-temp-buffer-copy | |
'flymake-create-temp-inplace)) | |
(local-file (file-relative-name | |
temp-file | |
(file-name-directory buffer-file-name)))) | |
(list "php" (list "-l" local-file)))) | |
(push '(".+\\.php$" flymake-php-init) flymake-allowed-file-name-masks) | |
(push '("(Parse|Fatal) error: (.*) in (.*) on line ([0-9]+)" 3 4 nil 2) flymake-err-line-patterns) | |
(add-hook 'php-mode-hook (flymake-mode t)) | |
(el-get 'sync 'php-eldoc) | |
;; (add-hook 'php-mode-hook | |
;; (lambda () | |
;; (require 'php-completion) | |
;; (php-completion-mode t) | |
;; (define-key php-mode-map (kbd "C-o") 'phpcmp-complete))) | |
(when (require 'tramp nil t) | |
(setq tramp-default-method "ssh")) | |
(custom-set-variables | |
'(make-backup-files nil) | |
'(auto-save-default nil)) | |
(when (require 'php-mode nil t) | |
(defun my/php-mode-hook-function () | |
(setq tab-width 4 | |
c-basic-offset 4 | |
indent-tabs-mode nil) | |
(c-set-offset 'case-label' 4) | |
(c-set-offset 'arglist-intro' 4) | |
(c-set-offset 'arglist-cont-nonempty' 4) | |
(c-set-offset 'arglist-close' 0)) | |
(add-hook 'php-mode-hook 'my/php-mode-hook-function)) | |
(el-get 'sync 'multi-term) | |
(el-get 'sync 'term+mux) | |
(when (require 'term+ nil t) | |
(require 'xterm-256color)) | |
(global-set-key (kbd "C-c C-f") 'helm-etags-select) | |
(put 'downcase-region 'disabled nil) | |
(el-get 'sync 'org-mode) | |
(require 'remember) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment