From 17380359a2a699061614b371274795c636a9e474 Mon Sep 17 00:00:00 2001 From: Alison Winters Date: Sat, 19 Oct 2019 22:49:42 +0800 Subject: [PATCH] add `gd` and `gD` to go to declaration and type definition --- src/Actions/Navigation.ts | 13 +++++++++++++ src/Modes/Normal.ts | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 src/Actions/Navigation.ts diff --git a/src/Actions/Navigation.ts b/src/Actions/Navigation.ts new file mode 100644 index 00000000..ddfa576b --- /dev/null +++ b/src/Actions/Navigation.ts @@ -0,0 +1,13 @@ +import {commands} from 'vscode'; + +export class ActionNavigation { + + static goToDeclaration(): Thenable { + return commands.executeCommand('editor.action.goToDeclaration'); + } + + static goToTypeDefinition(): Thenable { + return commands.executeCommand('editor.action.goToTypeDefinition'); + } + +} diff --git a/src/Modes/Normal.ts b/src/Modes/Normal.ts index e86a4f7b..37a53b51 100644 --- a/src/Modes/Normal.ts +++ b/src/Modes/Normal.ts @@ -26,6 +26,7 @@ import {ActionFold} from '../Actions/Fold'; import {ActionCommandLine} from '../Actions/CommandLine'; import {MotionCharacter} from '../Motions/Character'; import {MotionLine} from '../Motions/Line'; +import { ActionNavigation } from '../Actions/Navigation'; export class ModeNormal extends Mode { @@ -217,6 +218,9 @@ export class ModeNormal extends Mode { { keys: '< <', actions: [ActionIndent.decrease] }, { keys: '> >', actions: [ActionIndent.increase] }, + { keys: 'g d', actions: [ActionNavigation.goToDeclaration] }, + { keys: 'g D', actions: [ActionNavigation.goToTypeDefinition] }, + { keys: '/', actions: [ActionFind.focusFindWidget] }, { keys: 'v', actions: [ActionMode.toVisual] },