Skip to main content
31 votes
Accepted

Counsel M-x always shows "^"

ivy-initial-inputs-alist is a variable that controls the default minibuffer contents when using ivy (which is used by counsel). The default "^" string means that if you type something immediately ...
mkcms's user avatar
  • 1,370
11 votes
Accepted

Code auto completion with ivy

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-...
abo-abo's user avatar
  • 14.2k
9 votes
Accepted

How to ignore certain filename patterns in `find-file`/`counsel-find-file`?

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.
justbur's user avatar
  • 1,510
9 votes
Accepted

Show counsel-ag results in separate buffer?

Try C-c C-o (ivy-occur) in the minibuffer.
Erik Hetzner's user avatar
8 votes
Accepted

Do not open dired for directories when using counsel-find-file

By default (I am not familiar with Spacemacs overrides), Ivy binds C-m/RET to the command ivy-done and C-j to ivy-alt-done. As described in the manual, the difference is that the former ends the ...
Basil's user avatar
  • 12.5k
8 votes

What's the equivalent of `helm-find` in ivy/counsel? I want to find files **recursively**

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.
Basil's user avatar
  • 12.5k
6 votes
Accepted

ivy counsel find-file with similar name

Using C-M-j when you're at prompt line. Binds to ivy-immediate-done As manual states it goes with current input instead the current candidate.
Muihlinn's user avatar
  • 2,644
6 votes
Accepted

How can I edit the beginning of the counsel-find-file filename whilst preserving the rest

Press C-M-y (ivy-insert-current-full) to yank the current directory on to the end of the current path. This can then be edited as usual and then hitting tab goes back to normal ivy completion. Thanks ...
Mike Crowe's user avatar
5 votes
Accepted

Don't show "." and ".." in counsel-find-file

You can hide those entries with (setq ivy-extra-directories nil).
Swarnendu Biswas's user avatar
4 votes
Accepted

counsel-rg how to repeat last search?

M-p will do it. Works like most list commands.
Muihlinn's user avatar
  • 2,644
3 votes

Projectile switch between opened projects

What I would want is a function or a package that could display all opened projectile projects with ivy or helm and let me choose a candidate. When the candidate would be selected, the last buffer ...
Basil's user avatar
  • 12.5k
3 votes
Accepted

How can I store an org-link to a list of search results from ivy-occur?

The dedicated buffers you are talking about in your question are ivy-occur-grep-mode-buffers. Those are filled by counsel-ag-occur. Only the default directory and the buffer name containing the search ...
Tobias's user avatar
  • 33.3k
3 votes
Accepted

What's the equivalent of `helm-find` in ivy/counsel? I want to find files **recursively**

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 ...
John Kitchin's user avatar
  • 11.9k
3 votes
Accepted

Making counsel-find-file not open dired on ./

This might be the best solution: (setq ivy-extra-directories nil) Not only will you not accidentally dired into ./, it's not even displayed as a candidate. And ../ is redundant too because you can ...
yafov's user avatar
  • 314
3 votes
Accepted

Using default results with ivy and `read-file-name`

read-file-name has lots of optional parameters. You are supplying default as the value for default-filename. The documentation says that this is the value used if the user exits with the same non-...
icarus's user avatar
  • 1,924
3 votes

Counsel M-x always shows "^"

Setting ivy-initial-inputs-alist to an empty string for counsel-M-x specifically can be done via the M-x customize-option RET ivy-initial-inputs-alist RET interface. Shown here as a lisp-expression '((...
user1064555's user avatar
3 votes
Accepted

after previous `counsel-yank-pop`, `yank` the last yanked entry

counsel-yank-pop works as desired as of 2017-12-08. The command now also accepts the same prefix argument as yank-pop which causes the corresponding kill to be preselected during completion. Finally,...
Basil's user avatar
  • 12.5k
3 votes

Rebind TAB to show help in counsel minibuffer

I've found the solution, (intern (ivy-state-current ivy-last)) will return the symbol of the current ivy result, which I can then pass to describe-function or describe-variable. (defun counsel-...
Facundo Olano's user avatar
3 votes
Accepted

Can counsel functions use ido-flex style matching?

For a regular counsel (that is actually using ivy backend) try to setup smth like: (setq ivy-re-builders-alist '((swiper . ivy--regex-plus) (t . ivy--regex-fuzzy))) ...
Maxim Kim's user avatar
  • 1,766
3 votes

Selecting a directory like counsel-find-file

I just figured this out myself (using counsel-dired as a model): (defun my-counsel-find-directory (&optional start-dir) "Return a directory chosen by the user. The user is prompted to ...
izkon's user avatar
  • 1,878
3 votes
Accepted

Ivy: How can I execute an action on a selection without opening the action menu?

However, I would like to call this function directly when I'm in Ivy (as I'm filtering files/buffers and selecting a candidate), instead of having the additional step of opening the actions menu. How ...
Basil's user avatar
  • 12.5k
3 votes
Accepted

How to implement google/other search engine search of visually selected text in evil mode (counsel-search of selected text)

Try this function: (defun counsel-search-selected (start end) (interactive "r") (let ((region (buffer-substring-no-properties start end))) (counsel-search-action region))) However, ...
Tianshu Wang's user avatar
  • 1,784
2 votes
Accepted

temporary change magit-display-buffer-function

Sorry, I haven't really tried this, but can't you just use a let binding instead of the call to setq? (with-ivy-window (let ((magit-display-buffer-function 'magit-display-buffer-fullframe-status-v1)...
Stefan Kamphausen's user avatar
2 votes

How can I search through registers via counsel?

Latest version of counsel (version 20190522.2133 on MELPA) has counsel-register. From the documentation: counsel-register is an interactive, autoloaded function defined in counsel.el. Signature (...
Manuel Uberti's user avatar
2 votes

Searching a specific project sub-directory with projectile

You can also try C-u M-x project-find-regexp. It's a part of the project package, built-in in the latest versions of Emacs but also distributed through GNU ELPA. Be warned though: this calling ...
Dmitry's user avatar
  • 3,803
2 votes

Projectile switch between opened projects

As @Swedgin said in comments projectile-switch-open-project will work without doing nothing more. Given that you want to switch to an open project buffer, you should also customize projectile-switch-...
Muihlinn's user avatar
  • 2,644
2 votes
Accepted

How can disable TAB to execute selected line in `counsel-M-x`?

(ivy-define-key ivy-minibuffer-map (kbd "TAB") #'ivy-partial) Originally TAB binds to ivy-partial-or-done. Note that in ivy terms, "done" means your term "execute", ...
TerryTsao's user avatar
  • 1,216
2 votes

Limit counsel-locate to certain file type and directory

counsel-locate essentially just calls the system locate command (see man 1 locate). You can control which executable is called by customising the user option locate-command from the built-in package ...
Basil's user avatar
  • 12.5k
1 vote
Accepted

Why does `term-emulate-terminal` get executed every time `read-from-minibuffer` gets executed?

I suspect the reason for this is: Calling counsel-switch-buffer is triggering a window configuration change. window-configuration-change-hook contains window--adjust-process-windows to "Update ...
phils's user avatar
  • 51.6k
1 vote
Accepted

Why does ivy 1.13.0 from GNU ELPA have counsel included?

I've asked a similar question some years ago, it appears to be the byproduct of a rename: https://github.com/abo-abo/swiper/issues/915#issuecomment-286198927. To quote the relevant part: Oh yea. By ...
wasamasa's user avatar
  • 22.2k

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