diff options
-rw-r--r-- | XMonad/Prompt.hs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/XMonad/Prompt.hs b/XMonad/Prompt.hs index d835b78..7679b95 100644 --- a/XMonad/Prompt.hs +++ b/XMonad/Prompt.hs @@ -20,6 +20,7 @@ module XMonad.Prompt , mkXPromptWithReturn , amberXPConfig , defaultXPConfig + , emacsLikeXPKeymap , greenXPConfig , XPType (..) , XPPosition (..) @@ -441,6 +442,42 @@ defaultXPKeymap = M.fromList $ , (xK_Escape, quit) ] +emacsLikeXPKeymap :: M.Map (KeyMask,KeySym) (XP ()) +emacsLikeXPKeymap = M.fromList $ + map (first $ (,) controlMask) -- control + <key> + [ (xK_z, killBefore) --kill line backwards + , (xK_k, killAfter) -- kill line fowards + , (xK_a, startOfLine) --move to the beginning of the line + , (xK_e, endOfLine) -- move to the end of the line + , (xK_d, deleteString Next) -- delete a character foward + , (xK_b, moveCursor Prev) -- move cursor forward + , (xK_f, moveCursor Next) -- move cursor backward + , (xK_BackSpace, killWord Prev) -- kill the previous word + , (xK_y, pasteString) + , (xK_g, quit) + , (xK_bracketleft, quit) + ] ++ + map (first $ (,) mod1Mask) -- meta key + <key> + [ (xK_BackSpace, killWord Prev) + , (xK_f, moveWord Next) -- move a word forward + , (xK_b, moveWord Prev) -- move a word backward + , (xK_d, killWord Next) -- kill the next word + ] + ++ + map (first $ (,) 0) -- <key> + [ (xK_Return, setSuccess True >> setDone True) + , (xK_KP_Enter, setSuccess True >> setDone True) + , (xK_BackSpace, deleteString Prev) + , (xK_Delete, deleteString Next) + , (xK_Left, moveCursor Prev) + , (xK_Right, moveCursor Next) + , (xK_Home, startOfLine) + , (xK_End, endOfLine) + , (xK_Down, moveHistory W.focusUp') + , (xK_Up, moveHistory W.focusDown') + , (xK_Escape, quit) + ] + keyPressHandle :: KeyMask -> KeyStroke -> XP () keyPressHandle m (ks,str) = do km <- gets (promptKeymap . config) |