Skip to content

Commit

Permalink
Add goto pad shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
nosami committed May 13, 2018
1 parent 3978340 commit 8e95cfc
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion XSVim/Addin.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type XSVim() as this =
let mutable disposables : IDisposable list = []
let mutable processingKey = false
let mutable config = { insertModeEscapeKey = None }
let searchPads = HashSet<string>()
static let searchPads = HashSet<string>()
let initConfig() =
let mapping = SettingsPanel.InsertModeEscapeMapping()
if mapping.Length = 2 then
Expand Down
2 changes: 1 addition & 1 deletion XSVim/Properties/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open System.Runtime.CompilerServices
[<AutoOpen>]
module AddinVersion =
[<Literal>]
let version = "0.56.0"
let version = "0.57.0"

[<assembly: AssemblyTitle("XSVim")>]
// The assembly version has the format {Major}.{Minor}.{Build}.{Revision}
Expand Down
2 changes: 2 additions & 0 deletions XSVim/Types.fs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ type CommandType =
| NextTab
| PreviousTab
| Func of (TextEditor -> unit)
| GotoPad of string
| DelayedFunc of (TextEditor -> unit) * int
| CancelFunc
| ChangeState of VimState
Expand Down Expand Up @@ -245,3 +246,4 @@ module commandHelpers =
let func f = runOnce (Func f) Nothing
let delayedFunc f ms = runOnce (DelayedFunc (f, ms)) Nothing
let dispatchCommand command = IdeApp.CommandService.DispatchCommand command |> ignore
let gotoPad padId = runOnce (GotoPad padId) Nothing
5 changes: 5 additions & 0 deletions XSVim/WindowManagement.fs
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,8 @@ module Window =
dispatch FileCommands.CloseFile
openDocument active.tabs.[active.activeTab-1]
| _ -> dispatch FileCommands.CloseFile

let gotoPad padId =
IdeApp.Workbench.Pads
|> Seq.tryFind(fun p -> p.Id = padId)
|> Option.iter(fun pad -> pad.BringToFront(true))
24 changes: 23 additions & 1 deletion XSVim/XSVim.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,9 @@ module Vim =
| Func f ->
f editor
vimState
| GotoPad padId ->
Window.gotoPad padId
vimState
| ChangeState s -> s
| DelayedFunc (f, ms) ->
let token = new CancellationTokenSource()
Expand Down Expand Up @@ -1385,7 +1388,7 @@ module Vim =
let action =
match state.mode, keyList with
| VisualBlockMode, [ Escape ] -> [ switchMode NormalMode; run Move SelectionStart ]
| NormalMode, [ Escape ] -> resetKeys
| NormalMode, [ Escape ] -> [ yield! resetKeys; yield dispatch "MonoDevelop.Ide.Commands.ViewCommands.FocusCurrentDocument" ]
| _, [ Escape ] -> [ switchMode NormalMode ]
| InsertMode, [ c ] when c = insertModeEscapeFirstChar ->
delayedFunc (fun editor ->
Expand Down Expand Up @@ -1605,6 +1608,25 @@ module Vim =
| InsertMode, [ "<C-n>" ] -> [ dispatch TextEditorCommands.DynamicAbbrev ]
| NotInsertMode, [ "<C-a>" ] -> [ run IncrementNumber Nothing; switchMode NormalMode ]
| NotInsertMode, [ "<C-x>" ] -> [ run DecrementNumber Nothing; switchMode NormalMode ]
| NotInsertMode, [ "g"; "p" ] -> wait
| NotInsertMode, [ "g"; "p"; "s" ] -> [ gotoPad "ProjectPad" ]
| NotInsertMode, [ "g"; "p"; "c" ] -> [ gotoPad "ClassPad" ]
| NotInsertMode, [ "g"; "p"; "e" ] -> [ gotoPad "MonoDevelop.Ide.Gui.Pads.ErrorListPad" ]
| NotInsertMode, [ "g"; "p"; "t" ] -> [ gotoPad "MonoDevelop.Ide.Gui.Pads.TaskListPad" ]
| NotInsertMode, [ "g"; "p"; "p" ] -> [ gotoPad "MonoDevelop.DesignerSupport.PropertyPad" ]
| NotInsertMode, [ "g"; "p"; "o" ] -> [ gotoPad "MonoDevelop.DesignerSupport.DocumentOutlinePad" ]
| NotInsertMode, [ "g"; "p"; "b" ] -> [ gotoPad "MonoDevelop.Debugger.BreakpointPad" ]
| NotInsertMode, [ "g"; "p"; "l" ] -> [ gotoPad "MonoDevelop.Debugger.LocalsPad" ]
| NotInsertMode, [ "g"; "p"; "w" ] -> [ gotoPad "MonoDevelop.Debugger.WatchPad" ]
| NotInsertMode, [ "g"; "p"; "i" ] -> [ gotoPad "MonoDevelop.Debugger.ImmediatePad" ]
| NotInsertMode, [ "g"; "p"; "f" ] -> [ gotoPad "MonoDevelop.FSharp.FSharpInteractivePad" ]
| NotInsertMode, [ "g"; "p"; "d" ] -> wait
| NotInsertMode, [ "g"; "p"; "d"; "t" ] -> [ gotoPad "MonoDevelop.Debugger.ThreadsPad" ]
| NotInsertMode, [ "g"; "p"; "d"; "s" ] -> [ gotoPad "MonoDevelop.Debugger.StackTracePad" ]
| NotInsertMode, [ "g"; "p"; "d"; "c" ] -> [ gotoPad "MonoDevelop.Debugger.StackTracePad" ]
| NotInsertMode, [ "g"; "p"; "u" ] -> wait
| NotInsertMode, [ "g"; "p"; "u"; "t" ] -> [ gotoPad "MonoDevelop.UnitTesting.TestPad" ]
| NotInsertMode, [ "g"; "p"; "u"; "r" ] -> [ gotoPad "MonoDevelop.UnitTesting.TestResultsPad" ]
| _, [] when numericArgument.IsSome -> wait
| _ -> resetKeys
action, newState
Expand Down

0 comments on commit 8e95cfc

Please sign in to comment.