「メンバー/SGHR/ある日の.emacs」の編集履歴(バックアップ)一覧はこちら
追加された行は緑色になります。
削除された行は赤色になります。
;; キーバインド
(define-key global-map "\C-h" 'delete-backward-char) ; 削除
(define-key global-map "\C-o" 'dabbrev-expand) ; 補完
(define-key global-map "\C-z" 'scroll-down) ; scroll-down
(define-key global-map "\C-xl" 'goto-line) ; 指定行に移動
(define-key global-map "\C-xr" 'replace-string) ; 置換
(define-key global-map "\C-xi" 'indent-region) ; regionをindent
(define-key global-map "\C-xs" 'shell) ; shell起動
(define-key global-map "\C-xp" 'compile) ; コンパイル
(define-key global-map [C-tab] 'other-window) ; window移動
(define-key global-map [S-C-tab]
(lambda () (interactive) (other-window -1)))
(global-set-key "\C-c\C-c" 'comment-or-uncomment-region) ; regionをコメントアウト
;; \C-lで現在行をwindowの一番上の行にする
(defun line-to-top-of-window ()
(interactive)
(recenter 0))
(global-set-key "\C-l" 'line-to-top-of-window)
;; 英語フォント
(set-face-attribute 'default nil
:family "Osaka"
:height 150)
;; 日本語フォント
(set-fontset-font
nil 'japanese-jisx0208
(font-spec :family "Hiragino Maru Gothic ProN"))
;; 起動時の画面はいらない
(setq inhibit-startup-message t)
(setq initial-scratch-message "")
;; リージョンを色付け
(setq transient-mark-mode t)
(setq highlight-nonselected-windows t)
;; 対応する括弧を強調
(show-paren-mode t)
;; 初期フレームの設定
(setq initial-frame-alist
(append
'((top . 75) ; フレームの Y 位置(ピクセル数)
(left . 250) ; フレームの X 位置(ピクセル数)
(width . 150) ; フレーム幅(文字数)
(height . 50)) ; フレーム高(文字数)
initial-frame-alist))
;; 起動時に2分割
(setq w (selected-window))
(setq w2 (split-window w nil t))
;; shell-modeで矢印キーの上下でコマンド履歴を表示
(setq shell-mode-hook
(function (lambda ()
(define-key shell-mode-map "\C-p" 'comint-previous-input)
(define-key shell-mode-map "\C-n" 'comint-next-input))))
;; 背景
(set-background-color "Black")
(set-foreground-color "White")
(set-cursor-color "Gray")
(set-frame-parameter nil 'alpha 90)
;; バックアップを作らない
(setq backup-inhibited t)
;; 終了時にオートセーブファイルを消す
(setq delete-auto-save-files t)
;; ファイルに間違いがあれば無効
(custom-set-variables '(inhibit-startup-screen t))
(custom-set-faces)
;; \の代わりにバックスラッシュを入力する
;;(define-key global-map [?\] [?\\])
;; スクロールバーを右側に表示する
;;(set-scroll-bar-mode 'right)
//lisp/linenumber
;; キーバインド
(define-key global-map "\C-h" 'delete-backward-char) ; 削除
(define-key global-map "\C-z" 'scroll-down) ; scroll-down
(define-key global-map "\C-q" 'query-replace) ; 置換
(define-key global-map "\C-xl" 'goto-line) ; 指定行に移動
(define-key global-map "\C-xr" 'replace-regexp) ; 一括置換
(define-key global-map "\C-xi" 'indent-region) ; regionをindent
(define-key global-map "\C-xs" 'shell) ; shell起動
(define-key global-map "\C-xp" 'compile) ; コンパイル
(define-key global-map "\C-xf" 'occur) ; 検索
(define-key global-map "\C-xg" 'rgrep) ; ディレクトリ以下を再帰的に検索
(define-key global-map "\C-xu" 'revert-buffer) ; 更新
(define-key global-map "\C-xd" 'delete-trailing-whitespace) ; 行末の空白削除
(define-key global-map [C-tab] 'other-window) ; window移動
(global-set-key "\C-x\C-b" 'buffer-menu) ; buffer-menuをその場で開く
;; mozc
(require 'mozc)
(setq default-input-method "japanese-mozc")
;; \C-lで現在行を移動する
(setq recenter-positions '(top middle bottom))
;; フォント
(set-face-attribute 'default nil
:family "RictyDiminished"
:height 120)
;; タイトルバーにファイルのフルパスを表示
(setq frame-title-format "%f")
;; 行番号を表示する
(global-linum-mode t)
;; 起動時の画面はいらない
(setq inhibit-startup-message t)
(setq initial-scratch-message "")
;; リージョンを色付け
(setq transient-mark-mode t)
(setq highlight-nonselected-windows t)
;; 現在行をハイライト
(if window-system (global-hl-line-mode t))
(if window-system (set-face-background 'hl-line "#112233"))
;; 対応する括弧をハイライト
(show-paren-mode t)
(setq show-paren-style 'mixed)
;; 保存時に行末の空白を削除
;(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; whitespace
(require 'whitespace)
(setq whitespace-style
'(face ; faceで可視化
trailing ; 行末
tabs ; タブ
empty ; 先頭/末尾の空行
space-mark ; 表示のマッピング
tab-mark
))
(setq whitespace-display-mappings
'((tab-mark ?\t [?\u00BB ?\t] [?\\ ?\t])))
(global-whitespace-mode 1)
;; インデントの設定
(setq-default c-basic-offset 4
tab-width 4
indent-tabs-mode nil)
;; 矩形選択
(cua-mode t)
(setq cua-enable-cua-keys nil)
;; 初期フレームの設定
(setq initial-frame-alist
(append
'((top . 45) ; フレームの Y 位置(ピクセル数)
(left . 250) ; フレームの X 位置(ピクセル数)
(width . 162) ; フレーム幅(文字数)
(height . 58) ; フレーム高(文字数)
)
initial-frame-alist))
;; \C-x@で横に3分割
(defun split-window-horizontally-n (num_wins)
(interactive "p")
(if (= num_wins 2)
(split-window-horizontally)
(progn
(split-window-horizontally
(- (window-width) (/ (window-width) num_wins)))
(split-window-horizontally-n (- num_wins 1)))))
(global-set-key "\C-x@" '(lambda ()
(interactive)
(split-window-horizontally-n 3)))
;; 起動時に2分割
(if window-system
(add-hook 'after-init-hook (lambda()
(interactive)
(split-window-horizontally-n 2))))
;; shell-modeで矢印キーの上下でコマンド履歴を表示
(setq shell-mode-hook
(function (lambda ()
(define-key shell-mode-map [up] 'comint-previous-input)
(define-key shell-mode-map [down] 'comint-next-input))))
;; 背景
(set-background-color "Black")
(set-foreground-color "White")
(set-cursor-color "Gray")
(set-frame-parameter nil 'alpha 80)
;; バックアップを作らない
(setq backup-inhibited t)
;; オートセーブファイルを作らない
(setq auto-save-default nil)
;; 終了時にオートセーブファイルを消す
;(setq delete-auto-save-files t)
;; ファイルに間違いがあれば無効
(custom-set-variables
'(ediff-window-setup-function (quote ediff-setup-windows-plain))
'(inhibit-startup-screen t))
;; yes or noをy or n
(fset 'yes-or-no-p 'y-or-n-p)
;; ファイル名が同じならバッファ名にディレクトリ名を追加
(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
;; GCを減らす
(setq gc-cons-threshold (* 10 gc-cons-threshold))
;; 1行ずつスクロール
(setq scroll-conservatively 35
scroll-margin 0
scroll-step 1)
(setq comint-scroll-show-maximum-output t) ;; shell-mode
;; wsgiファイルをpython-mode
(setq auto-mode-alist
(append '(("\\.wsgi$" . python-mode)) auto-mode-alist))
;; パッケージ管理
(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-complete
(require 'auto-complete-config)
(ac-config-default)
(setq ac-auto-start nil)
(ac-set-trigger-key "\C-o")
(setq ac-use-menu-map t) ; 補完メニュー表示時にC-n/C-pで補完候補選択
;; jedi
;(require 'epc)
;(require 'python)
;(require 'jedi)
;(add-hook 'python-mode-hook 'auto-complete-mode)
;(add-hook 'python-mode-hook 'jedi:setup)
;(define-key python-mode-map (kbd "\C-o") 'jedi:complete)
;(setq jedi:complete-on-dot t)
;; magit
(require 'magit)
(set-face-foreground 'magit-blame-heading "yellow")
;; markdown-mode
;(autoload 'markdown-mode "markdown-mode.el" "Major mode for editing Markdown files" t)
;(setq auto-mode-alist (cons '("\\.md" . markdown-mode) auto-mode-alist))
;; python-modeで80文字を超えていたらハイライト
(add-hook 'python-mode-hook
(lambda ()
(font-lock-add-keywords nil '(("^[^\n]\\{80\\}\\(.*\\)$" 1 font-lock-warning-face t)))))