0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ido から migemo を使う設定

Last updated at Posted at 2021-01-23

idomigemoflex を併わせて使う設定です。 設定順序が違うとうまく動きません。

ido-screen-cap2.png

必要なもの

ido は附属なので他に

list-package から

list-package からインストールすると依存する他の必要パッケージも一緒にインストールされます。

cmigemo

Windows の場合 OS に合わせた cmigemo.exe を手に入れ、実行可能な適当な場所にコピーする。決め打ちするので $PATH を切る必要はありません。
Windows 以外の場合は判りません。

init.el に書き加える設定

以前はこ更新順ソートのパッチも入れていましたが、今の ido はデフォルトでそうなるようです。
** の 変数 migemo-dictionary, migemo-command を自身の環境に合わせて適宜書き換えしてください。

init.el
;; ** migemo メイン辞書をフルパスで指定.
(setq migemo-dictionary "c:/Users/ ... /cmigemo-default-win64/dict/utf-8/migemo-dict")
;; ** migemo 実行ファイルをフルパス指定.
(setq migemo-command "c:/Users/ ... /cmigemo-default-win64/cmigemo.exe")
(setq migemo-options '("-q" "--emacs"))
;; (setq migemo-user-dictionary (expand-file-name (locate-user-emacs-file "migemo/usrdic")))
;; (setq migemo-coding-system 'utf-8)
;; (setq migemo-regex-dictionary nil)

;; migemo.el が ruby 版決め打ちなのでパッチ.
(defun migemo-start-process-pre (fun name buffer program args)
  (setq args (delete "-u" args))
  (setq args (delete migemo-user-dictionary args))
  (setq args (append (list "-s" migemo-user-dictionary) args))
  (funcall fun name buffer program args))
(advice-add 'migemo-start-process :around 'migemo-start-process-pre)

(require 'migemo)
(migemo-init)

(ido-mode 1)
(ido-everywhere 1)
(require 'ido-completing-read+)
(setq ido-cr+-assume-static-collection t) ; 順列が勝手に動くのを阻止.
(ido-ubiquitous-mode 1)
;; ** ユビキタスの対象から除外したいもの.
;; (add-to-list 'ido-cr+-function-blacklist 'execute-extended-command)

;; (setq ido-create-new-buffer 'always) ; bug ってる?
(setq ido-enable-flex-matching t)       ; 中抜けでもマッチ
(setq ido-use-filename-at-point 'guess) ; 下のとセットで (ffap)
(setq ido-use-url-at-point t) ; ポイントが http:// 付近にあればそれを規定ブラウザで開く
;; (set-face-foreground 'ido-first-match "purple")

(flx-ido-mode 1)
(ido-flex-with-migemo-mode 1)

;; ** ファイルが多く開くのが遅いディレクトリは ido をバイパス.
;; (setq ido-big-directories '("Package" "sonicstage")) 

;; ** 除外する名前にバックアップファイルを追加.
(setq ido-ignore-files (cons "~\\'" ido-ignore-files))

;; `C-x  C-w' するときポイント付近が URL 文字列だと ffap が動いてしまうので阻止. 
(defun ido-write-file-around (org)
"Prevent ffap from starting during `write-file'."
  (interactive)
  (let ((ido-use-filename-at-point nil)
	(ido-use-url-at-point nil))
    (funcall org)))
(advice-add 'ido-write-file :around 'ido-write-file-around)

個人的には M-x は除外しているので、そちらで適用される通常補完の設定として以下も追加しています。

init.el
(setq completion-styles '(substring))
(setq completion-cycle-threshold 10)

ido の 主なキー操作

キー 挙動
C-s, C-r カレントマッチをローテートする (順方向/逆方向)
印字文字 絞り込む
TAB, C-i 一意に確定できる箇所まで入力ポイントを伸ばすか一覧表示
BS ディレクトリ階層を登る
C-j, RET(C-m) 確定
RET(C-m) ディレクトリならそこに降りる
a:, b:, // ... ドライブ変更等
C-e 行編集
C-k バッファ選択の場面でのキルバッファ
C-f, C-b フォールバック/ファイルとバッファのモード切替
M-m mkdir

C-f のフォールバックはプロンプトにデフォルトがある場面等で使います。
C-f RET とすると空文字、つまりデフォルトとなります。

例えば ediff のプロンプトの括弧内の値、等です。

関連リンク

Mew の補完を別のものに置き換える

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?