TrinityT's Wiki

Emacs情報

最終更新:

trinityt

- view
管理者のみ編集可

Emacs

テクニック

空行削除

M-x → flush-lines → ^$

置換時に改行指定

C-q C-j

簡易キーバインドシート

上下左右へ移動 C-p, C-n, C-b, C-f
行頭・行末へ移動 C-a, C-e
1画面進む・戻る C-v, M-v
ファイルの先頭・最後へ M-<, M->
操作キャンセル C-g
強制終了 C-x C-c
一時中断 C-z (復帰はシェルからfg)
カーソルのある1文字削除 C-d
アンドゥ C-x u
カーソル位置から行末まで削除 C-k
カーソル位置にマーク C-SPC
リージョンをカット C-w (C-SPCとの合わせ技)
リージョンをコピー M-w (C-SPCとの合わせ技)
ペースト C-y
履歴ペースト C-y 後に M-y
ファイル読み込み C-x C-f
上書き保存 C-x C-s
指定ファイルに保存 C-x C-w
ウィンドウを縦に2分割 C-x 2
別のウィンドウを消す C-x 1
ウィンドウ間でカーソル移動 C-x o
バッファのリスト C-x C-b
インクリメンタル検索 C-s
文字列検索 M-x occur
文字列置換 M-%
カーソル以降置換 M-x replace-string

.emacs

;;;  X-Setting
(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.
 '(column-number-mode t)
 '(current-language-environment "Japanese")
 '(display-time-mode t)
 '(scroll-bar-mode (quote right))
 '(show-paren-mode t))
(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.
 '(default ((t (:inherit nil :stipple nil :background "black" :foreground "white" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 110 :width normal :foundry "unknown" :family "IPAGothic")))))

;;; デフォルトload-path
(add-to-list 'load-path "~/.emacs.d/elisp")

;;; 基本設定
(setq-default tab-width 4) ;;tab4文字
(setq scroll-conservatively 35 scroll-margin 0 scroll-step 1) ;;スクロール量を1にする
(setq line-number-mode t) ;;カーソル行番号表示
(setq inhibit-startup-message t) ;;スタートアップメッセージ非表示
(display-time) ;;auto-compression-mode t) ;;日本語info文字化け防止
(show-paren-mode 1) ;;対応括弧ハイライト
(setq make-backup-files nil) ;;; *.~ とかのバックアップファイルを作らない
(setq auto-save-default nil) ;;; .#* とかのバックアップファイルを作らない
(setq x-select-enable-clipboard t) ;;; Kill-ringとXのclipboardを共有する

;;; F11でfullscreenを切り替えられるようにする
(defun switch-full-screen ()
  (interactive)
  (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))
(global-set-key [f11] 'switch-full-screen)

;;; メニューを日本語化
(require 'menu-tree)

;;; line-number表示
(require 'linum)
(global-linum-mode t)
(setq linum-format "%5d")

;; Interactively Do Things (highly recommended, but not strictly required)
(require 'ido)
(ido-mode t)

;;; IIIMECF設定
(add-to-list 'load-path "~/.emacs.d/elisp/iiimecf")
(setq iiimcf-server-control-hostlist (list
          (concat "/tmp/.iiim-" (user-login-name) "/:0.0")))
(setq iiimcf-server-control-default-language "ja")
(setq iiimcf-server-control-default-input-method "atokx3")
(setq default-input-method 'iiim-server-control)
(require 'iiimcf-sc)
(global-set-key [?\S-\ ] 'toggle-input-method)

;; Rinari
(add-to-list 'load-path "~/.emacs.d/elisp/rinari")
(require 'rinari)
 
;;; rhtml-mode
(add-to-list 'load-path "~/.emacs.d/elisp/rhtml")
(require 'rhtml-mode)
(add-hook 'rhtml-mode-hook
(lambda () (rinari-launch)))
 
;;; emacs-nav
(add-to-list 'load-path "~/.emacs.d/elisp/emacs-nav")
(require 'nav)
(global-set-key "\C-x\C-d" 'nav-toggle)

;;; elscreen
(add-to-list 'load-path "~/.emacs.d/elisp/elscreen")
(require 'elscreen)

IIIMECFについて

ATOK標準のキーバインドを使用可能とするため、iiimcf.el(IIIMECF付属)に以下のパッチを当てる。

パッチの当て方
$ patch iiimcf.el < iiimcf.patch
iiimcf.patch
--- lisp/iiimcf.el      2007-12-23 03:33:55.000000000 +0900
***************
*** 284,289 ****
--- 284,302 ----
 
  (defvar iiimcf-keycode-spec-alist
    `((13 10 0)
+
+     (11 37 65535)     ; Ctrl + k
+     (12 39 65535)     ; Ctrl + l
+     (14 40 65535)     ; Ctrl + n
+
+     (21 117 65535)    ; Ctrl + u
+     (9 118 65535)     ; Ctrl + i
+     (15 119 65535)    ; Ctrl + o
+     (16 120 65535)    ; Ctrl + p
+
+     (2 38 65535)      ; Ctrl + b
+     (7 27 65535)      ; Ctrl + g
+
      (32 32)
      ,@(mapcar #'(lambda (x) (list x x 0))
              (iiimcf-numseq 1 31))
目安箱バナー