Ivy Find File and Open in a New Window

Published on Oct 5, 2021, by Junji Zhi

Sometimes we find a file but don’t want to interrupt the work in progress in the current window. It is best to open it in a new window (or frame, in Emacs term).

If you are using Ivy / Counsel / Swiper, try the below workflow:

  1. M-x counsel-find-file, or type C-x C-f
  2. Fill out the file name with the help of auto-completion (Tip: Use M-i to complete the name without jumping to it)
  3. Press the Hydra key C-o to open the Hydra menu
  4. Press f to open in another frame. Voila!

Bonus: There are other actions available in the Hydra menu, like copying the file path, mkdir, deleting file, etc.

Basically if we want to do any file related action, simply type C-x C-f and wire up the action as we need.

It’s neat!

Demo:

find-file-open-in-new-window