Oleh Krehel [Thu, 9 Jul 2015 13:54:51 +0000 (15:54 +0200)]
Add counsel-rhythmbox
* counsel.el (counsel-completion-beg):
(counsel-completion-end): Move declarations before first use.
(dired-jump): Declare.
(counsel-rhythmbox-enqueue-song): New defun.
(counsel-rhythmbox): New command. Requires `helm-rhythmbox' package, and
Rhythmbox, obviously.
* ivy.el (ivy-call): Make interactive. Add special handling for the case
when the collection is an alist. In that case, call the action not
with the collection item, but with the cdr of said item. A bit weird,
but that's the way Helm does it, and doing it in the same way means
the action functions are cross-compatible.
* ivy-hydra.el (hydra-ivy): Bind "g" to call the current action on
current candidate without exiting.
Now it's possible to make a query to Rhythmbox, "C-o" and navigate to a
song with "j" and "k". Try the song with "g". Or use "s" once and then
enqueue different songs with e.g. "jjgjjjgjgkkg".
Oleh Krehel [Mon, 6 Jul 2015 10:03:59 +0000 (12:03 +0200)]
Add a new interface to customize additional exit points
* ivy.el (ivy--actions-list): New defvar. Store the exit points per
command.
(ivy-set-actions): New defun. Use this to set the extra exit points for
each command.
(ivy-read): Account for `ivy--actions-list'.
(ivy-switch-buffer): Set extra action to kill the buffer. Update the
call to `ivy-read'.
* counsel.el (counsel-locate): Use the single action in the function and
customize the rest via `ivy-set-actions'.
Oleh Krehel [Wed, 1 Jul 2015 13:43:33 +0000 (15:43 +0200)]
Allow to see the candidate index via ivy-count-format
* ivy.el (ivy--insert-prompt): Update.
To use this feature, use something like this:
(setq ivy-count-format "(%d/%d)")
Basically two number specifiers instead of the usual one. The problem
with this approach is that the prompt length will change as you scroll
e.g. from 9 to 10, which is uncomfortable.
Oleh Krehel [Tue, 30 Jun 2015 14:06:11 +0000 (16:06 +0200)]
Add a multi-action interface for counsel-locate
* ivy-hydra.el (hydra-ivy): Display the current action and allow to
scroll the action list with "w" and "s".
* ivy.el (ivy--get-action): New defun, a getter for the action function,
since it can also be a list now.
(ivy--actionp): New defun, checks for the action list.
(ivy-next-action): New command, scrolls to the next action in the list.
(ivy-prev-action): New command, scrolls to the previous action in the
list.
(ivy-action-name): New defun.
(ivy-call): Use `ivy--get-action'.
(ivy-read): Use `ivy--get-action'.
Oleh Krehel [Tue, 30 Jun 2015 07:15:47 +0000 (09:15 +0200)]
Make counsel-locate use a process
* counsel.el (counsel-locate-function): Update.
(counsel--async-command): New defun.
(counsel--async-sentinel): New defun.
(counsel-locate): Switch to :action, thus allowing "C-M-n" and `ivy-resume'.
Oleh Krehel [Mon, 29 Jun 2015 08:21:37 +0000 (10:21 +0200)]
Make counsel-el work with "C-M-n" and "C-M-p"
* counsel.el (counsel-el): Use the whole obarray if no initial input is
given. Filter out only function when appropriate.
(counsel-completion-beg): New defvar.
(counsel-completion-end): New defvar.
(counsel--el-action): New defun.
* ivy.el (ivy--reset-state): Set `ivy--full-length' to nil.
Oleh Krehel [Thu, 25 Jun 2015 16:36:28 +0000 (18:36 +0200)]
Allow to recursively match history with "C-r"
* ivy.el (ivy-minibuffer-map): Rebind "C-r" from
`ivy-previous-line-or-history' to `ivy-reverse-i-search'. "C-r"
binding was redundant, since "C-p" does almost the same.
(ivy-read): Separate the functionality that sets the global state based
on `ivy-last'.
(ivy--reset-state): New defun. Move all the global state setup here.
(ivy-reverse-i-search): New command. This is very similar to "C-r" in
bash - allows to match for history elements, instead of just scrolling
through them with "M-p" and "M-n".
Kaushal Modi [Fri, 19 Jun 2015 18:52:33 +0000 (14:52 -0400)]
Fix the case where file name can contain ~
- The fix make opening files like init.el~ now possible. Earlier,
hitting that last ~ char switch the dir to ~/
- This commit will now make that cd to ~/ only if ~ is the first char in
the search term
Oleh Krehel [Fri, 19 Jun 2015 13:53:39 +0000 (15:53 +0200)]
Improve performance for "^" initial input
ivy.el (ivy--filter): There's no need to anchor when the previous regex
is "^" (matches everything). The result will be index 0 anyway, but
without this optimization it can be slow for ~30k candidates.
Oleh Krehel [Fri, 19 Jun 2015 12:34:19 +0000 (14:34 +0200)]
Add better positioning to counsel-git-grep finalizer
counsel.el (counsel-git-grep-action): Use a regex instead of just
splitting the string on ":". Additionally, goto match, not just the line
of the match.
Oleh Krehel [Fri, 19 Jun 2015 11:39:33 +0000 (13:39 +0200)]
"M-i" should not switch directories
ivy.el (ivy-insert-current): When the current candidate is a directory,
just insert its name without the last "/". The user can insert "/" to
switch to that directory if necessary.
Oleh Krehel [Fri, 19 Jun 2015 09:07:07 +0000 (11:07 +0200)]
ivy.el (ivy-kill-line): Add and bind to "C-k"
The only difference to `kill-line' is that it will kill the whole input
when at the end of the minibuffer. In that case, the regular `kill-line'
was extending into the second line of the minibuffer, which is
unacceptable.