reddit / emacs

How to open file in vertical split window from vertico?

Babygau · 2022-12-31 06:16
Hi, I'm using vertico as a completion framework and it's working great. But I want to change its default behaviour when opening a new file. Rather than opening file with new buffer, I want to open in split window vertically or horizontally with a keybind. Thank you
MitchellMarquez42 · 2022-12-31 07:41
Use C-x 4 f (find-file-other-window). There's also `display-buffer-alist` which controls how and when Emacs splits the window.
xmawja · 2022-12-31 07:45
I'm not sure but my advice is that always read the doc [vertico wiki](https://github.com/minad/vertico/wiki) And if you want lightweights emacs configuration checkout [funmacs](https://github.com/xmawja/funmacs) May find it useful.
Babygau · 2022-12-31 09:22
Thank you, I've read wiki section ready but it doesn't feature my use case. Come from vim, I'm used to use C-v to open vertical buffer from completion buffer. But I couldn't emulate this behaviour with emacs. I bound `C-v` to `vertico-map`, but it says *attempt to split minibuffer window* *Update:* with `embark`, I could bind `C-v` to `split-window-vertically` in `embark-file-map` as a workaround. However, this is 2 steps binding, first I have to activate `embark-act` then `C-v`, this is inconvenient.
oantolin · 2022-12-31 17:42
You said you *have* to use two keystrokes, one for `embark-act` and then one for `split-window-vertically`, but this is Emacs! Nobody can force you to press two keystrokes against your will: (define-key vertico-map (kbd "C-v") (kbd "C-. C-v")) (Replace C-. with whatever you use for `embark-act`.) That's probably the easiest way, but you could also define a command following any of the methods [I described here](https://www.reddit.com/r/emacs/comments/pac8kp/comment/ha3xx9j/?utm_source=share&utm_medium=web2x&context=3).
Babygau · 2022-12-31 21:50
Awesome, you just made my day. Happy new year 🎊