個人的なinit.elの設定です
必要箇所をお使いください
~/emacs.d/init.el
;; デザインの設定
(load-theme 'tango-dark' t)
'(region ((t (:background "#FFFF00"))))
;; MacOSXのpath_helperでPATHを取得し,
;; あらためてPATHとして設定
(let ((shell-file-name "/bin/bash"))
(setenv "PATH"
(shell-command-to-string
"eval $(/usr/libexec/path_helper -s) && printf $PATH")))
;; Emacs変数exec-pathに、環境変数PATHの内容を設定
;; m-x shell で起動するshellと-ターミナル起動の内容が
;; 一致するように環境変数を一致させる
(setq exec-path nil)
(dolist
(dir (split-string (getenv "PATH") "[:\n]"))
(when (file-directory-p dir)
(add-to-list 'exec-path dir t)))
;;
;; 起動時にbashを読む
;; (defun skt:shell ()
;; (or (executable-find "bash")
;; (executable-find "zsh")
;; ;; (executable-find "f_zsh") ;; Emacs + Cygwin を利用する人は Zsh の代りにこれにしてください
;; ;; (executable-find "f_bash") ;; Emacs + Cygwin を利用する人は Bash の代りにこれにしてください
;; (executable-find "cmdproxy")
;; (error "can't find 'shell' command in PATH!!")))
;; エラーが出た時だけログ表示
;; (custom-set-variables
;; '(init-loader-show-log-after-init 'error-only))
;; カレントディレクトリをホームディレクトリに設定
;; ""内は任意のディレクトリを指定可能
(cd "/Users/ほげほげ")
;画像を常に表示する
(auto-image-file-mode 1)
;ビジビリティ
(setq visible-bell t)
;白紙でスタートアップ表示
(setq initial-scratch-message "Hello, Emacs world!")
;; splash screenを無効にする
(setq inhibit-splash-screen t)
;; ;elisp
(package-initialize)
(setq package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "http://melpa.org/packages/")
("org" . "http://orgmode.org/elpa/")))
;; (init-loader-load)
;パッケージの設定
;; (add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/"))
;; (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
;; (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t) ; Org-mo
;; 日本語文字化け
(set-language-environment 'Japanese)
(prefer-coding-system 'utf-8)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; キーバインド ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; shift + 矢印キーで領域選択
(if (fboundp 'pc-selection-mode)
(pc-selection-mode))
;; 行頭 kill-line (C-k) で行全体をカット
(setq kill-whole-line t)
;; 選択領域を削除キーで一括削除
(delete-selection-mode t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; program key ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; かっこをハイライト
(show-paren-mode t)
;; 空白を一度に削除
(if (fboundp 'global-hungry-delete-mode)
(global-hungry-delete-mode 1))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; package ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;プログラムのエラーチェック
;; (eval-after-load 'flycheck
;; '(custom-set-variables
;; '(flycheck-display-errors-function #'flycheck-pos-tip-error-messages)))
;; (add-hook 'after-init-hook #'global-flycheck-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; tips ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ビープ音禁止
(setq ring-bell-function 'ignore)
;; png, jpg などのファイルを画像として表示
(setq auto-image-file-mode t)
;; 読み取り専用バッファーでもカット系でコピー可能
(setq kill-read-only-ok t)
;; 左の行を表示させる
(global-linum-mode t)
(setq linum-format "%d ")
(set-face-attribute 'linum nil
:foreground "#a9a9a9"
:height 0.9)
(custom-set-faces
'(fringe ((t (:background "blue20")))))
;;文字カウンタの設定
(defun count-lines-and-chars ()
(if mark-active
(format "[%dL%dw%dc]"
(count-lines (region-beginning) (region-end))
(how-many "[^
]+" (region-beginning) (region-end))
; (how-many "\\w+" (region-beginning) (region-end))
(- (region-end) (region-beginning)))
""))
;; (add-to-list 'default-mode-line-format
;; '(:eval (count-lines-and-chars)))
;重要語のハイライト
(global-font-lock-mode t)
;; バックアップファイルを作成させない
(setq make-backup-files nil)
;; 終了時にオートセーブファイルを削除する
(setq delete-auto-save-files t)
;; 文字サイズ,文字コード
(set-face-attribute 'default nil :family "Monaco" :height 160)
(set-fontset-font nil 'japanese-jisx0208
(font-spec :family "Hiragino_Maru_Gothic_ProN" :size 25))
(set-fontset-font nil '(#x3000 . #x30ff)
(font-spec :family "Hiragino_Mincho_ProN" :size 18))
;;; 現在行を目立たせる
(global-hl-line-mode t)
;; 初期表示位置、サイズ
(setq initial-frame-alist
'((left . 140) ; 位置 (X)
(top . 35) ; 位置 (Y)
(width . 140) ; サイズ(幅)
(height . 45) ; サイズ(高さ)
))
;; スクロールした際のカーソルの移動行数
(setq scroll-conservatively 1)
;; スクロール開始のマージンの行数
(setq scroll-margin 2)
;; 1 画面スクロール時に重複させる行数
(setq next-screen-context-lines 20)
;; 1 画面スクロール時にカーソルの画面上の位置をなるべく変えない
(setq scroll-preserve-screen-position t)
;;; 補完時に大文字小文字を区別しない
compiled-function(setq completion-ignore-case t)