reddit / emacs

[HELP] Open file in vertical/horizontal split

dhruvin3 · 2022-04-06 16:45
Hi all, I am using neovim with telescope fuzzy finder. And in my free time I am forcing my self to learn Emacs (purcell's emacs.d) for personal project development. And want to cultivate habit of it (my personal choice). I want to ask few question regarding how to achieve something that I am habituated to do with neovim + telescope? I am not trying to mimic but it is kind of ease of life improvement for me. 1. `projectile-find-file` give me that bottom split window (hope window is correct term) to search file but I am missing fuzzy search, it is regex search by default. Can I make it fuzzy? 2. `C-x f` gives me bottom split for find-file (like directory lookup) but again it is regex, is it possible to make it fuzzy. (if doesn't work that is fine, this is kind of *curiosity question*) 3. In above both cases, `projectile-find-file` and `C-x f` how can I open file in vertical split of horizontal split directly. For example, in neovim + telescope I fuzzy find the file and pressing `C+v` or `C+x` would give me vertical and horizontal split respectively. Is it possible to achieve something like that behavior natively? I am open to use external packages as well. ​ In .emacs.d config from purcell, there are some config regarding switch-to-buffer-other-window things but I not sure about it. (global-set-key [remap switch-to-buffer] 'consult-buffer) (global-set-key [remap switch-to-buffer-other-window] 'consult-buffer-other-window) (global-set-key [remap switch-to-buffer-other-frame] 'consult-buffer-other-frame) (global-set-key [remap goto-line] 'consult-goto-line) Any help would be great. Thank you all for reading it.
d_metal_ · 2022-04-06 18:57
For 1 and 2 look at how the completion system works. https://www.gnu.org/software/emacs/manual/html_node/emacs/Completion-Styles.html It looks like you’re interested in using the ‘flex’ style
d_metal_ · 2022-04-06 19:01
I personally use orderless https://github.com/oantolin/orderless there is a great documentation on that project readme about how the completion styles work.
dhruvin3 · 2022-04-06 20:16
Exactly, the flx style. Now need to look up how to have flx and ranking of the open file can be used together. Thank you for your help Edit: flex style
dhruvin3 · 2022-04-06 20:18
This is great! This works for me.
oantolin · 2022-04-08 03:48
There is a built-in completion style called `flex`, with an `e`. Is that what you meant by `flx`?
dhruvin3 · 2022-04-08 10:27
Ohh yes. Typo error. I meant flex. But I ended up using your package. I realized that orderless is part of steve purcell’s config and that what i use. All i had to read orderless document. But yes I am still trying to figure out, that how to open file directly is split window?