Hot answers tagged

14

I'd like to continue using fuzzy matching with Ivy except in swiper. The variable that determines which "regexp builder", as Ivy refers to these functions, is used for which collection function is ivy-re-builders-alist: ivy-re-builders-alist is a variable defined in ‘ivy.el’. Its value is ((t . ivy--regex-plus)) Documentation: An alist of regex building ...


11

This should work fine: (define-key eshell-mode-map (kbd "<tab>") 'completion-at-point) I don't know why the above isn't the default. But I use only shell-mode and term-mode anyway.


10

I think what you're looking for is C-M-j (ivy-immediate-done) in the mini buffer. This function is described as follows in the Ivy manual: Exits with the current input instead of the current candidate (like other commands). This is useful e.g. when you call find-file to create a new file, but the desired name matches an existing file. In that ...


8

You can use C-M-j which calls ivy-immediate-done to force the output to be exactly what you typed instead of having it complete to the the nearest match This and more information can be found in the ivy manual ivy-manual


8

The command counsel-M-x does this for you: (ivy) Global key bindings recommends you remap M-x (execute-extended-command) to counsel-M-x in order to avail of its increased Ivy-ness, e.g. via (when (commandp 'counsel-M-x) (global-set-key [remap execute-extended-command] #'counsel-M-x)) Alternatively (and more simply), you can just enable counsel-mode and ...


7

The counsel equivalent of helm-find is counsel-file-jump. See also counsel-dired-jump and John Kitchin's answer for suggestions on writing a custom function.


7

Yes, use counsel-find-file-ignore-regexp. For the simple example you provide use (setq counsel-find-file-ignore-regexp "\\.elc\\'") The are more examples in the docstring for that variable.


6

I found something that seems to work OK upon initial testing: essentially rebind <tab> to pcomplete-std-complete, but since that function isn't interactive for some reason, you need to wrap it: (define-key eshell-mode-map (kbd "<tab>") (lambda () (interactive) (pcomplete-std-complete))) The pcompete-std-complete tries to use the completions ...


6

What you want can be achieved by adding a new source to completion-at-point-functions. This isn't specific to ivy, but ivy makes use of it: (defun dabbrev-complation-at-point () (dabbrev--reset-global-variables) (let* ((abbrev (dabbrev--abbrev-at-point)) (candidates (dabbrev--find-all-expansions abbrev t)) (bnd (bounds-of-thing-at-...


6

What would be more convenient is for me to do so via counsel-find-file, navigate to the file path and then insert at the point in the current buffer (or some similar workflow with autocompletion) instead of actually opening the file. Ivy provides a built-in way to do this. During Ivy completion you can invoke custom actions on the current candidate; see (...


6

You can create a new Ivy action that opens the directory of a file name selection. It can be done with: (defun my/ivy-open-dir-action (x) (interactive) (dired (or (file-name-directory x) default-directory))) (ivy-add-actions #'counsel-file-jump '(("d" my/ivy-open-dir-action "open in dired"))) To invoke it, you can search normally and ...


5

The code in this answer is now part of Ivy: https://github.com/abo-abo/swiper/commit/ae438ff62fa3d9b98d899afc0e97c13be2148725 Within ivy-hydra, the m key is bound to the command ivy-toggle-fuzzy, which is hard-coded to toggle the variable ivy--regex-function between the regexp-building functions ivy--regex-fuzzy and ivy--regex-plus. The ivy-hydra panel is ...


5

Yes. There are 2 cases. The name you want to create doesn't match anything in the completion list, or when it does. When it doesn't, you can just type in the name and press enter. If it does match, then pressing enter will get ivy to expand the name to the completion. Here you want to call ivy-immediate-done which is bound to C-M-j by default after you ...


5

Try M-j, which is bound to ivy-yank-word in the ivy minibuffer key map. It's worth reading through the the ivy manual, either in Emacs or online. The relevant key bindings are discussed here: http://oremacs.com/swiper/#key-bindings-that-alter-the-minibuffer-input


5

There are multiple approaches to file navigation that apply here. Just to rephrase your statement: switch from ~/code/study to ~/other/code/study Easiest and most consistent: use ~ to switch to ~/ and navigate from there. Assume you visited ~/code/study once before in the current Emacs session. Press C-r to access all files you visited before. You can ...


5

For those users of an ivy/counsel persuasion, the command counsel-org-tag (added in v0.6 AFAICT) enables ivy-backed completion (including multiple selection and deselection) of org-mode tags: counsel-org-tag is an interactive autoloaded compiled Lisp function in counsel.el. (counsel-org-tag) Add or remove tags in org-mode. In my configuration ...


5

Ivy already has an action bound to "k" for ivy-switch-buffer, but it just calls kill-buffer so it does not work on virtual buffers. Based on what ido is doing, here's some code to replace the default ivy kill action with one that also handles virtual buffers by dropping them from the recentf list: (defun my-ivy-kill-buffer (buf) (interactive) (if (get-...


5

Try C-c C-o (ivy-occur) in the minibuffer.


5

When I'm opening a file I'd like . and .. to be omitted from the list of completion candidates. This is what the user option ivy-extra-directories is for: ivy-extra-directories is a variable defined in ‘ivy.el’. Its value is ("../" "./") Documentation: Add this to the front of the list when completing file names. Only "./" and "../" apply here. They ...


5

When you invoke swiper press M-p to search for previously searched thing. M-n will let you search for the word under cursor. C-s will search for the next occurence. UPD, thx @Basil After you invoke the swiper press C-s to search for a previously searched string. Press C-s again to go to the next occurrence.


5

Ivy provides a user option to control this behaviour. Quoth (ivy) Defcustoms (edit mine): -- User Option: ivy-on-del-error-function Specify what [to do] when ‘DEL’ (‘ivy-backward-delete-char’) throws. The default behavior is to quit the completion after ‘DEL’ – a handy key to invoke after mistakenly triggering a completion. and C-hvivy-on-del-...


4

According to https://github.com/abo-abo/swiper/issues/648, it's simply (setq ivy-virtual-abbreviate 'full) It's not quite as nice as opened buffers (where only the differing part is shown), but good enough. (I haven't found anything like that for ido though.)


4

This is an issue in ivy, so I filed it: https://github.com/abo-abo/swiper/issues/1112. And it's already been fixed!


4

If it's not possible for helm, how about ivy/counsel/swiper? Ivy is the library which Swiper search and Counsel convenience functions are backed by, so changing the way Ivy interprets its input affects the other two packages by extension. IIUC, all helm commands (including helm-swoop, swiper-helm) have regex enabled by default for user input. This is ...


4

C-M-j (ivy-immediate-done) - exit with the current action, calling it on the current input instead of the current candidate. This is useful especially when creating new files or directories - often the input will match an existing file, which you don’t want to select. source: https://github.com/abo-abo/swiper/blob/f0b2bc618a84d25c0b3d05314d5d5693c27b2d3e/...


3

The ivy way In short, I'm looking for a way for ivy-switch-buffer to filter buffer names through a user-given function before displaying them. ivy calls such filters "display transformers" and stores them in the property list ivy--display-transformers-list. The intention is that the user or package author call ivy-set-display-transformer: ivy-set-...


3

Two ways to find a file name deep in a directory, without having to drill down: SPC SPC counsel-file-jump lists all files below parent directory. But first use SPC f f (counsel-find-file) to select a parent directory. SPC f L (counsel-locate) lists all matching directory and file names from Linux root.


3

Maybe something like: (ivy-read "File: " (directory-files-recursively default-directory "")) You might also try this (adapted from http://oremacs.com/swiper/#example---counsel-locate): (defun counsel-find-function (str) (if (< (length str) 3) (counsel-more-chars 3) (let ((cmd (format "find %s ! -readable -prune -...


3

If you want the selected match to be displayed as an arrow, you should customize ivy-format-function, here's the definition: (defcustom ivy-format-function 'ivy-format-function-default "Function to transform the list of candidates into a string. This string is inserted into the minibuffer." :type '(choice (const :tag "Default" ivy-format-...


3

It's a bit tricky, since you can't call anything after read-from-minibuffer (called by ivy-read called by swiper) until it returns. However, there's a visible function swiper--update-input-ivy that's called in post-command-hook. You can advice this function. It could also be possible to advice ivy--exhibit (it's always in the minibuffer's post-command-hook), ...


Only top voted, non community-wiki answers of a minimum length are eligible