One thing that’s always a bit annoying with minibuffer completion tools (e.g.
selectrum) is that from time to time
you just want to submit the current input, but it happens to match some candidate and it gets
selected instead. That’s what happened to me the other day when I wanted to create a new tag named
0.9.0, but Selectrum was matching the existing tags like:
I hope you get the idea. In the above example I want to create a new tag, but its
name matches several existing tags and the first of them gets selected as the most
suitable candidate by Selectrum, which means that if I press
RET the result will be
Every minibuffer completion framework has some keybinding for this situation, but I started using Selectrum only a few months ago and I keep forgetting its. And that’s why I’m writing this blog post - I hope it will help me remember it once and for all. So, what’s the magical keybinding? There are a couple of options, actually.
To submit what you’ve typed, even if it’s not a candidate, you can use
C-p to select the current input just like a regular candidate, and type
usual. Alternatively, you can type
C-j to submit your exact input without
selecting it first. I prefer
C-j, as it’s a bit more efficient, but both approaches
work just fine. Here’s how this looks if you use
Notice how now the current input is highlighted as the current candidate. At this point you can just press
RET and have it accepted.
By the way, you can do the same thing in
C-M-j. I’m pretty sure I
C-M-j with Selectrum, and as you can imagine it didn’t do
anything there. If I recall correctly in
ido the magic keybinding is
C-f for files and
C-b for buffers. If that’s not the
case - please, correct me in the comments.
That’s all I have for you today. A short post for a small tip. I hope I’ll finally remember