Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swiper-avy usage #1915

Closed
joaocortes opened this issue Jan 31, 2019 · 7 comments
Closed

swiper-avy usage #1915

joaocortes opened this issue Jan 31, 2019 · 7 comments

Comments

@joaocortes
Copy link

I'm running emacs 26.1 with counsel, ivy, avyand swiper installed from melpa and up to date.
My init file is (excluding use-package configurations)

(use-package avy)     
(avy-setup-default)
     (global-set-key (kbd "C-c C-j") 'avy-resume)
     (global-set-key (kbd "C-'") 'avy-goto-char-2)

(use-package counsel
  :init (ivy-mode 1)
  (setq ivy-use-virtual-buffers t)
  (setq ivy-count-format "(%d/%d) "))

(global-set-key (kbd "C-s") 'swiper)

When searching for "a" with swiper through this buffer,

a x a x a
a e a e a

, I expected a call to swiper-avy would allow me to jump to any of the matches.
Instead, swiper-avy only sets up one shortcut for each matching line.
Is it something wrong with my config?

Thanks

@lljr
Copy link

lljr commented Feb 6, 2019

I have a similar issue that C-' does not work out of the box and that binding C-c C-r does nothing.

Emacs v. 26.1

(use-package ivy
 :ensure t
 :bind (("C-c C-r" . ivy-resume)
    :map ivy-minibuffer-map
    ("C-'" . ivy-avy))
 :config
 (ivy-mode 1)
 (setq ivy-use-virtual-buffers t)
 (setq ivy-count-format "%d/%d ")
 (setq ivy-display-style 'fancy))

 (use-package ivy-rich
   :ensure t
   :after ivy
   :init
   (setq ivy-rich-path-style 'abbrev
     ivy-virtual-abbreviate 'full)
   :config (ivy-rich-mode 1))

 (use-package counsel
   :ensure t
   :after ivy
   :config
   (counsel-mode))

 (use-package swiper
   :ensure t
   :after ivy
   :bind (("C-s" . swiper)
      ("C-r" . swiper)))

 ;;  Actions
 ;;;;;;;;;;;;;;;

 ;;;  delete files when perusing your file system
 ;; (ivy-set-actions
 ;;  'counsel-find-file
 ;;  '(("d" delete-file "delete")))

ivy-resume also does not work. When I press the C-c C-r I get nothing...

Steps: Avy in Swiper

  1. C-s
  2. C-'

Steps ivy-Resume:

  1. C-c C-r

I should add that I use emacsclient (emacsclient -c)

@abo-abo abo-abo closed this as completed in 4ca721c Feb 6, 2019
@abo-abo
Copy link
Owner

abo-abo commented Feb 6, 2019

Thanks, please test.

@lljr
Copy link

lljr commented Feb 6, 2019

@abo-abo I cannot get it to work in a python file that only has these lines

 d = "helo"




a = "hi"

sfr  = " hlloww"

I cannot also get it to work in an Org buffer.

I don't have any extra packages for Python (not using elpy only company/company-jedi). Checked the bindings and nothing binded to C-' in company, so swiper-avy should work.

Also, nothing happens when I press C-c C-r in an org buffer, but sometimes works in an Emacs-Lisp buffer.

I have tested in an Emacs-Lisp file and it worked once. I tested in a Python and Org mode buffer and still have the same issue.

Specifically, swiper-avy still does not work. I'm not sure if I should manually add a minibuffer keybinding with C-'.

I made sure I updated the package by

  1. M-x list-packages
  2. C-s swiper
  3. Shift-u

And also went into swiper.el to line 242 and evaluated the function. I also called M-x swiper-avy in the swiper.el and I did not get any errors.]

should Swiper-avy be binded same way as ivy? ->

  (use-package ivy
    :ensure t
    :bind (("C-c C-r" . ivy-resume)
	   :map ivy-minibuffer-map
	   ("C-'" . ivy-avy))
    :config
    (ivy-mode 1)
    (setq ivy-use-virtual-buffers t)
    (setq ivy-count-format "%d/%d ")
    (setq ivy-display-style 'fancy))

If so how? Is there a variable for swiper like ivy-minibuffer-map?

@abo-abo
Copy link
Owner

abo-abo commented Feb 6, 2019

@avocadoras You don't need any extra config. Just have avy installed and press C-'.

The problem is likely in your config. Try to reproduce with emacs -Q, load only swiper and avy.

@joaocortes
Copy link
Author

In my case It's solved.
Thank you

@lljr
Copy link

lljr commented Feb 6, 2019

I loaded emacs -Q then I copied this into scratch and evaluated each. expression. Still cannot get swiper-avy to work. Also, ivy-avy has some issues and opens another buffer.

(require 'package)
(setq package-enable-at-startup nil)

(add-to-list 'package-archives
	     '("melpa" . "https://melpa.org/packages/"))

(package-initialize)

;; Bootstrap 'use-package'
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(use-package avy
  :ensure t
  :bind ("M-s" . avy-goto-word-1)) ;; also accepts integer input like go-to-line

(use-package counsel
  :ensure t
  :config
  (counsel-mode))

(use-package ivy
  :ensure t
  :after (counsel avy)
  :bind ("C-c C-r" . ivy-resume)
  :config
  (ivy-mode 1)
  (setq ivy-use-virtual-buffers t)
  (setq ivy-count-format "%d/%d ")
  (setq ivy-display-style 'fancy))

(use-package swiper
  :ensure t
  :after (ivy avy)
  :bind ("C-s" . swiper))

  (use-package ivy-rich
    :ensure t
    :after ivy
    :init
    (setq ivy-rich-path-style 'abbrev
	  ivy-virtual-abbreviate 'full)
    :config (ivy-rich-mode 1))

Although the image here was not loaded with emacs -Q, I observe the same behavior when I repeat the steps stated above.
ivy-avy-no-work-fin

EDIT: ivy-avy sometimes has that behavior, but works in most cases. I removed elpa/ and reinstalled my packages and swiper-avy still does not work :/. swiper-avy works, I was being very stupid and realized it only works after you have typed a character. I was testing if on the empty string. well, this issue is closed since the ivy-avy issue does not belong to swiper-avy.

@abo-abo
Copy link
Owner

abo-abo commented Feb 6, 2019

@avocadoras I'm glad you solved your problem :)

astoff pushed a commit to astoff/swiper that referenced this issue Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants