avy

Swiper, ivy, avy, migemoによるEmacsの検索強化

文章を書いている際に,ある単語を検索したくなるようなことがよくある.Emacsでのデフォルトはisearchであるが,今回は,これを強化するpackageを紹介する.また,最近開いたディレクトリ directory をまた開きたいこともよくあることである.これについてもivyによる検索が便利であるので紹介する.例によってネタ元を見たほうが早いかもしれない...(^^;;; Table of Contents swiper.el Install & setup 使い方 migemo cmigemoのinstall migemo.elのInstall & setup avy-migemo(swiperのmigemo対応) Install & setup 使い方 最近開いたディレクトリを開く swiper.el 参照1:swiper ご本家 参照2:swiper.el: 一覧付き正規表現isearch!C-sを置き換えろ 参照3:Emacsの補完&検索を超強化する Emacsでは,C-sに割り当てられたisearchによる正規表現検索がデフォルトで存在する.これをivyを用いて一覧を付加するようにした強化版である. Install & setup 以下を,int.orgに書き込む. #+begin_src emacs-lisp (use-package swiper :ensure t :config (defun isearch-forward-or-swiper (use-swiper) (interactive "p") ;; (interactive "P") ;; 大文字のPだと,C-u C-sでないと効かない (let (current-prefix-arg) (call-interactively (if use-swiper 'swiper 'isearch-forward)))) (global-set-key (kbd "C-s") 'isearch-forward-or-swiper) ) (use-package ivy :ensure t ;; :config ;; (fset 'ivy--regex 'identity) ) #+end_src ivyのコメントアウトしている部分については後述する. 使い方 現在開いているEmacsのバッファで,C-sとするだけでよい.