Instantly share code, notes, and snippets.

Embed
What would you like to do?
my init.el
;;; ロードパスの追加
(setq load-path (append
'("~/.emacs.d"
"~/.emacs.d/packages/emacs-jedi"
G "~/.emacs.d/packages/json-mode"
"~/.emacs.d/auto-install"
"~/.emacs.d/conf")
load-path))
;;; packages.el
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
;;; auto-install.el
(require 'auto-install)
(auto-install-compatibility-setup)
; 言語を日本語にする
(set-language-environment 'Japanese)
; 極力UTF-8とする
(prefer-coding-system 'utf-8)
;; env
;(setq exec-path (cons "/Users/kzfm/.nvm/v0.8.10/bin:/usr/local/bin" exec-path))
(setenv "PATH"
(concat "/Users/kzfm/.nvm/v0.8.10/bin:/usr/local/share/python:/Users/kzfm/bin:/usr/local/bin:/Users/kzfm/Library/Haskell/bin:/Users/kzfm/.rbenv/versions/1.9.3-p286/bin:" (getenv "PATH")))
(dolist (path (reverse (split-string (getenv "PATH") ":")))
(add-to-list 'exec-path path t))
(when (>= emacs-major-version 23)
(set-face-attribute 'default nil
:family "monaco"
:height 140)
(set-fontset-font
(frame-parameter nil 'font)
'japanese-jisx0208
'("Hiragino Maru Gothic Pro" . "iso10646-1"))
(set-fontset-font
(frame-parameter nil 'font)
'japanese-jisx0212
'("Hiragino Maru Gothic Pro" . "iso10646-1"))
(set-fontset-font
(frame-parameter nil 'font)
'mule-unicode-0100-24ff
'("monaco" . "iso10646-1"))
(setq face-font-rescale-alist
'(("^-apple-hiragino.*" . 1.2)
(".*osaka-bold.*" . 1.2)
(".*osaka-medium.*" . 1.2)
(".*courier-bold-.*-mac-roman" . 1.0)
(".*monaco cy-bold-.*-mac-cyrillic" . 0.9)
(".*monaco-bold-.*-mac-roman" . 0.9)
("-cdac$" . 1.3))))
;; keyboard bindings
(define-key global-map (kbd "C-h") 'delete-backward-char)
(define-key global-map (kbd "M-?") 'help-for-help)
(define-key global-map (kbd "M-C-g") 'grep)
; Magit rules!
;(global-set-key (kbd "C-x g") 'magit-status)
; 動的略語展開
(define-key global-map "\C-o" 'dabbrev-expand)
;; key-chord
(require 'key-chord)
(key-chord-mode 1)
(key-chord-define-global "ms" 'magit-status)
(key-chord-define-global "jk" 'delete-window)
;;; 再帰的にgrep
(require 'grep)
(setq grep-command-before-query "grep -nH -r -e ")
(defun grep-default-command ()
(if current-prefix-arg
(let ((grep-command-before-target
(concat grep-command-before-query
(shell-quote-argument (grep-tag-default)))))
(cons (if buffer-file-name
(concat grep-command-before-target
" *."
(file-name-extension buffer-file-name))
(concat grep-command-before-target " ."))
(+ (length grep-command-before-target) 1)))
(car grep-command)))
(setq grep-command (cons (concat grep-command-before-query " .")
(+ (length grep-command-before-query) 1)))
;; recentf
(setq recentf-max-saved-items 5000)
(require 'recentf-ext)
(global-set-key "\C-]" 'recentf-open-files)
;; auto-complete
(require 'auto-complete)
(global-auto-complete-mode t)
(define-key ac-complete-mode-map "\C-n" 'ac-next)
(define-key ac-complete-mode-map "\C-p" 'ac-previous)
;; http://d.hatena.ne.jp/TakashiHattori/20120629/1340942555
(add-hook 'emacs-startup-hook
(function (lambda ()
(require 'auto-complete-config)
(ac-config-default))))
;; custom-theme
(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 (manoj-dark)))
'(safe-local-variable-values (quote ((encoding . utf-8)))))
(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.
'(font-lock-function-name-face ((t (:foreground "mediumspringgreen" :weight normal :height 1.0)))))
;; ignore active-process
(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))
;; JSON
(require 'json-mode)
(add-to-list 'auto-mode-alist '("\\.tss$" . json-mode))
(add-hook 'json-mode-hook 'electric-pair-mode)
(add-hook 'json-mode-hook '(lambda ()
(setq js-indent-level 2)
))
;; other settings
(load "conf/init-common")
(load "conf/init-python")
;(load "conf/init-coffee")
;(load "conf/init-sgml")
;(load "conf/init-scss")
(load "conf/init-flymake")
;(load "conf/init-haskell")
;;;
;;; emacs起動時のwelcome ぽい画面を表示しない
(setq inhibit-splash-screen t)
;;; メタキーとoption入れ替え
(setq ns-command-modifier (quote meta))
(setq ns-alternate-modifier (quote super))
;(set-keyboard-coding-system nil)
;(setq mac-command-key-is-meta t)
;;; メニューバーとツールバーの非表示
(menu-bar-mode nil)
(tool-bar-mode nil)
(display-time-mode t) ; 時間の表示
(line-number-mode t) ; 行番号の表示
(column-number-mode t) ; 列番号の表示
;(display-battery-mode t) ; バッテリー残量の表示
(setq ring-bell-function (lambda ())) ; ビープを無効化し画面のちらつきも防ぐ
(set-frame-parameter (selected-frame) 'alpha '(80 40))
;;; 行番号表示
(global-linum-mode t)
(setq linum-format "%4d")
;;; max-frame
;(require 'maxframe)
;(add-hook 'window-setup-hook 'maximize-frame t)
(set-frame-size (selected-frame) 150 40)
;; 括弧の対応をハイライト.
(show-paren-mode t)
;; BS で選択範囲を消す
(delete-selection-mode t)
;;ビープ音を消す
;;(setq ring-bell-function 'ignore)
;;リージョン色づけ
(setq transient-mark-mode t)
;;一行カット
(setq kill-whole-line t)
;; iswitch
(iswitchb-mode 1)
;; indent
(setq-default indent-tabs-mode nil)
;; buffer
(global-set-key "\C-x\C-b" 'buffer-menu)
;; 画面分割
(defun other-window-or-split ()
(interactive)
(when (one-window-p)
(split-window-horizontally))
(other-window 1))
(global-set-key (kbd "<C-tab>") 'other-window-or-split)
;; expand-region
(global-set-key (kbd "C-=") 'er/expand-region)
(global-set-key (kbd "C-M-=") 'er/contract-region)
;; transient-mark-modeが nilでは動作しませんので注意
(transient-mark-mode t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment