Skip to content

Instantly share code, notes, and snippets.

@onmsr
Last active February 19, 2017 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onmsr/11320367 to your computer and use it in GitHub Desktop.
Save onmsr/11320367 to your computer and use it in GitHub Desktop.
my emacs minimal setting.
;;; minimal setting for emacs
;; ----- basic configuration -----
;; 言語を日本語にする
(set-language-environment 'Japanese)
;; 極力UTF-8とする
(prefer-coding-system 'utf-8)
;; 起動時のメッセージを非表示
(setq inhibit-startup-message t)
;; バックアップファイルを作成しない
(setq make-backup-files nil)
(setq backup-inhibited t)
(setq auto-save-default nil)
;; scratchのメッセージを消す
(setq initial-scratch-message "")
;; "yes or no"を"y or n"に
(fset 'yes-or-no-p 'y-or-n-p)
;;; デフォルトで折り返さない
(setq-default truncate-lines t)
;; emacs内でのMacキー設定
(setq ns-command-modifier (quote meta))
(setq ns-right-command-modifier (quote hyper))
(setq ns-alternate-modifier (quote super))
(setq ns-right-alternate-modifier (quote alt))
;; ファイル名の補完で大文字と小文字の区別をなくす
(setq completion-ignore-case t)
;; recentfに保存する履歴数
(setq recentf-max-saved-items nil)
(setq recentf-save-file "~/.emacs.d/.recentf")
;; バッファ自動再読み込み
(global-auto-revert-mode 1)
;; 前回の編集場所を記録する
(load "saveplace")
(setq-default save-place t)
(setq save-place-file "~/.emacs.d/.emacs-places")
;; bookmark
(setq bookmark-default-file "~/.emacs.d/.emacs.bmk")
;; バッファ自動再読み込み
(global-auto-revert-mode 1)
;; パッケージ管理下のシンボリックリンクをたどるときの質問を回避する
(setq vc-follow-symlinks t)
;; デフォルトのインデント・タブ設定
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
;; ----- visual -----
;; メニューバーを消す
(menu-bar-mode -1)
;; ツールバーを消す
(tool-bar-mode -1)
;; スクロールバーを消す
(set-scroll-bar-mode nil)
;; 現在行を目立たせる
(global-hl-line-mode)
;; 対応する括弧をハイライト表示させる
(show-paren-mode t)
;; カーソルの点滅を止める
(blink-cursor-mode 0)
;; カーソルの位置が何行目かを表示する
(line-number-mode t)
;; ファイルのフルパスをタイトルバーに表示
(setq frame-title-format
(format "%%f - Emacs@%s" (system-name)))
;; 一時的背景変更
(custom-set-faces
'(default ((t
(:background "black" :foreground "white")
)))
'(cursor ((((class color)
(background dark))
(:background "#00AA00"))
(((class color)
(background light))
(:background "#999999"))
(t ())
)))
;; ------ key bind -----
;; delete char
(global-set-key (kbd "C-h") 'delete-backward-char)
(global-set-key (kbd "M-h") 'backward-kill-word)
;; isearch delete char
(define-key isearch-mode-map (kbd "C-h") 'isearch-delete-char)
(define-key isearch-mode-map (kbd "M-h") 'backward-kill-word)
;; undo
(global-set-key (kbd "C-/") 'undo)
;; page-scroll
(global-set-key (kbd "M-j") 'scroll-up)
(global-set-key (kbd "M-k") 'scroll-down)
;; move
(global-set-key (kbd "M-p") (lambda () (interactive) (previous-line 10)))
(global-set-key (kbd "M-n") (lambda () (interactive) (next-line 10)))
;; next-buffer, previous-buffer
(global-set-key (kbd "M-K") 'next-buffer)
(global-set-key (kbd "M-J") 'previous-buffer)
;; window
(global-set-key (kbd "s-o") 'other-window)
(global-set-key (kbd "M-o") 'other-frame)
;; 「^」がを押しにくい場合「c」でも上の階層に移動できるようにする
;; (define-key dired-mode-map "c" 'dired-up-directory)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment