Discussion:
[xmonad] XMonad.Promp.Shell matching function
Adam Sjøgren
2016-06-12 21:37:42 UTC
Permalink
I would like shellPrompt to match anywhere in the command, not only from
the beginning.

E.g. if I have a command called "run_icesocial", I would like that to
appear if I type "icesoc", rather than having to type "run_" first.

It looks like XMonad.Prompt.Shell.commandCompletionFunction is the
function to modify:

commandCompletionFunction :: [String] -> String -> [String]
commandCompletionFunction cmds str | '/' `elem` str = []
| otherwise = filter (isPrefixOf str) cmds

Changing isPrefixOf to isInfixOf I would guess - does that sound right?

Is there an easy way to "override" that function from my xmonad.hs?

If not, would it be reasonable to make it configurable, so e.g. you
could put in a fuzzy matching function, or something even weirder? (I'll
give that a go, if so.)


Best regards,

Adam
--
"Sunday morning when the rain begins to fall Adam Sjøgren
I've got the cure for it all" ***@koldfront.dk
Adam Sjøgren
2016-06-12 21:51:54 UTC
Permalink
This already exists (thanks, Google, for not finding the latest code),
just put:

, searchPredicate = isInfixOf

in the XPconfig.


Great!

Adam
--
"Det er jo bare punk, forklædt som Bubbers badekar!" Adam Sjøgren
***@koldfront.dk
Loading...