visual-studio-codekeyboard-shortcutsvscodevim

How to open hover links without using a mouse in VS Code with the Vim extension installed?


While programming in JavaScript / TypeScript in VS Code, I often need to follow documentation links of functions, which appear on mouse hover. I want to be able to do this without using a mouse.

sample image

Here's a screenshot showing the hover link / documentation link I'm referring to (the text saying "MDN Reference").

I have the Vim extension installed, so I'm able to use the keyboard shortcut gh in normal mode to simulate the mouse hover action when the cursor is on the function, which opens a popup containing the documentation link. But after this step, I couldn't open the link without a mouse.

In VS Code, I searched File -> Preferences -> Keyboard Shortcuts for VS Code commands related to following links in hover popups using keywords "hover", "tooltip", "popup", "peek", but found nothing relevant.

I also checked VSCodeVim repository README and didn't find any helpful information.

My goal is to open the documentation link of a function displayed in VS Code's popup window, (triggered by cursor hover) in a browser, with or without the addition of other VS Code extensions.


Solution

  • I can open a hyperlink from the hover with few keystrokes (g, h, tab, tab, Enter which can be mapped with vscodevim) thanks to this answer.

    Note I have this keybind on "settings.json" : "vim.normalModeKeyBindingsNonRecursive": [ { "before": ["g", "h"], "commands": ["editor.action.showDefinitionPreviewHover"] } ]