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

ivy-backward-delete-char can't delete into pre-existing path in counsel-find-file? #2402

Closed
AmaiKinono opened this issue Jan 6, 2020 · 3 comments

Comments

@AmaiKinono
Copy link
Contributor

AmaiKinono commented Jan 6, 2020

I saw on a forum that someone wants to use C-a C-k to kill the whole path when using counsel-find-file, but C-a won't go into the pre-existing default-directory.

Since I can press DEL (backspace) to delete it, I think a better way is to create a command that runs ivy-backward-delete-char until an error happen, and bind it to a key under counsel-find-file-map. So I did this:

(defun clear-counsel-find-file-path ()
  (interactive)
  (condition-case nil
      (while t
        (ivy-backward-delete-char))
    (error nil)))

(define-key counsel-find-file-map "C-u" 'clear-counsel-find-file-path)

But this doesn't work. Further experiments show that if I bind ivy-backward-delete-char to some key, it won't delete into the pre-existing path, but pressing DEL will. I wonder why this happens?

Update: Typing ~ or // will clear the input, but he is on a Windows machine. I don't know if you can type something like C:/ to clear the input.

@CeleritasCelery
Copy link
Contributor

Typing ~ or // will clear the input, but he is on a Windows machine. I don't know if you can type something like C:/ to clear the input.

That's the recommended approach.

@basil-conto
Copy link
Collaborator

I think this can be closed as a duplicate of #883 or one of its linked issues.

@abo-abo
Copy link
Owner

abo-abo commented May 3, 2020

C-M-y can be used. So I think we can close this.

@abo-abo abo-abo closed this as completed May 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants