Open GoogleCodeExporter opened 8 years ago
I've managed to set up Shell the way I wanted, which is ignoring case.
It may help anyone willing to correct/enhance XMonad.Prompt.Shell, I don't do
it
myself because I'm very bad at haskell and don't how to do it right, flexible,
etc.
I copied X.P.Shell getShellCompl and commandCompletionFunction to my config
(attached) and changed them to this:
getShellCompl cmds s | s == "" || last s == ' ' = return []
| otherwise = do
f <- fmap lines $ runProcessWithInput "bash" [] ("bind 'set completion-
ignore-case on'; compgen -A file " ++ encodeOutput s ++ "\n")
...the rest of the function is the same...
commandCompletionFunction cmds str | '/' `elem` str = []
| otherwise = filter ((\x y -> map toLower x
`isPrefixOf` map toLower y) str) cmds
Oh! I don't think anyone will ever try this config as is, but is one does,
change the
layoutHook because it won't run ok. I edited MouseResizableTile here to play
with
SubLayouts.
Original comment by hgabreu
on 28 Apr 2010 at 2:02
Attachments:
Hi,
I just fixed (at least for me) the issue shellPrompt ignores searchPredicate
field of XPConfig record.
After applying my patch, you can now create/combine whatever function you want
and it will by used at filtering of shell commands completion.
Just set searchPredicate field and pass it to shellPrompt.
Of my xmonad.hs config:
import qualified Data.List as L
import Data.Char
...
, ((myModMask, xK_x), shellPrompt defaultXPConfig
{
-- match a substring anywhere within and ignore case
searchPredicate = L.isInfixOf . (map toLower)
...
}
Patch created for xmonad-contrib ver. 0.10
Take care
:-)
Original comment by dunric...@gmail.com
on 1 Feb 2012 at 7:52
Attachments:
Anyone have any thoughts? The only type/API change is to 'getShellCompl', which
is not used in any of the configs in my archive (one config hides it and
redefines it).
Original comment by gwe...@gmail.com
on 5 Feb 2012 at 12:13
Looks good to me.
Original comment by dan...@schoepe.org
on 15 Feb 2012 at 5:03
Hi,
me again. As a search predicate for shellPrompt is still not implemented in an
upstream, here is the updated patch to xmonad-contrib 0.11 sources.
In addition to the previous version it sorts list of the possible commands not
only alphabetically but also favours commands starting with the same sequence
as typed in prompt. Similar behaviour seen at dmenu launcher.
For example my search predicate for XMonad.Prompt.Shell.shellPrompt matches
anywhere inside of possible command names, not only at their begining and
ignoring case at the same time:
searchPredicate = L.isInfixOf . map toLower
Now when trying to launch a firefox browser and type "fire" at xmonad's
shellPrompt I'm getting the following completions in that order:
firefox aafire cacafire
Original comment by dunric...@gmail.com
on 2 Feb 2013 at 4:01
Attachments:
Original issue reported on code.google.com by
hgabreu
on 28 Apr 2010 at 11:37Attachments: