vimrc: check if running in vscode or not
Nobody has claimed this yet.
- 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:
- add
nmap gh :diffget //2 \| diffupdate<CR>to your vimrc - In VSCode, try to get hover info for a symbol
- 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

[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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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