Skip to content

Commit

Permalink
Add , to repeat find character backwards. Fixes #93
Browse files Browse the repository at this point in the history
  • Loading branch information
nosami committed Jun 11, 2017
1 parent 2c245ca commit b363bbf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions XSVim.Tests/Movement.fs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ module ``Movement tests`` =
let ``f is repeatable with ;``() =
assertText " $ a1 a2" "fa;" " a1 a$2"

[<Test>]
let ``f is reversed with ,``() =
assertText " $ a1 a2" "fa;," " a$1 a2"

[<Test>]
let ``t does not move if caret is already just before search char``() =
assertText " $a1 a2" "ta" " $a1 a2"
Expand Down
2 changes: 1 addition & 1 deletion XSVim/Properties/AddinInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open MonoDevelop
[<assembly:Addin (
"XSVim",
Namespace = "XSVim",
Version = "0.28.3"
Version = "0.29.0"
)>]

[<assembly:AddinName ("Vim")>]
Expand Down
12 changes: 12 additions & 0 deletions XSVim/XSVim.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down

0 comments on commit b363bbf

Please sign in to comment.