diff options
author | tv <tv@shackspace.de> | 2014-08-01 14:48:37 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2014-08-01 14:48:37 +0200 |
commit | 1e1ab1b1808fa152845ab46403b35dc34ac28e96 (patch) | |
tree | f29b145605713304cccf04cd47ea82413dd1aa25 | |
parent | d5e36ef9466d29af784adf1bafcbb4d02df15aad (diff) |
use MotionCommandWarn in {i,n}map
-rw-r--r-- | src/Main.hs | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/Main.hs b/src/Main.hs index ef56107..ed52ba1 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -225,6 +225,11 @@ execCommand (MotionCommand x) = do when (null $ snd $ buffer q) $ modifyBuffer (gotoLeft 1) +-- TODO Make this "real" warnings, i.e. don't throwError but tell. This +-- is required in order to perform any Combine-d commands regardless of +-- failed moves. Currently this is only used to SetCount Nothing (which +-- is defunct atm) Alternatively we could simply reset the state when an +-- error happens Discus! execCommand (MotionCommandWarn x) = do b0 <- gets buffer execCommand (MotionCommand x) @@ -469,16 +474,16 @@ nmap = , ("a", ChangeMode InsertMode <> SetCount Nothing <> MotionCommand GotoRight) , ("I", ChangeMode InsertMode <> MotionCommand GotoFirstChar) , ("A", ChangeMode InsertMode <> MotionCommand GotoEndOfLine) - , ("|", MotionCommand GotoColumn <> SetCount Nothing) - , ("$", MotionCommand GotoEndOfLine <> SetCount Nothing) - , ("h", MotionCommand GotoLeft <> SetCount Nothing) - , ("l", MotionCommand GotoRight <> SetCount Nothing) - , ("b", MotionCommand WordsBackward <> SetCount Nothing) - , ("w", MotionCommand WordsForward <> SetCount Nothing) + , ("|", MotionCommandWarn GotoColumn <> SetCount Nothing) + , ("$", MotionCommandWarn GotoEndOfLine <> SetCount Nothing) + , ("h", MotionCommandWarn GotoLeft <> SetCount Nothing) + , ("l", MotionCommandWarn GotoRight <> SetCount Nothing) + , ("b", MotionCommandWarn WordsBackward <> SetCount Nothing) + , ("w", MotionCommandWarn WordsForward <> SetCount Nothing) , ("d", ChangeMode DeleteMode) , ("\"", ChangeMode SelectRegisterMode <> SetCount Nothing) - , ("\x1b[C", MotionCommand GotoRight <> SetCount Nothing) - , ("\x1b[D", MotionCommand GotoLeft <> SetCount Nothing) + , ("\x1b[C", MotionCommandWarn GotoRight <> SetCount Nothing) + , ("\x1b[D", MotionCommandWarn GotoLeft <> SetCount Nothing) , ("\x0a", ExecuteInputBuffer <> ChangeMode InsertMode <> SetCount Nothing) ] ++ (map (\i -> (show i, AppendCount i)) [0..9]) @@ -504,18 +509,18 @@ nmap = imap :: Keymap imap = [ ("\x1b", ChangeMode NormalMode <> MotionCommand GotoLeft) - , ("\x01", MotionCommand GotoFirstChar) - , ("\x05", MotionCommand GotoEndOfLine) + , ("\x01", MotionCommandWarn GotoFirstChar) + , ("\x05", MotionCommandWarn GotoEndOfLine) , ("\x1b[3~", KillNextChar) - , ("\x1b[C", MotionCommand GotoRight) - , ("\x1b[D", MotionCommand GotoLeft) + , ("\x1b[C", MotionCommandWarn GotoRight) + , ("\x1b[D", MotionCommandWarn GotoLeft) , ("\x16", ChangeMode VerbatimMode) -- ^V , ("\x17", KillLastWord) -- ^W , ("\x0a", ExecuteInputBuffer) , ("\x7f", KillLastChar) -- Delete , ("\x08", KillLastChar) -- BackSpace - , ("\x1bOc", MotionCommand WordsForward) - , ("\x1bOd", MotionCommand WordsBackward) + , ("\x1bOc", MotionCommandWarn WordsForward) + , ("\x1bOd", MotionCommandWarn WordsBackward) ] |