Is there any way to configure Windows to open text files in Cygwin's VIM instance? I am currently using GVIM but I find it limiting for many reasons. Unfortunately, I can't just install Debian on this machine and be done with it!
@echo off chdir C:\cygwin\bin start "" mintty.exe /usr/bin/vim.exe %1
Place it on your PATH and then
cvim yourfile.txt or as Heptite has said: right-click on a .txt file and select "open with" you should be able to click "Browse" and go to that
cvim.bat. Then you can click "Always use the selected program to open this kind of file".
If you want to open VIM with the mintty terminal, you could use the following set-up:
First create a bash-script with the following:
#!/bin/sh FILEPATH=$(cygpath -u "$1"); vim "$FILEPATH"
This will convert the windows filepath into a unix-style filepath for cygwin. Place this script (for example) in /bin/native-vim
In regedit (
regedit.exe) you should go to
HKEY_CLASSES_ROOT/*/shell. Create a new key (rightclick on shell) with as name
Edit with VIM. Change the standard value to
Edit with &VIM. Create a new key in
Edit with VIM with the name
command. Change the standard value to
C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico /bin/native-vim "%1" (or the path to your mintty.exe and bash-script).
The changes in your register could also be accomplished with these register-keys:
[HKEY_CLASSES_ROOT\*\shell\Edit with Vim] @="Edit with &Vim" [HKEY_CLASSES_ROOT\*\shell\Edit with Vim\command] @="C:\\cygwin64\\bin\\mintty.exe -i /Cygwin-Terminal.ico /bin/native-vim \"%1\""
As long as path to the vim binary is the PATH environment variable, you should be able to run it from any command line like so:
If you already have a running instance of vim, try:
vim --remote filename
Since you're using Cygwin, the man page was probably installed along with it. You can view all the options for invoking vim on the command line with: