Skip to content

A seamless bridge between isearch, ace-jump-mode, avy, and helm-swoop.

Notifications You must be signed in to change notification settings

drym3r/ace-isearch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 

Repository files navigation

ace-isearch MELPA MELPA Stable

Introduction

ace-isearch.el provides a minor mode which combines isearch, ace-jump-mode or avy and helm-swoop or swiper.

The "default" behavior can be summarized as:

  • L = 1 : ace-jump-mode or avy
  • 1 < L < 6 : isearch
  • L >= 6 : helm-swoop or swiper

where L is the length of input query string during isearch. When L is 1, after a few seconds specified by ace-isearch-jump-delay, ace-jump-mode or avy will be invoked. Of course you can customize the above behaviour.

Requirements

You must install these packages manually.

Installation

You can install ace-isearch.el from MELPA with package.el

 M-x package-install ace-isearch

Otherwise you can install it by el-get.

Basic Usage

ace-isearch-mode

Enable ace-isearch minor mode:

(ace-isearch-mode +1)

global-ace-isearch-mode

Enable global ace-isearch mode:

(global-ace-isearch-mode +1)

Customization

ace-isearch-function (Default:ace-jump-word-mode)

Specify the function name utilized in invoking ace-jump-mode or avy. You should specify ace-jump-word-mode, ace-jump-char-mode, avy-goto-word-1, avy-goto-subword-1, or avy-goto-char.


ace-isearch-switch-function

You can switch the value of ace-isearch-function interactively.


ace-isearch-use-jump (Default:t)

If this variable is set to nil, ace-jump-mode or avy is never invoked.

If set to t, it is always invoked if the length of isearch-string is equal to 1.

If set to printing-char, it is invoked only if you hit a printing character to search for as a first input. This prevents it from being invoked when repeating a one character search, yanking a character or calling isearch-delete-char leaving only one character.


ace-isearch-jump-delay (Default:0.3)

Delay seconds for invoking ace-jump-mode or avy during isearch.


ace-isearch-func-delay (Default:0.0)

Delay seconds for invoking ace-isearch-function-from-isearch during isearch, which is described below.


ace-isearch-input-length (Default:6)

As default behaviour, when the input string length during isearch exceeds ace-isearch-input-length, the function specified by ace-isearch-function-from-isearch will be invoked.


ace-isearch-function-from-isearch (Default:helm-swoop-from-isearch)

Specify the function name invoked when the input string length during isearch exceeds ace-isearch-input-length. If swoop has been installed, swoop can be invoked:

(setq ace-isearch-function-from-isearch 'swoop-from-isearch)

In this case, the following setting would be better.

(define-key swoop-map (kbd "C-s") 'swoop-action-goto-line-next)
(define-key swoop-map (kbd "C-r") 'swoop-action-goto-line-prev)

Of course you can set this variable to helm-occur-from-isearch.

(setq ace-isearch-function-from-isearch 'helm-occur-from-isearch)

You can also set this variable to use swiper.

(setq ace-isearch-function-from-isearch 'ace-isearch-swiper-from-isearch)

ace-isearch-use-function-from-isearch (Default:t)

If you don't want to invoke ace-isearch-function-from-isearch, set this variable to nil.


ace-isearch-fallback-function (Default:ace-isearch-helm-swoop-from-isearch)

This functionality is optional. When isearch fails and ace-isearch-use-fallback-function is non-nil, ace-isearch-fallback-function will be invoked as a fallback function.

You should specify the symbol name of function which uses isearch-string, the query string during isearch. For a trivial example, you can specify it as follows:

(defun my-fallback-function ()
  (message "Your isearch string is %s", isearch-string))
  
(setq ace-isearch-use-function-from-isearch t)
(setq ace-isearch-fallback-function 'my-fallback-function)

ace-isearch-use-fallback-function (Default:nil)

If this variable is set to non-nil, ace-isearch-fallback-function will be invoked when isearch fails.


ace-isearch-jump-during-isearch

With this function, ace-jump-mode will be invoked further during isearch, which enables to jump to the one of the isearch candidates. This helps to reduce many key repeats of C-s or C-r.


ace-isearch-pop-mark

You can invoke ace-jump-mode-pop-mark or avy-pop-mark in accordance with the current ace-isearch-funciton. With this function, you can jump back to the last location of ace-jump-mode or avy.

Sample Configuration

(require 'ace-isearch)
(global-ace-isearch-mode +1)

(custom-set-variables
 '(ace-isearch-input-length 7)
 '(ace-isearch-jump-delay 0.25)
 '(ace-isearch-function 'avy-goto-char)
 '(ace-isearch-use-jump 'printing-char))
 
(define-key isearch-mode-map (kbd "C-'") 'ace-isearch-jump-during-isearch)

About

A seamless bridge between isearch, ace-jump-mode, avy, and helm-swoop.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Emacs Lisp 100.0%