From b363bbf107262e69dfb90f160aa9ca829568aabf Mon Sep 17 00:00:00 2001 From: nosami Date: Sun, 11 Jun 2017 12:06:21 +0100 Subject: [PATCH] Add , to repeat find character backwards. Fixes #93 --- XSVim.Tests/Movement.fs | 4 ++++ XSVim/Properties/AddinInfo.fs | 2 +- XSVim/XSVim.fs | 12 ++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/XSVim.Tests/Movement.fs b/XSVim.Tests/Movement.fs index 49fad2d..9a9b223 100644 --- a/XSVim.Tests/Movement.fs +++ b/XSVim.Tests/Movement.fs @@ -107,6 +107,10 @@ module ``Movement tests`` = let ``f is repeatable with ;``() = assertText " $ a1 a2" "fa;" " a1 a$2" + [] + let ``f is reversed with ,``() = + assertText " $ a1 a2" "fa;," " a$1 a2" + [] let ``t does not move if caret is already just before search char``() = assertText " $a1 a2" "ta" " $a1 a2" diff --git a/XSVim/Properties/AddinInfo.fs b/XSVim/Properties/AddinInfo.fs index 0847998..e075371 100644 --- a/XSVim/Properties/AddinInfo.fs +++ b/XSVim/Properties/AddinInfo.fs @@ -5,7 +5,7 @@ open MonoDevelop [] [] diff --git a/XSVim/XSVim.fs b/XSVim/XSVim.fs index 60f61fc..8f66e96 100755 --- a/XSVim/XSVim.fs +++ b/XSVim/XSVim.fs @@ -976,6 +976,18 @@ module Vim = | NotInsertMode, [ "g"; "T" ] -> [ dispatch WindowCommands.PrevDocument ] | NotInsertMode, [ "." ] -> state.lastAction @ [ switchMode NormalMode ] | NotInsertMode, [ ";" ] -> match state.findCharCommand with Some command -> [ command ] | None -> [] + | NotInsertMode, [ "," ] -> + match state.findCharCommand with + | Some command -> + let findCommand = + match command.textObject with + | ToCharInclusive c -> ToCharInclusiveBackwards c + | ToCharInclusiveBackwards c -> ToCharInclusive c + | ToCharExclusive c -> ToCharExclusiveBackwards c + | ToCharExclusiveBackwards c -> ToCharExclusive c + | _ -> failwith "Invalid find command" + [ { command with textObject=findCommand } ] + | None -> [] | VisualModes, Movement m -> [ run Move m ] | VisualBlockMode, [ "I" ] -> [ run (BlockInsert Before) Nothing ] | VisualBlockMode, [ "A" ] -> [ run (BlockInsert After) Nothing ]