playMacroBinding :: VimBinding
playMacroBinding = VimBindingE (f . T.unpack . _unEv)
    where f "@" (VimState { vsMode = Normal }) = PartialMatch
          f ['@', c] (VimState { vsMode = Normal
                               , vsRegisterMap = registers
                               , vsCount = mbCount }) = WholeMatch $ do
              resetCountE
              case lookup c registers of
                  Just (Register _ evs) -> do
                      let count = fromMaybe 1 mbCount
                          mkAct = Ev . T.replicate count . R.toText
                      scheduleActionStringForEval . mkAct $ evs
                      return Finish
                  Nothing -> return Drop
          f _ _ = NoMatch

-- TODO: withCount name implies that parameter has type (Int -> EditorM ())
--       Is there a better name for this function?
playMacroBinding :: VimBinding
playMacroBinding = VimBindingE (f . T.unpack . _unEv)
    where f "@" (VimState { vsMode = Normal }) = PartialMatch
          f ['@', c] (VimState { vsMode = Normal
                               , vsRegisterMap = registers
                               , vsCount = mbCount }) = WholeMatch $ do
              resetCountE
              case lookup c registers of
                  Just (Register _ evs) -> do
                      let count = fromMaybe 1 mbCount
                          mkAct = Ev . T.replicate count . R.toText
                      scheduleActionStringForEval . mkAct $ evs
                      return Finish
                  Nothing -> return Drop
          f _ _ = NoMatch

-- TODO: withCount name implies that parameter has type (Int -> EditorM ())
--       Is there a better name for this function?
playMacroBinding = VimBindingE (f . T.unpack . _unEv)
    where f "@" (VimState { vsMode = Normal }) = PartialMatch
          f ['@', c] (VimState { vsMode = Normal
                               , vsRegisterMap = registers
                               , vsCount = mbCount }) = WholeMatch $ do
              resetCountE
              case lookup c registers of
                  Just (Register _ evs) -> do
                      let count = fromMaybe 1 mbCount
                          mkAct = Ev . T.replicate count . R.toText
                      scheduleActionStringForEval . mkAct $ evs
                      return Finish
                  Nothing -> return Drop
          f _ _ = NoMatch

-- TODO: withCount name implies that parameter has type (Int -> EditorM ())
--       Is there a better name for this function?