Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend Ivy yank commands #1604

Closed
wants to merge 5 commits into from

Conversation

@basil-conto
Copy link
Collaborator

commented May 30, 2018

Commit summary:

  1. Address #1588. The question of whether a default key binding should be provided for ivy-yank-char still remains.
  2. Add a similar command for symbols (same question about key binding).
  3. Minor refactoring.
  4. Unconditionally allow all yank commands to continue yanking until EOL.
  5. Add optional prefix arguments to all yank commands.

Please see each commit message in turn for further details.

basil-conto added 5 commits May 30, 2018
Add Ivy version of isearch-yank-char
ivy.el (ivy--yank-by): New function generalising old ivy-yank-word.
(ivy-yank-word): Use it.
(ivy-yank-char): New command.
swiper.el (swiper--update-input-ivy): Make exception for it.
doc/ivy.org (Key bindings that alter the minibuffer input):
Mention it.

Re: #1588
ivy.el (ivy--yank-by): Make safer
Wrap motion in unwind-protect to ensure point is restored in the
theoretical case that something goes wrong.  Specify FIXEDCASE and
LITERAL arguments to replace-regexp-in-string.
ivy.el (ivy--yank-by): Allow yank to reach EOL
Previously, if FN (e.g. forward-word) moved point to the next line,
the yank would be "aborted" (i.e. original point would be restored
and no text would be inserted).  This change allows ivy--yank-by to
continue yanking as far as possible within the current line.
Add new command ivy-yank-symbol
ivy.el (ivy-yank-symbol): New command.
swiper.el (swiper--update-input-ivy): Make exception for it.
doc/ivy.org (Key bindings that alter the minibuffer input):
Mention it.
ivy.el: Add prefix arguments to yank commands
(ivy--yank-by): Clamp new position within original line bounds.
(ivy-yank-word, ivy-yank-symbol, ivy-yank-char):
Accept optional prefix argument.
@zw963

This comment has been minimized.

Copy link

commented on 08e0894 May 31, 2018

This PR worked for me, i binding those function like following:

(define-key ivy-minibuffer-map [(meta f)] 'ivy-yank-word)
(define-key ivy-minibuffer-map [(control f)] 'ivy-yank-char)

Tough it conflict with default moving binding, in isearch-mode, exist a builtin
funciton for this: isearch-edit-string, when i press C-s open isearch-mode,
i can use Ctrl+F or Meta+F select current word or char, if i want to edit, i press
Meta+E(binding to isearch-edit-string), start to edit, and press RET to search again.

This comment has been minimized.

Copy link
Owner Author

replied May 31, 2018

I'm not sure what you're asking @zw963. swiper differs from isearch in many ways, one of these being that the search string is always editable.

This comment has been minimized.

Copy link

replied Jun 2, 2018

@basil-conto , Yes, i think i can adapt to this changes, thanks

This comment has been minimized.

Copy link
Owner Author

replied Jun 2, 2018

@zw963 In the future, please always comment on the pull request in the project's repo (in this case abo-abo#1604), not a commit in a forked repo.

@basil-conto

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 2, 2018

See also #1501.

@abo-abo abo-abo closed this in 228086d Jun 6, 2018

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Jun 6, 2018

Thanks!

@basil-conto basil-conto deleted the basil-conto:blc/issue-1588 branch Jun 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.