Using Emacs - 6 - Searching a Swiper

This video is all about using incremental search to navigate through your emacs buffers.

You can use the default incremental searchb, bound to C-s for isearch-forward C-r to search backwards (reverse).

They work really well as is but I prefer using Swiper. The video demos both and the Swiper home page has loads of details.

Part of the Swiper package includes ivy and counsel which I use instead of ido.

The video also mentions lorem-ipsum mode for generating text quickly and describe-mode in the help system.

Here's the code we added for swiper:

;; it looks like counsel is a requirement for swiper
(use-package counsel
  :ensure t
  )

(use-package swiper
  :ensure try
  :config
  (progn
    (ivy-mode 1)
    (setq ivy-use-virtual-buffers t)
    (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> l") 'counsel-load-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 read-expression-map (kbd "C-r") 'counsel-expression-history)
    ))

and we commented out the ido stuff:

;; using swiper so ido no longer needed
;;(setq ido-enable-flex-matching t)
;;(setq ido-everywhere t)
;;(ido-mode 1)

If you want to see a nice video specifically on swiper by the author, here it is:

Relevant links:

Comments

Comments powered by Disqus

Enter your email address:

Delivered by FeedBurner

Google Analytics Alternative