Vim icon indicating copy to clipboard operation
Vim copied to clipboard

Load .vimrc from WSL2 remote filesystem

Open jhawksley opened this issue 4 years ago • 3 comments

Is your feature request related to a problem? Please describe. When loading the .vimrc for keymappings, VSCode VIM complains that the file doesn't exist. I think it's trying to load it from the Windows local filesystem.

Describe the solution you'd like Since my WSL2 Ubuntu instance is already set up and configured for vim, it would be nice for VSCode/Vim to load it from /home/me/.vimrc in that filesystem.

Describe alternatives you've considered The .vimrc in my WSL2 instance is actually mounted out of a Dropbox folder structure in the Windows filesystem. I was able to point VSCode/Vim to the same file by using the Dropbox/my/dotfiles/.vimrc structure instead.

Additional context None.

jhawksley avatar Jul 25 '21 16:07 jhawksley

VSCodeVim is not running on the remote, and it's probably the reason why it's not working. you might get what you desire using: \\wsl$\<Distribution>\path\to\.vimrc

you can use this path in windows explorer also to access wsl filesystem.

elazarcoh avatar Sep 23 '21 17:09 elazarcoh

No .vimrc found at \\wsl$\Ubuntu\home\pieter\.dotfiles\.config\vim\.vimrc.

  "vim.vimrc.path": "\\\\wsl$\\Ubuntu\\home\\pieter\\.dotfiles\\.config\\vim\\.vimrc",

image

piejanssens avatar Aug 29 '23 09:08 piejanssens

I ran into the same issue where the WSL path wasn't recognized, i.e. \\wsl$\Ubuntu\home\gsacavdm\.vimrc.

I worked around this by creating a soft link to it like so:

mklink "C:\Users\gsacavdm\.vimrc" "\\wsl$\Ubuntu\home\gsacavdm\.vimrc"

And then providing the C:\Users\gsacavdm\.vimrc based path to the vim extension.

gsacavdm avatar Mar 29 '25 03:03 gsacavdm