Skip to main content

Install

  1. Install the Glimpse VSCode extension. If you don't use the VSCode marketplace, you can install the extension from Open VSX.
  2. Verify that the extension is correctly installed by pressing Ctrl+Shift+P to open the command palette and searching for Glimpse: Menu.

Congrats, you ran Glimpse for the first time! 🎉

However, running Glimpse from the command palette isn't ergonomic — let's configure a shortcut to trigger Glimpse: Menu.

Glimpse keyboard shortcut

In the following, we edit the VSCode configuration to run Glimpse with:

  • alt+space key for non-Vim users
  • space key for Vim users

Feel free to change the key binding to your liking.

Non-Vim users

You can set the shortcut in two ways: by editing the JSON configuration file or by using the VSCode UI.

Configuration File

To set the shortcut via the JSON configuration file:

  • Press Ctrl+Shift+P to open the command palette and search for Preferences: Open Keyboard Shortcuts (JSON).

  • Add the following:

    [
    {
    "key": "alt+space",
    "command": "glimpse.menu"
    }
    ]

VSCode UI

To set the shortcut the VSCode UI:

  • Press Ctrl+Shift+P to open the command palette and search for Preferences: Open Keyboard Shortcuts.
  • Search for glimpse.menu.
  • Double click on the row to edit the shortcut.

VSCodeVim users

Press Ctrl+Shift+P to open the command palette and search for Preferences: Open Keyboard Shortcuts (JSON). Add the following:

{
"key": "space",
"command": "glimpse.menu",
"when": "((activeEditorGroupEmpty && focusedView == '') || inWelcome || sideBarFocus) && !inputFocus && !glimpseVisible"
}

Press Ctrl+Shift+P to open the command palette and search for Preferences: Open User Settings (JSON). Add the following:

{
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [
"<space>"
],
"commands": [
"glimpse.menu"
]
},
],
"vim.visualModeKeyBindingsNonRecursive": [
{
"before": [
"<space>"
],
"commands": [
"glimpse.menu"
]
},
]
}

VSCode Neovim users

Press Ctrl+Shift+P to open the command palette and search for Preferences: Open Keyboard Shortcuts (JSON). Add the following:

{
"command": "glimpse.menu",
"when": "editorTextFocus && neovim.mode != insert",
"key": "space"
}

As an alternative, you can either:

  • Add the following to your init.vim:

    if exists('g:vscode')
    " VSCode extension config
    nnoremap <Space> <Cmd>call VSCodeNotify('glimpse.menu')<CR>
    vnoremap <Space> <Cmd>call VSCodeNotify('glimpse.menu')<CR>
    else
    " ordinary Neovim config
    endif
  • Add the following to your init.lua:

    if vim.g.vscode then
    -- VSCode extension config
    vim.keymap.set("n", "<Space>", [[<Cmd>call VSCodeNotify('glimpse.menu')<CR>]])
    vim.keymap.set("v", "<Space>", [[<Cmd>call VSCodeNotify('glimpse.menu')<CR>]])
    else
    -- ordinary Neovim config
    end