Hot answers tagged

25

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 after this string only completion candidates that begin with what you typed are shown. You can remove this default string in counsel-M-x command with: (setcdr (...


9

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-...


8

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

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 completion session with the currently selected candidate, whereas the latter enters a directory in the case of filename completion. See also the manual section on ...


6

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


3

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 words are needed for counsel-ag-occur. That information must be present in the links to ivy-occur-grep-mode-buffers. The following lisp code defines a new org ...


3

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-describe-function-or-variable () "Display help about the currently selected ivy result. Assumes the symbol is a function and tries with a variable describe-...


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

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, counsel-yank-pop improves upon yank-pop in that it does not require the last-command to be a yank. In such cases it just inserts the selected kill at point ...


2

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 just use the keyboard shortcut for "up one level"


2

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-empty string inserted by this function. What you need to do is provide this non-empty string, which is the value of the parameter initial. So you need (let* ((...


2

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))) It will use fuzzy searching for all ivy/counsel except for swiper. Also for M-x install smex package. Then counsel-M-x function will use it to provide better ...


2

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 '((counsel-minor . "^+") (counsel-package . "^+") (counsel-org-capture . "^") (counsel-M-x . "") (counsel-describe-...


2

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)) (magit-status-internal f))) ... something like that


2

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.


1

I'm not sure why you have both (counsel-projectile-mode) and (counsel-projectile-mode nil) in your .emacs file. Have you tried simply adding a hook to start (counsel-projectile-mode) when loading projectile? Delete (or comment out) the lines you currently have for counsel-projectile-mode and try this: (add-hook 'projectile-mode-hook 'counsel-projectile-mode)...


1

Adding the following to my .emacs seems to solve the problem: (package-initialize) But I'm a little bit confused, because 41.1 Packaging Basics says that Whenever Emacs starts up, it automatically calls the function package-initialize to load installed packages. Moreover, I had the same version of Emacs on a Linux machine, and I'm using the same ...


1

I think it has something to do with ivy-prescient. Although, there is ivy-prescient-excluded-commands which contains counsel-ag to prevent the regex generation from being disturbed I have to add (setq ivy-re-builders-alist '((swiper . ivy--regex-plus) (counsel-ag . ivy--regex-plus) (counsel-rg . ivy--regex-plus) (t ...


1

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 (counsel-register) Documentation Interactively choose a register. Key Bindings This command is not in any keymaps. References counsel-register is unused in ...


1

M-p will do it. Works like most list commands.


1

I think in theory this should be possible by adding -F to the grep flags in the counsel-git-grep-cmd-default variable by evaluating (setq counsel-git-grep-cmd-default "git --no-pager grep -F -n --no-color -I -e \"%s\"") (of course you could add this to your init.el file) However, I am not sure if it works in practice (because of some ...


1

counsel-git is calling counsel-git-cands to build the list of files. counsel-git-cands is running the shell command, which is stored in variable counsel-git-cmd, which has the value "git ls-files -z --full-name --". So you have two different options: modify the result of function counsel-git-cands to remove files from the list, you do not want. i....


1

Check out ivy-faces.el for most of the faces of interest. The face you are asking specifically is called ivy-current-match. You wanna call describe-face and choose customize this face for customization.


1

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 opened in that project would be opened. It would be basically a counsel-switch-buffer but with projects. If possible the last visited project would display first. ...


1

You can hide those entries with (setq ivy-extra-directories nil).


1

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 process window sizes to match the current window configuration", which calls set-process-window-size for each process in each affected window, which talks ...


1

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 popular demand, swiper 0.7.0 -> ivy 0.8.0. On ELPA, ivy 0.8.0 bundles ivy, swiper and counsel. On MELPA, they are separate.


1

I don't use counsel or ivy, but you can execute arbitrary elisp as part of a link. If I wanted to store search results from, say, M-x occur, I would use something like: [[elisp:(occur "phrase")][Search for phrase in this buffer]] That approach has the downside of prompting you to Execute ... as elisp (y or n), which could be annoying. If you make this ...


1

I have adapted your answer and extend it to toggle Help window (helpful when we want it gone from the screen without leaving the minibuffer) and perform Ivy's native TAB (albeit with one more key stroke). ;;;###autoload (defun my-ivy-toggle-help/tab (&rest _args) "Either describe current symbol or perform partial complete. If last command is `self'...


1

N.B. See abo-abo's comment for the quickest and IMO best (most idiomatic) solution. I believe the variable responsible for this behaviour of counsel-git-grep is ivy-calling, whose documentation states When non-nil, call the current action when ‘ivy--index’ changes. So when the value of this variable is non-nil, moving to a different candidate in any ivy-...


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