Quantcast

XMonad.Promp.Shell matching function

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

XMonad.Promp.Shell matching function

Adam Sjøgren
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"                          [hidden email]

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: XMonad.Promp.Shell matching function

Adam Sjøgren
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
                                                         [hidden email]

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Loading...