A front-end for ag (the silver searcher) with ivy interface. The package provides functionality like counsel-ag
but allows to traverse upwards search directory and some extra switches.
(use-package ivy-ag
:init (setq ivy-ag-switchable-directories
(list user-emacs-directory org-directory))
:straight (ivy-ag
:type git
:host github
:repo "KarimAziev/ivy-ag")
:bind (("C-c C-s" . ivy-ag)
("C-c M-s" . ivy-ag-default-dir)
(:map ivy-ag-map
("C-l" . ivy-ag-up)
("M-." . ivy-ag-toggle-vcs-ignores)
("C->" . ivy-ag-switch-next-dir)
("C-<" . ivy-ag-switch-prev-dir)
("C-c o" . ivy-ag-open-in-other-window)
("C-M-." . ivy-ag-change-file-type)
("C-." . ivy-ag-cd))))
Or download the repository and add it to your load-path
.
(add-to-list 'load-path "/path/to/ivy-ag/")
(require 'ivy-ag)
(define-key global-map (kbd "C-c C-s") 'ivy-ag)
(define-key global-map (kbd "C-c M-s") 'ivy-ag-default-dir)
(define-key ivy-ag-map (kbd "C-l") 'ivy-ag-up)
(define-key ivy-ag-map (kbd "M-.") 'ivy-ag-toggle-vcs-ignores)
(define-key ivy-ag-map (kbd "C->") 'ivy-ag-switch-next-dir)
(define-key ivy-ag-map (kbd "C-<") 'ivy-ag-switch-prev-dir)
(define-key ivy-ag-map (kbd "C-.") 'ivy-ag-cd)
There are two main commands: ivy-ag
and ivy-ag-default-dir
.
The first one performs a search starting at the current project’s root and ivy-ag-default-dir
- at the current directory.
During executing ivy-ag
and ivy-ag-default-dir
, such commands are available in the minibuffer:
Key | Command |
---|---|
C-l | ivy-ag-up |
C-. | ivy-ag-cd |
C-< | ivy-ag-switch-prev-dir |
C-> | ivy-ag-switch-next-dir |
C-<backspace> | ivy-ag-up |
C-c C-o | ivy-ag-open-in-other-window |
M-. | ivy-ag-toggle-vcs-ignores |
C-M-. | ivy-ag-change-file-type |
To change keybindings, modify the variable ivy-ag-map
, e.g.:
(define-key ivy-ag-map (kbd "C-<backspace>") 'ivy-ag-up)
ivy-ag-switchable-directories
List of directories for switching with ivy-ag-switch-next-dir
and ivy-ag-switch-prev-dir
.
ivy-ag-initial-input-chars
Chars in the same format as for skip-chars-forward
. They are used to determine initial input.