Skip to content

Instantly share code, notes, and snippets.

@t-kashima
Last active December 17, 2015 15:08
Show Gist options
  • Select an option

  • Save t-kashima/5629121 to your computer and use it in GitHub Desktop.

Select an option

Save t-kashima/5629121 to your computer and use it in GitHub Desktop.
;; 文字コード
(set-language-environment "Japanese")
(set-default-coding-systems 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(set-locale-environment nil)
(setq-default tab-width 4 indent-tabs-mode nil)
(setq default-major-mode 'text-mode)
(setq mac-pass-control-to-system nil)
;; Autosave
(setq auto-save-default nil)
;; Backup Config
(setq make-backup-files t)
(setq backup-directory-alist
(cons (cons "\\.*$" (expand-file-name "~/.backup"))
backup-directory-alist))
(setq version-control t)
(setq kept-new-versions 5)
(setq kept-old-versions 5)
(setq delete-old-versions t)
(setq vc-make-backup-files t)
(setq load-path
(append '("~/.emacs.d"
"~/.emacs.d/elisp"
"~/.emacs.d/site-lisp"
"~/.emacs.d/elisp/apel"
"~/.emacs.d/auto-install"
"~/.emacs.d/elisp/emu"
"~/.emacs.d/elisp/skk") load-path))
(let ((default-directory (expand-file-name "~/.emacs.d/elisp")))
(add-to-list 'load-path default-directory)
(if (fboundp 'normal-top-level-add-subdirs-to-load-path)
(normal-top-level-add-subdirs-to-load-path)))
;; modeの切り替え設定
(when (require 'haml-mode nil t)
(setq auto-mode-alist
(cons '("\\.haml\\'" . haml-mode) auto-mode-alist)))
(when (require 'perl-mode nil t)
(setq auto-mode-alist
(cons '("\\.pl\\'" . perl-mode) auto-mode-alist)))
(when (require 'perl-mode nil t)
(setq auto-mode-alist
(cons '("\\.t\\'" . perl-mode) auto-mode-alist)))
(require 'coffee-mode)
(add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode))
(add-to-list 'auto-mode-alist '("Cakefile$" . coffee-mode))
(defalias 'perl-mode 'cperl-mode)
(require 'cperl-mode)
(setq cperl-indent-level 4
cperl-close-paren-offset -4
cperl-continued-statement-offset 4
cperl-indent-parens-as-block t
cperl-tab-always-indent t)
(add-hook 'cperl-mode-hook '(lambda () (setq indent-tabs-mode nil)))
(require 'sgml-mode)
(setq sgml-indent-level 4
sgml-close-paren-offset -4
sgml-continued-statement-offset 4
sgml-indent-parens-as-block t
sgml-tab-always-indent t)
(add-hook 'sgml-mode-hook '(lambda () (setq indent-tabs-mode nil)))
(add-hook
'sgml-mode-hook
(lambda ()
(setq
sgml-basic-offset 4
)))
(when (require 'javascript-mode nil t)
(setq auto-mode-alist
(cons '("¥.js$" . js2-mode) auto-mode-alist)))
(autoload 'js2-mode "js2-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
(when (require 'php-mode nil t)
(setq auto-mode-alist
(cons '("¥.php$" . php-mode) auto-mode-alist)))
(put 'upcase-region 'disabled nil)
(require 'perl-completion)
(add-hook 'cperl-mode-hook
(lambda ()
(add-to-list 'ac-sources 'ac-source-perl-completion)))
(add-hook 'cperl-mode-hook 'perl-completion-mode)
(require 'php-completion)
(add-hook 'php-mode-hook
(lambda ()
(add-to-list 'ac-sources 'ac-source-php-completion)))
(add-hook 'php-mode-hook
'(lambda ()
(setq tab-width 4)
(setq c-basic-offset 4)
(setq indent-tabs-mode nil)))
;; 対応するカッコをハイライトする
(show-paren-mode t)
;; auto-installの設定
(require 'auto-install)
(setq auto-install-directory "~/.emacs.d/site-lisp")
(auto-install-update-emacswiki-package-name t)
;; anythingの設定
(require 'anything)
(require 'anything-complete)
(anything-lisp-complete-symbol-set-timer 150)
(require 'anything-config)
(define-key global-map (kbd "C-l") 'anything)
(global-set-key (kbd "M-y") 'anything-show-kill-ring)
(setq anything-idle-delay 0.3)
(setq anything-input-idle-delay 0.2)
(setq anything-candidate-number-limit 20)
(setq anything-sources
'(anything-c-source-buffers+
anything-c-source-recentf
anything-c-source-files-in-current-dir
anything-c-source-mac-spotlight
anything-c-source-colors
))
;; SKKの設定
(require 'skk-autoloads)
(global-set-key (kbd "C-x C-m") 'skk-mode)
(setq default-input-method "japanese-skk")
(setq skk-henkan-strict-okuri-precedence t)
(setq skk-check-okurigana-on-touroku t)
(setq skk-large-jisyo "~/dic/SKK-JISYO.L")
(setq skk-tut-file "~/local/etc/skk/SKK.tut")
(require 'skk-setup)
(require 'skk-study)
;; skk-server AquaSKK
(setq skk-server-portnum 1178)
(setq skk-server-host "localhost")
(add-hook 'isearch-mode-hook
(function (lambda ()
(and (boundp 'skk-mode) skk-mode
(skk-isearch-mode-setup)))))
(add-hook 'isearch-mode-end-hook
(function (lambda ()
(and (boundp 'skk-mode) skk-mode (skk-isearch-mode-cleanup))
(and (boundp 'skk-mode-invoked) skk-mode-invoked
(skk-set-cursor-properly)))))
;; Windowの設定
(setq pop-up-windows nil)
(require 'popwin nil t)
(when (require 'popwin nil t)
(setq anything-samewindow nil)
(setq display-buffer-function 'popwin:display-buffer)
(push '("*anything*" :regexp t :height 0.5) popwin:special-display-config)
)
;; fileの検索時に大文字と小文字を区別しない
(setq completion-ignore-case t)
;; emacs以外がファイルを編集した時もバッファの再読み込みを行う
(global-auto-revert-mode 1)
;; 同じファイル名の時にフォルダ名を表示してくれる
(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
;; 選択している行をハイライトする
(defface hlline-face
'((((class color)
(background dark))
(:background "dark slate gray"))
(((class color)
(background light))
(:background "#98FB98"))
(t ()))
"*Face used by hl-line.")
(setq hl-line-face 'hlline-face)
(global-hl-line-mode)
;; auto-completeの設定
(require 'auto-complete)
(global-auto-complete-mode t)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/dict")
(require 'auto-complete-config)
(ac-config-default)
(setq ac-use-menu-map t)
;; diredの時にファイル名を変更できる
(require 'wdired)
(define-key dired-mode-map "r" 'wdired-change-to-wdired-mode)
;; 一時ファイルの作成
(require 'open-junk-file)
(setq open-junk-file-format "~/junk/%Y-%m-%d-%H%M%S.")
;; ファイル内での検索を絞り込む
(when (require 'anything-c-moccur nil t)
(setq
;; anything-c-moccur用 `anything-idle-delay'
anything-c-moccur-anything-idle-delay 0.1
;; バッファの情報をハイライトする
anything-c-moccur-higligt-info-line-flag t
;; 現在選択中の候補の位置を他のwindowに表示する
anything-c-moccur-enable-auto-look-flag t
;; 起動時にポイントの位置の単語を初期パターンにする
anything-c-moccur-enable-initial-pattern t))
(global-set-key (kbd "C-M-o")
'anything-c-moccur-occur-by-moccur)
(when (require 'anything nil t)
(require 'anything-exuberant-ctags)
)
(define-key global-map (kbd "M-^") 'anything-exuberant-ctags-select-from-here)
;; Emacsをサーバとして使う
(require 'server)
(unless (server-running-p)
(server-start))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment