aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Lopez-Camey <c.lopez@kmels.net>2012-04-21 03:23:35 +0200
committerCarlos Lopez-Camey <c.lopez@kmels.net>2012-04-21 03:23:35 +0200
commitebbab5970303e2bc0c335c72fc04ad57ed8ffc16 (patch)
treebddcf4d8f6ec1a97e9df040a8e6b2da22e2845a2
parent3a76a42151c6bd701e3d255aa0f5d38f4c2b034f (diff)
downloadXMonadContrib-ebbab5970303e2bc0c335c72fc04ad57ed8ffc16.tar.gz
XMonadContrib-ebbab5970303e2bc0c335c72fc04ad57ed8ffc16.tar.xz
XMonadContrib-ebbab5970303e2bc0c335c72fc04ad57ed8ffc16.zip
Adds an emacs-like Keymap in XMonad.Prompt
Ignore-this: f281b8ad01f3d21055e2d6de79af2d79 darcs-hash:20120421012335-95218-fe138a3d499fd0d956f3c61037cc4a07211a9daf.gz
-rw-r--r--XMonad/Prompt.hs37
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)