VSCodeVim / VSCodeVim/Vim

vimrc: check if running in vscode or not

Open
#5,317 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug
I have a certain mapping in my vimrc (nmap gh :diffget //2 \| diffupdate<CR>) that is wreaking havoc when used inside vscode. How can I not use this mapping when in VSCode?

To Reproduce
Steps to reproduce the behavior:

  1. add nmap gh :diffget //2 \| diffupdate<CR> to your vimrc
  2. In VSCode, try to get hover info for a symbol
  3. Don't profit :(

Expected behavior
A variable to be set inside the Neovim core environment that can be checked, such as
If !has('vscode')

Screenshots
image

[Extension Host] Neovim: debug: version: 0.4.4 (at t.ConsoleForElectron.log (/Users/maxcoplan/.vscode-insiders/extensions/vscodevim.vim-1.17.1/out/extension.js:9:371425))
console.ts:137 [Extension Host] [winston] Attempt to write logs with no transports %j 
{message: "request -> neovim.api.nvim_get_current_buf", level: "debug"}
 (at t._transform (/Users/maxcoplan/.vscode-insiders/extensions/vscodevim.vim-1.17.1/out/extension.js:9:609986))
console.ts:137 [Extension Host] [winston] Attempt to write logs with no transports %j 
{level: "info", message: "handleNotification: "}
 (at t._transform (/Users/maxcoplan/.vscode-insiders/extensions/vscodevim.vim-1.17.1/out/extension.js:9:609986))
console.ts:137 [Extension Host] [winston] Attempt to write logs with no transports %j 
{message: "response -> neovim.api.nvim_get_current_buf: [object Object]", level: "debug"}
 (at t._transform (/Users/maxcoplan/.vscode-insiders/extensions/vscodevim.vim-1.17.1/out/extension.js:9:609986))
console.ts:137 [Extension Host] [winston] Attempt to write logs with no transports %j 
{message: "request -> neovim.api.nvim_set_option", level: "debug"}
 (at t._transform (/Users/maxcoplan/.vscode-insiders/extensions/vscodevim.vim-1.17.1/out/extension.js:9:609986))
console.ts:137 [Extension Host] [winston] Attempt to write logs with no transports %j 
{message: "response -> neovim.api.nvim_set_option: null", level: "debug"}
 (at t._transform (/Users/maxcoplan/.vscode-insiders/extensions/vscodevim.vim-1.17.1/out/extension.js:9:609986))
console.ts:137 [Extension Host] [winston] Attempt to write logs with no transports %j 
{message: "request -> neovim.api.nvim_buf_set_lines", level: "debug"}
 (at t._transform (/Users/maxcoplan/.vscode-insiders/extensions/vscodevim.vim-1.17.1/out/extension.js:9:609986))
console.ts:137 [Extension Host] [winston] Attempt to write logs with no transports %j 
{message: "response -> neovim.api.nvim_buf_set_lines: null", level: "debug"}
 (at t._transform (/Users/maxcoplan/.vscode-insiders/extensions/vscodevim.vim-1.17.1/out/extension.js:9:609986))
console.ts:137 [Extension Host] [winston] Attempt to write logs with no transports %j 
{message: "request -> neovim.api.nvim_call_function", level: "debug"}
 (at t._transform (/Users/maxcoplan/.vscode-insiders/extensions/vscodevim.vim-1.17.1/out/extension.js:9:609986))
console.ts:137 [Extension Host] [winston] Attempt to write logs with no transports %j 
{level: "info", message: "handleNotification: "}
 (at t._transform (/Users/maxcoplan/.vscode-insiders/extensions/vscodevim.vim-1.17.1/out/extension.js:9:609986))
console.ts:137 [Extension Host] [winston] Attempt to write logs with no transports %j 
{message: "response -> neovim.api.nvim_call_function: 0", level: "debug"}
 (at t._transform (/Users/maxcoplan/.vscode-insiders/extensions/vscodevim.vim-1.17.1/out/extension.js:9:609986))
console.ts:137 [Extension Host] [winston] Attempt to write logs with no transports %j 
{message: "request -> neovim.api.nvim_call_function", level: "debug"}
 (at t._transform (/Users/maxcoplan/.vscode-insiders/extensions/vscodevim.vim-1.17.1/out/extension.js:9:609986))
console.ts:137 [Extension Host] [winston] Attempt to write logs with no transports %j 
{level: "info", message: "handleNotification: "}
 (at t._transform (/Users/maxcoplan/.vscode-insiders/extensions/vscodevim.vim-1.17.1/out/extension.js:9:609986))

Environment (please complete the following information):

  • Extension (VsCodeVim) version: latest
  • VSCode version: latest
  • OS: macOS

Additional context
Add any other context about the problem here.

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

The issue names vimrc and the VSCodeVim integration but no repository files or tests. Start by tracing how VSCodeVim initializes and communicates with Neovim, then determine whether a reliable VSCode marker can be exposed to vimrc. Done means users can conditionally disable mappings in VSCode without disrupting normal Neovim behavior, with coverage for the integration path.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vim, vscode
Domain
developer-experience, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.