yi-0.11.0: The Haskell-Scriptable Editor

Portabilityportable
Stabilityexperimental
Maintaineryi-devel@googlegroups.com
Safe HaskellNone

Yi.Completion

Description

Collection of functions for completion and matching.

Synopsis

Documentation

completeInListSource

Arguments

:: Text

Input to match on

-> (Text -> Maybe Text)

matcher function

-> [Text]

items to match against

-> EditorM Text 

Complete a string given a user input string, a matching function and a list of possibilites. Matching function should return the part of the string that matches the user string.

completeInListCustomShowSource

Arguments

:: (Text -> Text)

Show function

-> Text

Input to match on

-> (Text -> Maybe Text)

matcher function

-> [Text]

items to match against

-> EditorM Text 

Same as completeInList, but maps showFunction on possible matches when printing

commonPrefix :: Eq a => [[a]] -> [a]

Return the longest common prefix of a set of lists.

 P(xs) === all (isPrefixOf (commonPrefix xs)) xs
 length s > length (commonPrefix xs) --> not (all (isPrefixOf s) xs)

prefixMatch :: Text -> Text -> Maybe TextSource

Prefix matching function, for use with completeInList

infixMatch :: Text -> Text -> Maybe TextSource

Infix matching function, for use with completeInList

subsequenceMatch :: String -> String -> BoolSource

Example: abc matches a1b2c

containsMatch' :: Bool -> Text -> Text -> Maybe TextSource

TODO: this is a terrible function, isn't this just case-insensitive infix? – Fūzetsu

mkIsPrefixOfSource

Arguments

:: Bool

Is case-sensitive?

-> Text 
-> Text 
-> Bool 

Like usual isPrefixOf but user can specify case sensitivity. See toCaseFold for exotic unicode gotchas.