VSCodeVim / VSCodeVim/Vim

`gd` for local definition / first occurrence in function

Open
#3,319 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted kind/enhancement
Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Is your feature request related to a problem? Please describe.
In vim, I used to have g-d going to the local definition or the first occurrence in a function for the word under the cursor. However, in VSCode-Vim I found that g-d is liking to the global definition.
I already have "CTRL+]" going to the global definition, so I'm wondering how I could have "g-d" going to the local definition / the first occurrence in a function.

Describe the solution you'd like
Under NORMAL mode, "g-d" goes to the local definition / first occurrence in a function of the word under the cursor.

Describe alternatives you've considered
Search for the word under the cursor with "*" and use "[[" to go to the "{" bracket of a function and press "n" to do the search again.

I found that in the quickref.txt "g-d" "goto local declaration of identifier under the cursor" and "g-D" "goto global declaration of identifier under the cursor". But the current VSCode-Vim doesn't seem to work as it stated :(

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the NORMAL-mode key handling for g-d and compare its current behavior with the Vim quickref.txt entry for local declarations; the issue also identifies CTRL+] as the existing global-definition path. Done means g-d targets the local definition or first occurrence in the function while global navigation remains available through CTRL+].

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.