1

I have neovim installed in the WSL. To access it, I open ConEmu, which is set up to use the WSL Bash by default as soon as it opens

On Windows there are often times where I want to make some quick edits to a file, and to do that I usually right click it and Open with... (whatever Windows installed program I need).

Is there a way to add neovim to the Open with menu so that when I need to edit a file it will open ConEmu, which will start Bash, start neovim and open the file for editing there?

It doesnt have to be tied to the Open with menu, anything that is a click away, or in some other contextual menu will be fine. The thing I want to avoid is having to manually open ConEmu/Bash/neovim and cd to the file as it defeats the purpose (speed)

I've seen similar questions (e.g. Adding Bash on Ubuntu on Windows 10 to Explorer Context Menu (Issues)) but this is about more than just adding Bash on Windows to a context menu, I'd like to be able to open a file with neovim as well

Simon
  • 367

3 Answers3

0

Add this alias to your bash/zsh profile

alias explorer='/mnt/c/Windows/explorer.exe'

Then you can open folders or files like so: explorer ./src/main or explorer logfile.txt

phuclv
  • 30,396
  • 15
  • 136
  • 260
whodini9
  • 101
0

Here I add something about How do I open Bash in Windows 10?

  • Navigate to Settings.
  • Click Update & security.
  • Select For Developers in the left column.
  • Select Developer Mode under "Use developer features" if it's not already enabled.
  • Navigate to the Control Panel (the old Windows control panel).
  • Select Programs and Features.
  • Click "Turn Windows features on or off.
phuclv
  • 30,396
  • 15
  • 136
  • 260
neelam
  • 1
-1

Probably, this can be achieved similarly as I did it for opening a file with Git Bash For Windows VIM:

[HKEY_CLASSES_ROOT\*\shell\Vim]
@="Edit &file with Vim"
"Icon"="C:\\Program Files\\Git\\git-bash.exe"

[HKEY_CLASSES_ROOT\*\shell\Vim\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" -c \"vim \\\"$(echo '%1' | sed 's/\\\\\\\\/\\\\//g' | sed 's/C:/\\\\/c/g' | sed 's/D:/\\\\/d/g')\\\"\""
; Update path to Git Bash for Windows above.
; INFO: Like above, the script can only transform paths with C: or D:. Just add another "| sed 's/E:/\\\\/e/g'" (without ") if you need more.

GitHub Gist here: https://gist.github.com/dwettstein/e5349a12852a7aadfda419e76124919c

EDIT: It is possible, but you have to fix all the path handling from above.

EDIT2: I managed to do it! However, I'm using Vim and not Neovim. See here: https://gist.github.com/dwettstein/6a01af11f830b96d686e12500e7c7d0b