Giter Site home page Giter Site logo

abo-abo / swiper Goto Github PK

View Code? Open in Web Editor NEW
2.3K 2.3K 337.0 8.23 MB

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!

Home Page: https://oremacs.com/swiper/

Makefile 0.14% Emacs Lisp 99.86%
completion counsel emacs ivy search swiper

swiper's Introduction

Build Status

flexible, simple tools for minibuffer completion in Emacs

This repository contains:

Ivy, a generic completion mechanism for Emacs.

Counsel, a collection of Ivy-enhanced versions of common Emacs commands.

Swiper, an Ivy-enhanced alternative to Isearch.

Ivy

GNU-devel ELPA GNU ELPA MELPA MELPA Stable

Ivy is a generic completion mechanism for Emacs. While it operates similarly to other completion schemes such as icomplete-mode, Ivy aims to be more efficient, smaller, simpler, and smoother to use yet highly customizable.

To try Ivy, just call M-x ivy-mode. This will enable generic Ivy completion, including specific completion for file and buffer names.

Installation

Install the ivy package from GNU ELPA or MELPA.

Users of Debian ≥10 (and derivatives such as Ubuntu ≥18.04) can install Ivy, Counsel, and Swiper with sudo apt install elpa-counsel. To add Hydra support sudo apt install elpa-ivy-hydra.

Documentation

Manual

The manual is available as HTML.

Installing ivy from GNU ELPA or MELPA also installs the manual under the (ivy) Info node.

The source file for the Info page is here.

Wiki

Ivy and Swiper wiki is here: the wiki.

Small config example

(ivy-mode)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
;; enable this if you want `swiper' to use it
;; (setq search-default-mode #'char-fold-to-regexp)
(global-set-key "\C-s" 'swiper)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key (kbd "<f6>") 'ivy-resume)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> o") 'counsel-describe-symbol)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-x l") 'counsel-locate)
(global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)

Note: parts of this config can be replaced by using counsel-mode.

Counsel

GNU-devel ELPA GNU ELPA MELPA MELPA Stable

ivy-mode ensures that any Emacs command using completing-read-function uses ivy for completion.

Counsel takes this further, providing versions of common Emacs commands that are customised to make the best use of Ivy. For example, counsel-find-file has some additional keybindings. Pressing DEL will move you to the parent directory.

Enabling counsel-mode remaps built-in Emacs functions that have counsel replacements:

Emacs command Counsel equivalent
execute-extended-command counsel-M-x
describe-bindings counsel-descbinds
describe-function counsel-describe-function
describe-variable counsel-describe-variable
apropos-command counsel-apropos
describe-face counsel-describe-face
list-faces-display counsel-faces
find-file counsel-find-file
find-library counsel-find-library
imenu counsel-imenu
load-library counsel-load-library
load-theme counsel-load-theme
yank-pop counsel-yank-pop
info-lookup-symbol counsel-info-lookup-symbol
pop-to-mark-command counsel-mark-ring
bookmark-jump counsel-bookmark

Swiper

GNU-devel ELPA GNU ELPA MELPA MELPA Stable

Swiper is an alternative to isearch that uses Ivy to show an overview of all matches.

swiper.png

A Helm version of Swiper is also available: swiper-helm.

Screenshots

ivy-swiper-1.png

There's also a ten minute video demo.

Frequently asked questions

Q: How do I enter an input that matches one of the candidates instead of this candidate? Example: create a file bar when a file barricade exists in the current directory.

A: Press C-M-j. Alternatively, you can make the prompt line selectable with (setq ivy-use-selectable-prompt t).

Contributing

Please see the guidelines for reporting issues and opening pull requests.

swiper's People

Contributors

abo-abo avatar basil-conto avatar celeritascelery avatar clemera avatar damiencassou avatar darwinawardwinner avatar edkolev avatar ericdanan avatar fabacino avatar flatwhatson avatar gexplorer avatar iquiw avatar justbur avatar kaushalmodi avatar kiennq avatar leungbk avatar manuel-uberti avatar mookid avatar muirdm avatar nxtr avatar purcell avatar raxod502 avatar stebalien avatar stsquad avatar tarsius avatar tumashu avatar wilfred avatar xuhdev avatar yevgnen avatar yonta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swiper's Issues

ivy slow to prepare large number of candidates initiallly

Sorry if this is the wrong place to report this issue. I found it with the ivy projectile completion system.

I have a relative large project managed with git. git ls-files | wc -l gives 6220.

$ time sh -c 'git ls-files | wc -l'
    6220

real    0m0.014s
user    0m0.010s
sys 0m0.006s

Using the ivy backend, projectile-find-file feels like having to take a few seconds to prepare the initial list of candidates before it's ready to read input. The helm backend, in comparison, feels much faster (like less than 1 second) to get ready.

There isn't conceivable difference once the initial candidate list is shown. Both are able to narrow down the candidate list quickly with the read pattern.

Issues with ivy and the history

I have some issues with ivy and the history.

  1. The history doesn't save the eventually chosen candidate but instead saves the current pattern the user specified at the prompt. Thus, after executing whitespace-cleanup using M-x whi cl<return>, pressing M-p at the next ivy completion prompt inserts whi cl again. I had expected that it inserts whitespace-cleanup.
    Ok, in this case the current behavior is harmless because with the pattern whi cl whitespace-cleanup is the first of two matches and thus pre-selected. But if you have chosen some other candidate using C-p/C-n or the arrow keys, you cannot simply re-execute one of the last few commands using M-x <repeatedly M-p> RET but you have to manually select again.
  2. The history seems to be shared by all completion modes. I'd very much prefer to have separate histories for the different completion kinds (variable, command, function, file, buffer, some predefined collection used by some command).

swiper error: (wrong-number-of-arguments (2 . 7) 12)

I tried doing M-: (swiper "swiper-map") while in swiper.el and it gave the below error backtrace.
I get the same (wrong-number-of-arguments (2 . 7) 12) error for anything I try to search using swiper.

Debugger entered--Lisp error: (wrong-number-of-arguments (2 . 7) 12)
  ivy-read("%-3d pattern: " (#("1   ;;; swiper.el --- Isearch with an overview. Oh, man! -*- lexical-binding: t -*-" 4 8 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 ...)))))) 8 83 (face outshine-level-1 fontified t wrap-prefix #(";;;   " 0 4 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 ...))))))) "2   " #("3   ;; Copyright (C) 2015  Free Software Foundation, Inc." 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 57 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) "4   " #("5   ;; Author: Oleh Krehel <[email protected]>" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 48 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("6   ;; URL: https://github.com/abo-abo/swiper" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 45 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("7   ;; Version: 0.3.0" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 21 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("8   ;; Package-Requires: ((emacs \"24.1\"))" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 41 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("9   ;; Keywords: matching" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 25 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) "10  " #("11  ;; This file is part of GNU Emacs." 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 38 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) "12  " #("13  ;; This file is free software; you can redistribute it and/or modify" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 72 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("14  ;; it under the terms of the GNU General Public License as published by" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 75 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("15  ;; the Free Software Foundation; either version 3, or (at your option)" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 25 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 25 74 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("16  ;; any later version." 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 25 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) "17  " #("18  ;; This program is distributed in the hope that it will be useful," 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 70 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("19  ;; but WITHOUT ANY WARRANTY; without even the implied warranty of" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 69 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("20  ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 68 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("21  ;; GNU General Public License for more details." 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 51 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) "22  " #("23  ;; For a full copy of the GNU General Public License" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 56 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("24  ;; see <http://www.gnu.org/licenses/>." 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 42 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) "25  " #("26  ;;; Commentary:" 4 8 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 ...)))))) 8 19 (face outshine-level-1 fontified t wrap-prefix #(";;;   " 0 4 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 ...))))))) #("27  ;;" 4 6 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;;" 0 2 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;;" 0 2 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;;" 0 2 ...))))))) #("28  ;; This package gives an overview of the current regex search" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 65 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("29  ;; candidates.  The search regex can be split into groups with a" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 10 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 10 68 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("30  ;; space.  Each group is highlighted with a different face." 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 63 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("31  ;;" 4 6 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;;" 0 2 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;;" 0 2 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;;" 0 2 ...))))))) #("32  ;; The overview back end is `ivy'." 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 33 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 33 36 (face (font-lock-constant-face font-lock-comment-face) fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 36 38 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("33  ;;" 4 6 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;;" 0 2 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;;" 0 2 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;;" 0 2 ...))))))) #("34  ;; It can double as a quick `regex-builder', although only single" 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 33 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 33 46 (face (font-lock-constant-face font-lock-comment-face) fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 46 69 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) #("35  ;; lines will be matched." 4 7 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...)))))) 7 29 (face font-lock-comment-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;   " 0 3 ...))))))) "36  " #("37  ;;; Code:" 4 8 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 ...)))))) 8 13 (face outshine-level-1 fontified t wrap-prefix #(";;;   " 0 4 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 (face font-lock-comment-delimiter-face fontified t wrap-prefix #(";;;   " 0 4 ...))))))) #("38  (require 'ivy)" 4 5 (face (rainbow-delimiters-depth-1-face) fontified t wrap-prefix "  ") 5 12 (face font-lock-keyword-face fontified t wrap-prefix "  ") 12 14 (fontified t wrap-prefix "  ") 14 17 (face font-lock-constant-face fontified t wrap-prefix "  ") 17 18 (face (rainbow-delimiters-depth-1-face) fontified t wrap-prefix "  ")) "39  " #("40  (defgroup swiper nil" 4 5 (face (rainbow-delimiters-depth-1-face) fontified t wrap-prefix "  ") 5 13 (face font-lock-keyword-face fontified t wrap-prefix "  ") 13 14 (fontified t wrap-prefix "  ") 14 20 (face font-lock-type-face fontified t wrap-prefix "  ") 20 24 (fontified t wrap-prefix "  ")) #("41    \"`isearch' with an overview.\"" 4 6 (fontified t wrap-prefix "  ") 6 8 (face font-lock-doc-face fontified t wrap-prefix "  ") 8 15 (face (font-lock-constant-face font-lock-doc-face) fontified t wrap-prefix "  ") 15 35 (face font-lock-doc-face fontified t wrap-prefix "  ")) #("42    :group 'matching" 4 6 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 6 12 (face font-lock-builtin-face fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 12 22 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...))))))) #("43    :prefix \"swiper-\")" 4 6 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 6 13 (face font-lock-builtin-face fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 13 14 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 14 23 (face font-lock-string-face fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 23 24 (face (rainbow-delimiters-depth-1-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...))))))) "44  " #("45  (defface swiper-match-face-1" 4 5 (face (rainbow-delimiters-depth-1-face) fontified t wrap-prefix "  ") 5 12 (face font-lock-keyword-face fontified t wrap-prefix "  ") 12 13 (fontified t wrap-prefix "  ") 13 32 (face font-lock-variable-name-face fontified t wrap-prefix "  ")) #("46    '((t (:inherit isearch-lazy-highlight-face)))" 4 7 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 7 8 (face (rainbow-delimiters-depth-2-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 8 9 (face (rainbow-delimiters-depth-3-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 9 11 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 11 12 (face (rainbow-delimiters-depth-4-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 12 20 (face font-lock-builtin-face fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 20 48 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 48 49 (face (rainbow-delimiters-depth-4-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 49 50 (face (rainbow-delimiters-depth-3-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 50 51 (face (rainbow-delimiters-depth-2-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...))))))) #("47    \"Face for `swiper' matches.\")" 4 6 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 6 17 (face font-lock-doc-face fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 17 23 (face (font-lock-constant-face font-lock-doc-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 23 34 (face font-lock-doc-face fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 34 35 (face (rainbow-delimiters-depth-1-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...))))))) "48  " #("49  (defface swiper-match-face-2" 4 5 (face (rainbow-delimiters-depth-1-face) fontified t wrap-prefix "  ") 5 12 (face font-lock-keyword-face fontified t wrap-prefix "  ") 12 13 (fontified t wrap-prefix "  ") 13 21 (face font-lock-variable-name-face fontified t wrap-prefix "  ") 21 32 (face font-lock-variable-name-face fontified t wrap-prefix "  ")) #("50    '((t (:inherit isearch)))" 4 7 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 7 8 (face (rainbow-delimiters-depth-2-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 8 9 (face (rainbow-delimiters-depth-3-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 9 11 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 11 12 (face (rainbow-delimiters-depth-4-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 12 20 (face font-lock-builtin-face fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 20 28 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 28 29 (face (rainbow-delimiters-depth-4-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 29 30 (face (rainbow-delimiters-depth-3-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...)))))) 30 31 (face (rainbow-delimiters-depth-2-face) fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 (fontified t wrap-prefix #("    " 0 2 ...))))))) ...) :initial-input "swiper-map" :keymap (keymap (12 . swiper-recenter-top-bottom) (27 keymap (113 . swiper-query-replace))) :preselect "75  (defvar swiper-map" :require-match t :update-fn swiper--update-input-ivy)
  swiper--ivy("swiper-map")
  swiper("swiper-map")
  eval((swiper "swiper-map") t)
  eval-expression((swiper "swiper-map") nil)
  funcall-interactively(eval-expression (swiper "swiper-map") nil)
  #<subr call-interactively>(eval-expression nil nil)
  ad-Advice-call-interactively(#<subr call-interactively> eval-expression nil nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (eval-expression nil nil))
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

Ivy incompatible with rgrep

rgrep doesn't work with ivy-mode enabled. The problem is that rgrep queries for the globbing pattern (e.g., *.el) using file completion (concretely, it does (completing-read prompt 'read-file-name-internal ...)). Thus, ivy inserts the path of the current directory at the prompt, and there is no way to delete it completely, i.e., the / is always there. Thus the globbing pattern will always be <path><glob-pattern> where the path is at minimum /.

unfold sections in org-mode

When used in an org buffer where some part of the file are folded swift don't temporary unfold them like isearch do. And when a search is stopped the folded section aren't unfold also, isearch do this.

highlight bug?

Swiper erased all highlights in the *Package* buffer immediately after pressing M-x swiper. The same happened in the *EMMS playlist* buffer. Any idea?

Using TRAMP with ivy is cumbersome

Using ivy-mode you can hardly use TRAMP to find remote files or local files as different user. The problem is that as soon as you type / every input you entered before vanishes. That makes it impossible to enter a TRAMP file name like /[email protected]:/home/user/.emacs because after typing the / after host.domain.tld: you end up with just the input / again.

When you enter /[email protected]: and then type C-j it somehow seems to work but your HOME on the machine is opened in dired. I would have expected that I can further complete the dirs and files on the remote machine.

This is not really pressing, though. But I think there will always be special cases where ivy has problems so would it be possible to add some ivy-fallback command with a key binding which falls back to completing-read-default just for the current completion?

ivy-mode: How do I complete the selected directory candidate?

I just tried out swiper (awesome!) and then also tried out (ivy-mode 1). For buffers, variables, and commands, it is nice. But when finding a file using C-x C-f, how on earth do I complete a path component?

For example, I entered ~/.em and it shows the completions ~/.emacs and ~/.emacs.d/. I want to find ~/.emacs.d/elpa/swiper-VERSION/ivy.el, so I do C-n so that ~/.emacs.d/ is highlighted, and then what? TAB inserts just a tab, and RET finds the directory in dired. But how do I complete the directory, and then the next, and so on?

Sticky `ivy-current-match` face

I tried out swiper today and it works great except for a visual glitch.

The ivy-current-match face seems to be sticky (that overlay is not removed at the right time). The below picture should explain what I am saying:

Check out that as I navigated from one search result to the next, the parentheses on earlier match locations still have the highlight face or ivy-current-match overlays.

That is seen both in the minibuffer and the file buffer.

clipboard01

The extra overlays are removed once I do revert-buffer.

I get this when I do M-x describe-char on the characters with leftover highlights:

There are text properties here:
face (rainbow-delimiters-depth-1-face ivy-current-match)
fontified t

In some cases, as I was testing the repeatability of this bug, I have even seen

face (rainbow-delimiters-depth-1-face ivy-current-match ivy-current-match ivy-current-match)

So it looks like the overlays are not cleaned up in time.

I noticed that you updated swiper about half and hour ago but this is on the swiper version latest from Melpa as of now.

I am on emacs 25.x built from git.

Performance issue with small regexps and '*'

Brilliant extension, but here's a weird case:
Starting with arch.* works fine, then removing the . searching for a* results in unresponsive Emacs. Ran emacs -Q, then evaluated the two forms below:

(package-initialize)
(require 'swiper)

Buffer contents is the result of C-u M-! ls RET (70 lines total)

Under Archlinux, GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.7)
of 2015-01-17 on bisson

ivy fails on ERC buffers

Turned swiper on globally, then tried to search in an ERC buffer. Got the error message:

Error in post-command-hook (ivy--exhibit): (text-read-only)

And lost all syntax coloration on buffer. Search doesn't work, and trying to hit enter just gets a "Text is read-only" error. Unfortunately don't have a backtrace to share yet, but repro should be pretty easy.

save position of the last search

With isearch when you have found something the position of the last search is recorded. So that after you can go back to what you just search. And also search again the same thing by doing C-s C-s

Use non-greedy regexps (`ivy--regex`)

Currently, a swiper/ivy pattern foo bar is converted to a regexp \\(foo\\).*\\(bar\\) and that is used to filter the candidates. I'd like to suggest that you use a non-greedy pattern, e.g., \\(foo\\).*?\\(bar\\) which would visualize the shortest rather than the longest match in swiper. Currently, you get this highlighting:

This is a sentence with foo and bar where bar is foo and bar.
                        G1                               G2

As you see, there is only one match. With the suggested non-greedy regexp, you'd get:

This is a sentence with foo and bar where bar is foo and bar.
                        G1      G2               G1      G2

Now there are two matches visualized which seems more useful to me. And matches which are narrower are probably more likely the thing the user intended to match.

Feature Request: Make it configurable how a pattern is matched against candidates

Right now, swiper/ivy convert the pattern the user has typed to a regexp and use that to filter the candidates. I like this style for swiper (although I redefine ivy--regex as suggested in #47) and buffer completion, and it's ok for function/command/variable completion, but I don't like it at all for file completion. There, I'd like to have only exact substring matches starting at the first position. E.g., when I type the pattern .e when completing some file name, it should only list hidden files and directories starting with .e, e.g., .emacs and .emacs.d/ but not .TeX/ or Documents/.

Long story short: I wish that I could choose a different matching behavior for different kinds of completion just like I can do with the stock emacs completion facility (see completion-styles and completion-category-overrides).

Unable to do query-replace in swiper

This is really weird to me. I have not been able to use the new query-replace feature. I always get the error "Command attempted to use minibuffer while in minibuffer" when pressing M-q inside swiper, regardless of the pattern, matching or not.

I reduced my ~/.emacs file to this minimum:

(require 'cl)
(add-to-list 'load-path "~/.emacs.d/elpa/ivy-20150326.627")
(add-to-list 'load-path "~/.emacs.d/elpa/swiper-20150325.1136")
(load "ivy")
(load "swiper")
(setq swiper-completion-method 'ivy)

This is the output of C-h vswiper-map:

swiper-map is a variable defined in `swiper.el'.
Its value is (keymap (27 keymap (113 . swiper-query-replace)))

  This variable may be risky if used as a file-local variable.

Documentation:
Keymap for swiper.

This is what the Messages buffer had for a whole Emacs session:

Loading ivy...done
Loading swiper...done
For information about GNU Emacs and the GNU system, type C-h C-a. [2 times]
query-replace-read-to: Command attempted to use minibuffer while in minibuffer
Quit
query-replace-read-to: Command attempted to use minibuffer while in minibuffer [2 times]
Quit
Type C-x 1 to delete the help window.
Library is file ~/.emacs.d/elpa/ivy-20150326.627/ivy.elc
Library is file ~/.emacs.d/elpa/swiper-20150325.1136/swiper.elc

I have tested it with different versions/builds of Emacs. They all give me the same error.

  • GNU Emacs 24.4.4 (x86_64-apple-darwin13.4.0, Carbon Version 157 AppKit 1265.21)
    of 2014-11-21 on Atago.local
  • GNU Emacs 24.4.91.1 (x86_64-apple-darwin13.4.0, Carbon Version 157 AppKit 1265.21)
    of 2015-03-15 on Atago.local
  • GNU Emacs 24.4.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21)
    of 2014-10-20 on builder10-9.porkrind.org
  • GNU Emacs 24.4.91.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21)
    of 2015-03-08 on builder10-9.porkrind.org

Maybe you can have a nicer message when call it from empty buffer

I first installed this package and try to call it in a empty buffer (I know it is not designed for a empty buffer). I got an error message as below:

swiper--candidates: Arithmetic range error: "floor", -1.0e+INF

I think maybe you can just ignore this call or send useful error message like "no candidates" or "empty buffer" , etc.

ivy-mode doesn't work with Emacs-25 (Compile from source)

After I enabled ivy-mode, I got error when I try M-x:

Debugger entered--Lisp error: (error "Function as a collection unsupported")
  signal(error ("Function as a collection unsupported"))
  error("Function as a collection unsupported")
  ivy-completing-read("M-x " #[771 "\211\301>\203��\302\303\304\305\306����\"\307\"\310\311%\202���\312�����$\207" [obarray (nil t) make-byte-code 257 "\301�!\205��\300\302�!\232\206��\211\303N?\207" vconcat vector [symbol-name byte-obsolete-info] 4 "\n\n(fn SYM)" complete-with-action] 10 "\n\n(fn STRING PRED ACTION)"] commandp t nil extended-command-history nil nil)
  completing-read("M-x " #[771 "\211\301>\203��\302\303\304\305\306����\"\307\"\310\311%\202���\312�����$\207" [obarray (nil t) make-byte-code 257 "\301�!\205��\300\302�!\232\206��\211\303N?\207" vconcat vector [symbol-name byte-obsolete-info] 4 "\n\n(fn SYM)" complete-with-action] 10 "\n\n(fn STRING PRED ACTION)"] commandp t nil extended-command-history)
  read-extended-command()
  byte-code("\302�  \303 �E)\207" [execute-extended-command--last-typed current-prefix-arg nil read-extended-command] 3)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

font-lock-ensure is missing

When calling 'swiper I'm getting the error:
"swiper--candidates: Symbol's function definition is void: font-lock-ensure"

Swiper regex issue?

Hi!
I'm not sure if it's a Swiper issue or a problem with something else, can you point me to a direction where to look?

I've tried searching for ^I regex to find all lines where I is the first symbol, it highlighted the I in one of the lines but it haven't displayed any matched lines.

screen shot 2015-04-05 at 01 04 53

Thanks!

ivy-mode: File completion order

Currently, the files and directories are sorted alphabetically with directories coming first. Most of the time, I want to find a file in the current directory, and then having directories first is inconvenient. Also, alphabetical sorting with is usually not what one would expect. Instead, one would usually expect a sorting according to string-collate-lessp which gives the order you'd get in a shell, too.

Long story short: I think it would be nice if there were customize options that allow to specify the sorting order. E.g., a value for file completion could be '(#'ivy-directories-first-p #'string<) which would replicate the current behavior, and I would just go with '(string-collate-lessp) to get the behavior I like.

BTW: I don't see a reason to have ./, i.e., the current directory, in file completion matches, and also ../ is questionable as you can go up one directory with DEL anyway.

Ivy should confirm-nonexistent-file-or-buffer

It frequently occurs to me that I'm typing too fast and erroneous at file or buffer prompts which leads to the creation of new buffers or buffers for files that don't exist (and I haven't intended to create them).

Emacs has the customize option confirm-nonexistent-file-or-buffer. If that's set to t, when I do C-x C-f nonexistentfile RET I get visual feedback in that the prompt looks like Find file: ~/nonexistentfile [confirm] and I have to confirm by hitting RET another time.

I'd really appreciate if ivy-mode could honor this variable so that I don't accidentally find files/create buffers any longer.

Verbatim selection and candidate ordering

Excellent job with ivy-mode! Just some additional related issues I've noticed. In both cases I'm probably just missing something...

Case 1

Touch files a and ab and go to rename file a to b. Go into dired mode; press R on a; enter b. The completion selects ab and afaik there's no way to revert to just a minibuffer input without completion (this was bound to C-f in ido).

Case 2

I can't seem to find a minimal test case for this but here's the situation:

I have directories 2014.12.04_x and x, I'm calling ``find-file'to open x/a in a buffer, and from muscle memory I typex C-j a`. When these dirs are both inside a parent dir with many other files/folders, it seems to select 2014.12.04_x when typing `x C-j` instead of the full completion x, so I keep opening 2014.12.04_x/a instead of x/a. When trying to create a minimal test case for this, and these were the only two dirs in the parent, the completion seemed to do the correct thing and select x.

ivy-read is broken in projectile-find-file if projectile-completion-system is 'ivy

I got this error:

(error "Keyword argument nil not one of (:predicate :require-match :initial-input :history :preselect :keymap :update-fn :sort)")

Looks like the calling code not updated with the latest function signature?

I work around it by setting projectile-completion-system to 'default. Because I am using ivy-mode in find-file so this happens to be able to connect projectile-find-file to ivy-read eventually.

I am running projectile MELPA version 20150416.1401 and swiper MELPA version 20150422.858.

feature request: save mark where swiper starts

Like how isearch does it.

Also as of the MELPA version 20150313.1425, if C-g is pressed during swiping, or if RET is pressed with a pattern not found, the point stays at where swiper exits. It would be nicer if the point can be restored to where swiper started, in these cases.

odd behavior with (swiper initial-pattern)

It's hard to describe so I am giving steps to reproduce:

  • Add following lines in the scratch buffer. Notice the empty line. It is important:
foo 1

foo 2
foo 3
foo 4
foo 5
  • Move point to "foo 2", then evaluate (swiper "foo").
  • Note how "foo 3" is highlighted as the current match.
  • Insert one more empty line in between "foo 1" and "foo 2":
foo 1


foo 2
foo 3
foo 4
foo 5
  • Move point to "foo 2" again and eval (swiper "foo").
  • Note that now "foo 4" is highlighted as the current match.
  • Insert an empty line between "foo 2" and "foo 3", and add "foo 6" and "foo 7" following "foo 5":
foo 1


foo 2

foo 3
foo 4
foo 5
foo 6
foo 7
  • Move point to "foo 3" then evaluate (swiper "foo").
  • Note "foo 6" now becomes the current match.
  • If all the empty lines are removed, evaluating (swiper "foo") in any line just selects the current line as the current match.

So it appears that the number of empty lines prior to the original point decides how swiper selects the current match.

No candidates after `ivy-backward-delete-char` when completing files

When I do C-x C-f in scratch with ivy-mode enabled, I get the prompt 155 Find file: ~/. When I hit DEL, the prompt changes to 0 Find file: /home/ and there are no candidates shown. But actually the /home/ directory contains horn/ and test/.

I can reproduce that with any directory, e.g., C-x C-f .emacs.d C-j DEL also shows zero candidates although there are 155 files & directories in ~/.

Repeating previous searches

Is there a way to cycle through previous searches? I tried M-p but it seems to cycle through full lines of the ivy buffer (including line numbers) rather than just the query text.

As a special case of this, the only thing I've really missed from isearch while using swiper so far is the ability to quickly repeat the last search (i.e. C-s C-s in isearch).

Error : Function as a collection unsupported

Hi
I would like to try your package ivy-mode :

(use-package swiper
  :init (progn
            (ivy-mode t))
  :bind (("C-s" . swiper)
         ("C-r" . swiper)))

Then i try C-x f or M-x and i've got this error :

Debugger entered--Lisp error: (error "Function as a collection unsupported")
  signal(error ("Function as a collection unsupported"))
  error("Function as a collection unsupported")
  ivy-completing-read("Find file: " read-file-name-internal file-exists-p confirm-after-completion "~/Perso/scame/" file-name-history "~/Perso/scame/" nil)
  completing-read("Find file: " read-file-name-internal file-exists-p confirm-after-completion "~/Perso/scame/" file-name-history "~/Perso/scame/")
  read-file-name-default("Find file: " nil "~/Perso/scame/" confirm-after-completion nil nil)
  read-file-name("Find file: " nil "~/Perso/scame/" confirm-after-completion)
  find-file-read-args("Find file: " confirm-after-completion)
  byte-code("\300\301\302 \"\207" [find-file-read-args "Find file: " confirm-nonexistent-file-or-buffer] 3)
  call-interactively(find-file nil nil)
  command-execute(find-file)

I use Gnu Emacs 25.0.50.1 (2014-11-26). Any idea ?
Thanks

go to beginning of buffer

First of all, thanks for the wonderful package.

One obtrusive thing I notice is that every time I call swiper command, it will first go to the beginning of the buffer. Is this some sort of intended feature?

Also it would be great if the search word can be read off at point.

Disconnect between swiper and ivy-read API

I have both swiper and ivy loading from MELPA so they are both bleeding edge. However swiper failed to launch citing:

swiper--ivy: Wrong number of arguments: (2 . 6), 7 [2 times]

It looks like the call to ivy passed one too many arguments. I patched the function to do:

(defun swiper--ivy (&optional initial-input)
  "`isearch' with an overview using `ivy'.
When non-nil, INITIAL-INPUT is the initial search pattern."
  (interactive)
  (swiper--init)
  (let ((candidates (swiper--candidates))
        (preselect (format
                    swiper--format-spec
                    (line-number-at-pos)
                    (regexp-quote
                     (buffer-substring-no-properties
                      (line-beginning-position)
                      (line-end-position)))))
        res)
    (unwind-protect
         (setq res (ivy-read
                    (replace-regexp-in-string
                     "%s" "pattern: " swiper--format-spec)
                    candidates
                    initial-input
                    swiper-map
                    preselect
                    #'swiper--update-input-ivy))
      (swiper--cleanup)
      (if (null ivy-exit)
          (goto-char swiper--opoint)
        (swiper--action res ivy-text)))))

Basically I just dropped the nil in (ivy-read ...) and now it works.

Swiper starts very slowly on excessively large files

In this case, excessively large means a 16k LOC python file (yeah I'm not happy about it either, but this is why I'm paid to work on these things :) )

File in question:

http://hg.mozilla.org/mozilla-central/file/840cfd5bc971/dom/bindings/Codegen.py

Just running swiper in this file can take ~5 seconds to hit the minibuffer. Profiler output (taken only calling swipper) looks like:

  • command-execute 27825 89%
    • call-interactively 27825 89%
    • swiper 26582 85%
    • swiper--ivy 26582 85%
    • let 26577 85%
      • swiper--candidates 25953 83%
      • let 25953 83%
      • if 25948 83%
      • let 25948 83%
        • save-excursion 25948 83%
        • while 25916 83%
        • setq 14121 45%
        • cons 14121 45%
          zerop 11767 37%
          < 4 0%
        • swiper-font-lock-ensure 16 0%
      • unwind-protect 624 2%
    • swiper--init 5 0%
    • smex 1181 3%
    • next-line 45 0%
    • previous-line 14 0%
    • profiler-report-toggle-entry 3 0%
  • redisplay_internal (C function) 2920 9%
  • ... 253 0%
  • linum-update-current 83 0%
  • timer-event-handler 66 0%
  • delete-selection-pre-hook 18 0%
  • xselect-convert-to-string 12 0%
  • flyspell-post-command-hook 4 0%
    xselect-convert-to-targets 2 0%

isearch-forward/backward tend to come up instantly, though still lag while doing back/forward movement, because, well, it's 16k lines of python. :|

Wrong number of arguments

Hi,
I get this error on the latest version of swiper.

swiper--ivy: Wrong number of arguments: (2 . 6), 7

This is my setup, using "use-package":

(use-package swiper
  :ensure t
  :bind ("C-s" . swiper)
  :config (progn
    (setq recenter-positions '(top middle bottom))))

Doesn't work in polymode (Allow customizable list of modes to bypass font-lock-ensure?)

I've noticed that swiper doesn't work in polymode (markdown+r) buffers — I think it may have to do with font-locking, though I'll have to dig a little to be sure. What happens is that as soon as the match navigates to something in a code block, all candidates get lost.

On a related note: would it be possible to make the list of modes ignored by font-lock-ensure customizable? I could try to make a PR if that helps. May also want to add paradox to the default list (which loses fontification after running swiper). This might just make it easier for users to deal with modes where fontification messes up without modifying the package itself.

Swiper doesn't support search wrap?

When I hit C-s to issue swiper to search, when the search goes to the end of the buffer, it doesn't research from the beginning of the buffer.

Could I do some configuration to enable this behavior?

Thanks.

feature request: (defun swiper (&optional pattern)

EDIT: The issue subject might be unclear. What I'd like to suggest is to add an optional argument to the swiper function as the default regexp.

The idea is that swiper can thus be integrated with isearch like helm-swoop-from-isearch. Another integration, for example, can be with thing-at-point.

Very nice package, by the way. I tried the ivy backend and like it.

Navigating/selecting candidates

A few observations about my experience with swiper so far:

  1. Sometimes I still hit <up> and <down> out of habit and that seems to confuse ivy-read. Would be nice to define actions for these as well.
  2. I also find myself hitting <TAB> occasionally, and this seems to insert spaces instead of doing something more sane, like some sort of completion or C-j-like action.

Finding file finds it in $HOME if candidate is selected without any pattern

When finding a file with ivy-mode in some directory ~/some/dir/ and ivy shows the files in there, when you select foo.txt without giving a pattern (so just selecting it with ivy-next-line and friends and confirming with C-j or RET), in fact ~/foo.txt will be found where it should have been ~/some/dir/foo.txt.

Detailed recipe with emacs -Q:

  1. M-x package-initialize RET to load swiper/ivy
  2. M-x ivy-mode RET
  3. C-x C-f some/dirC-j so that the files in ~/some/dir/ are listed
  4. Select some arbitrary file (e.g., foo.txt.) using only C-n and C-p.
  5. Confirm selection with C-j or RET.

Now you have a buffer foo.txt (which is most likely empty) associated with the file ~/foo.txt whereas it should actually show ~/some/dir/foo.txt.

file-error "http://melpa.milkbox.net/packages/swiper-20150313.1145.el" "Not found"

I got the error when trying to install from MELPA:

Debugger entered--Lisp error: (file-error "http://melpa.milkbox.net/packages/swiper-20150313.1145.el" "Not found")
  signal(file-error ("http://melpa.milkbox.net/packages/swiper-20150313.1145.el" "Not found"))
  url-insert-file-contents("http://melpa.milkbox.net/packages/swiper-20150313.1145.el")
  package-install-from-archive([cl-struct-package-desc swiper (20150313 1145) "Isearch with an overview. Oh, man!" ((emacs (24 1)) (ivy (0 1 0))) single "melpa" nil ((:url . "https://github.com/abo-abo/swiper") (:keywords "matching")) nil])
  mapc(package-install-from-archive ([cl-struct-package-desc swiper (20150313 1145) "Isearch with an overview. Oh, man!" ((emacs (24 1)) (ivy (0 1 0))) single "melpa" nil ((:url . "https://github.com/abo-abo/swiper") (:keywords "matching")) nil]))
  package-download-transaction(([cl-struct-package-desc swiper (20150313 1145) "Isearch with an overview. Oh, man!" ((emacs (24 1)) (ivy (0 1 0))) single "melpa" nil ((:url . "https://github.com/abo-abo/swiper") (:keywords "matching")) nil]))
  package-install([cl-struct-package-desc swiper (20150313 1145) "Isearch with an overview. Oh, man!" ((emacs (24 1)) (ivy (0 1 0))) single "melpa" nil ((:url . "https://github.com/abo-abo/swiper") (:keywords "matching")) nil])
  mapc(package-install ([cl-struct-package-desc swiper (20150313 1145) "Isearch with an overview. Oh, man!" ((emacs (24 1)) (ivy (0 1 0))) single "melpa" nil ((:url . "https://github.com/abo-abo/swiper") (:keywords "matching")) nil]))
  package-menu-execute()
  funcall-interactively(package-menu-execute)
  call-interactively(package-menu-execute nil nil)
  command-execute(package-menu-execute)

At the end of the search return back to the beginning

When doing a search with a lot a of match, it would be nice to go back to the start after the last item is reached. And the same for going to the first one to the last match without strolling through the entire buffer first.

Behavioral difference in ivy when being byte-compiled or not

I use the MELPA swiper package, currently version swiper-20150422.858.

When I do

  1. emacs -Q
  2. M-x package-initialize
  3. M-x ivy-mode
  4. C-x C-f DEL

i.e., I delete the initial input ~/ of the find file prompt, I get the error completion--some: Wrong type argument: stringp, nil. After the error, I'm still at the prompt and the initial input is gone, i.e., the prompt is just 157 Find file: and the contents of my home directory are still shown as candidates.

The full backtrace is this:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-name-all-completions("" nil)
  completion-file-name-table("" nil t)
  all-completions("" completion-file-name-table nil)
  completion--file-name-table("" nil t)
  complete-with-action(t completion--file-name-table "" nil)
  #[257 "\303\302�\300\301$\207" ["" nil t complete-with-action] 6 "\n\n(fn TABLE)"](completion--file-name-table)
  completion--some(#[257 "\303\302�\300\301$\207" ["" nil t complete-with-action] 6 "\n\n(fn TABLE)"] (completion--embedded-envvar-table completion--file-name-table))
  read-file-name-internal("" nil t)
  all-completions("" read-file-name-internal)
  ivy--sorted-files(nil)
  ivy--cd(nil)
  ivy-backward-delete-char()
  funcall-interactively(ivy-backward-delete-char)
  call-interactively(ivy-backward-delete-char nil nil)
  command-execute(ivy-backward-delete-char)
  read-from-minibuffer("Search for \"foo\" in files (default all): " nil (keymap keymap (22 . ivy-scroll-up-command) (7 . minibuffer-keyboard-quit) (right . ivy-end-of-buffer) (left . ivy-beginning-of-buffer) (27 keymap (113 . ivy-toggle-regexp-quote) (16 . ivy-previous-line-and-call) (14 . ivy-next-line-and-call) (118 . ivy-scroll-down-command) (112 . ivy-previous-history-element) (110 . ivy-next-history-element) (62 . ivy-end-of-buffer) (60 . ivy-beginning-of-buffer)) (127 . ivy-backward-delete-char) (32 . self-insert-command) (18 . ivy-previous-line-or-history) (19 . ivy-next-line-or-history) (up . ivy-previous-line) (down . ivy-next-line) (16 . ivy-previous-line) (14 . ivy-next-line) (10 . ivy-alt-done) (13 . ivy-done)) nil grep-files-history)
  ivy-read("Search for \"foo\" in files (default all): " read-file-name-internal :predicate nil :require-match nil :initial-input nil :preselect "all" :history grep-files-history :keymap nil :sort t)
  ivy-completing-read("Search for \"foo\" in files (default all): " read-file-name-internal nil nil nil grep-files-history ("all" "el" "ch" "c" "cc" "cchh" "hh" "h" "l" "m" "tex" "texi" "asm") nil)
  completing-read("Search for \"foo\" in files (default all): " read-file-name-internal nil nil nil grep-files-history ("all" "el" "ch" "c" "cc" "cchh" "hh" "h" "l" "m" "tex" "texi" "asm"))
  grep-read-files("foo")
  byte-code("\304 \210�\203�� \305\232\203��\306\307�\310\211\311%C\207\n\204��\312\313!\207\314 \315�!\316\317\310�\320$ \321\232����F\207" [grep-find-command current-prefix-arg grep-find-template default-directory grep-compute-defaults (16) read-from-minibuffer "Run: " nil grep-find-history error "grep.el: No `grep-find-template' available" grep-read-regexp grep-read-files read-directory-name "Base directory: " t (4)] 8)
  call-interactively(rgrep record nil)
  command-execute(rgrep record)
  execute-extended-command(nil "rgrep" #("rgr\nautoarg-kp-mode\nautoarg-mode\nchange-log-merge\ncomint-insert-previous-argument\ndebbugs-org\ndebbugs-org-bugs\ndebbugs-org-mode\ndebbugs-org-search\ndecrease-left-margin" 3 4 (read-only nil) 4 19 (face (ivy-current-match) read-only nil) 19 167 (read-only nil)))
  funcall-interactively(execute-extended-command nil "rgrep" #("rgr\nautoarg-kp-mode\nautoarg-mode\nchange-log-merge\ncomint-insert-previous-argument\ndebbugs-org\ndebbugs-org-bugs\ndebbugs-org-mode\ndebbugs-org-search\ndecrease-left-margin" 3 4 (read-only nil) 4 19 (face (ivy-current-match) read-only nil) 19 167 (read-only nil)))
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

When I delete ivy.elc in the ELPA directory and restart emacs, or just visit ivy.el and do M-x eval-buffer RET so that the ivy code is run in interpreted mode, the behavior at step 4 from above is different. Then, C-x C-f DEL changes the initial input ~/ to /home/. With another DEL, it is changed to /, and from then on, DEL has no effect anymore, that is, the initial input stays / without being able to get rid of it.

DEL is ivy-backward-delete-char. Looking at that, I wonder how (file-name-directory (directory-file-name ivy--directory)) can become nil. If ivy-directory was nil, you would get a different error. But ivy-directory being the empty string "" causes the form to be nil.

Indeed, when adding a (message "ivy--directory = '%s'" ivy--directory) before the (ivy--cd ...) ivy--directory is never "" when ivy runs in interpreted mode. Then I byte-compiled ivy.el anew and restarted emacs. Now, I don't get the error from above anymore, and the message also shows that ivy--directory doesn't become "" anymore. The behavior in compiled and interpreted mode seems to be completely the same.

However, the behavior I have with the (message ...) is different to the original compiled scenario, too. Where DEL used to change ~/ to /home/, now DEL on ~/ simply deletes that so that the input is empty thereafter.

I really have no clue where the problem is. That a message makes a big difference suggests some weird timing issues or something alike. :-(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.