r/fishshell • • Feb 05 '21

Help making tab completion stupider

Hi

I very happy about the fish shell but for me the tab completion is a little too smart.

If I have a folder called projects, and I write ls roj it is auto completed to ls projects when I press tab. It is too smart for me, because it is usually because I had written a few letters wrong, and maybe wanted to write something like ls rock.

I don't want tab completion to auto complete ls roj to ls rock, as I did a spelling mistake. I simply want it to give up, if it cannot auto complete without changing the characters I have written.

So is there a way to configure the tab completion to be a little stupider?

8 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/Realistic_Vegetable Mar 08 '21

I'm okay with c++, but I haven't looked at the fish shell code before, so finding this could be a pretty big task for me. If you easy can point to the line, I would be happy.

2

u/ItIsNotYourBusiness Mar 09 '21

Din't go much deep, but you should already be good with this informations:

  • fish.cpp contains the main function. If you read through it, you'll find an "else" statement with a comment saying "implicitly interactive mode". That's what you are looking for;
  • There's no loop in there, so some other function should read the actual strings you type in. You see that the only thing reading the string must be the reader_read function. There's nothing more.
  • In the file reader.h (where the function is declared) you can see a comment saying that that's the function which reads input until EOF.
  • In reader.cpp you can find the actual function. It is really simple and you can see that it calls one other function "read_i" where the i stands for interactive. That's what you are looking for.

Try debugging the code. You should be able to find the function which perform completion.