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

New ivy-switch-buffer command to switch exclusively to an ivy-view? #929

Closed
tirocinium opened this Issue Mar 21, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@tirocinium
Copy link

tirocinium commented Mar 21, 2017

While setting up a hydra to take care of my window management, it occurred to me that it would be convenient to create some hydra shortcuts for not only ivy-push-view and ivy-pop-view, but also for an ivy-switch-buffer command that lists only the window layouts saved to ivy-views. In other words, I want to be able to switch to a saved view without having to first call ivy-switch-buffer and then type { or scroll down to the bottom of the list. From looking at, for instance, #644 (comment), I see that you can get creative with how you can exclude certain types of buffers from the ivy-switch-buffer listing; is there a way to list only buffers that start with {}? I'm sure there is a way to do this, but it's well beyond my coding abilities.

I know this doesn't have anything to do with hydra necessarily, but what I want is something like this:

(defhydra hydra-layout (:color amaranth :hint nil)
    "layout control panel"
    ("v" ivy-push-view "save layout" )
    ("V" ivy-pop-view "delete a layout")
    ("l" ivy-switch-view "select a layout")
    ("q" nil))

—where ivy-switch-view or something to that effect would list my saved ivy-views in the minibuffer.

P.S. I don't know how to code, but using and playing around with your packages has been delightful and very helpful in how I use Emacs. Thank you for your work and ideas.

@abo-abo

This comment has been minimized.

Copy link
Owner

abo-abo commented Mar 21, 2017

Try this code:

(defun ivy-switch-view ()
  (interactive)
  (let ((ivy-initial-inputs-alist
         '((ivy-switch-buffer . "{}"))))
    (ivy-switch-buffer)))
@tirocinium

This comment has been minimized.

Copy link
Author

tirocinium commented Mar 21, 2017

Works perfectly! Thank you!

@tirocinium tirocinium closed this Mar 21, 2017

abo-abo added a commit that referenced this issue Jul 18, 2017

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