Skip to content

Commit

Permalink
Added handing of d[{, d[(, d]}, d]) and v[{, v[(, v]} and v])
Browse files Browse the repository at this point in the history
  • Loading branch information
nosami committed Jan 21, 2018
1 parent 0660034 commit fcd20c6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
4 changes: 4 additions & 0 deletions XSVim.Tests/DeleteTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,7 @@ $ bar
[<Test>]
let ``dw to brace #167``() =
assertText "abc\n $ {" "dw" "abc\n{$"

[<Test>]
let ``d]) deletes to next unmatched )``() =
assertText "if (a$ == (b)c)" "d])" "if ($"
5 changes: 5 additions & 0 deletions XSVim.Tests/VisualTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,8 @@ module ``Visual tests`` =
let ``Visual inside quotes``() =
let _, state = test "let s = \"some$ string\"" "vi\"y"
getClipboard() |> should equal "some string"

[<Test>]
let ``v]) goes to next unmatched )``() =
let _, state = test "if (a$ == (b)c)" "v])y"
getClipboard() |> should equal "a == (b)c)"
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.47.0"
Version = "0.47.1"
)>]

[<assembly:AddinName ("Vim")>]
Expand Down
21 changes: 12 additions & 9 deletions XSVim/XSVim.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ open System
open System.Collections.Generic
open System.Text.RegularExpressions
open System.Threading
open MonoDevelop.Components.Commands
open MonoDevelop.Core
open MonoDevelop.Core.Text
open MonoDevelop.Ide
Expand Down Expand Up @@ -583,19 +582,19 @@ module VimHelpers =
| _ -> editor.CaretOffset, editor.CaretOffset
| PrevUnmatchedBrace ->
match findUnmatchedBlockStartDelimiter editor editor.CaretOffset "{" "}" with
| Some jumpPos -> jumpPos, jumpPos
| Some jumpPos -> editor.CaretOffset, jumpPos
| None -> noOp
| NextUnmatchedBrace ->
match findUnmatchedBlockEndDelimiter editor editor.CaretOffset "{" "}" with
| Some jumpPos -> jumpPos, jumpPos
| Some jumpPos -> editor.CaretOffset, jumpPos
| None -> noOp
| PrevUnmatchedParen ->
match findUnmatchedBlockStartDelimiter editor editor.CaretOffset "(" ")" with
| Some jumpPos -> jumpPos, jumpPos
| Some jumpPos -> editor.CaretOffset, jumpPos
| None -> noOp
| NextUnmatchedParen ->
match findUnmatchedBlockEndDelimiter editor editor.CaretOffset "(" ")" with
| Some jumpPos -> jumpPos, jumpPos
| Some jumpPos -> editor.CaretOffset, jumpPos
| None -> noOp
| Jump (ToMark mark) ->
if editor.FileName.FullPath.ToString() = mark.FileName then
Expand Down Expand Up @@ -1387,8 +1386,12 @@ module Vim =
| NormalMode, [ "d"; "G" ] -> [ runOnce DeleteWholeLines (Jump LastLine)]
| NormalMode, [ "d"; "g" ] -> wait
| NormalMode, [ "d"; "g"; "g" ] -> [ runOnce DeleteWholeLines (Jump StartOfDocument)]
| NormalMode, [ "[" ] -> wait
| NormalMode, [ "]" ] -> wait
| NotInsertMode, [ "[" ] -> wait
| NotInsertMode, [ "]" ] -> wait
| NotInsertMode, [ "d"; "]" ] -> wait
| NotInsertMode, [ "d"; "[" ] -> wait
| NotInsertMode, [ "c"; "[" ] -> wait
| NotInsertMode, [ "c"; "]" ] -> wait
| ReplaceMode, [ c ] -> [ run (ReplaceChar c) Nothing; run Move (Right IncludeDelimiter) ]
| NotInsertMode, Movement m -> [ run Move m ]
| NotInsertMode, [ FindChar m; c ] -> [ run Move (m c) ]
Expand Down Expand Up @@ -1467,8 +1470,8 @@ module Vim =
| NotInsertMode, [ Action action; "a"; "w" ] -> [ run action AWord ]
| NotInsertMode, [ Action action; "i"; "W" ] -> [ run action InnerWORD ]
| NotInsertMode, [ Action action; "a"; "W" ] -> [ run action AWORD ]
| NotInsertMode, [Action action; "a"; "t"] -> [ run action ATag ]
| NotInsertMode, [Action action; "i"; "t"] -> [ run action InnerTag ]
| NotInsertMode, [ Action action; "a"; "t" ] -> [ run action ATag ]
| NotInsertMode, [ Action action; "i"; "t" ] -> [ run action InnerTag ]
| VisualMode, [ "i"; "w" ] -> [ run Visual InnerWord ]
| VisualMode, [ "a"; "w" ] -> [ run Visual AWord ]
| VisualMode, [ "i"; "W" ] -> [ run Visual InnerWORD ]
Expand Down

0 comments on commit fcd20c6

Please sign in to comment.