2
1
I've recently have gotten sick of constantly switching between Windows and Linux and installed gVim and MSYS2 on Windows 7. After a couple hours of searching I have a .vimrc that makes !command
, make
, etc. that use the shell and utilities that come with MSYS2 instead of cmd.exe (located below). However, whenever I run a shell commands the shell starts in my home directory instead of vim's current working directory. I know this is the fault of the the shell flag --login
, but if I remove it the shell complains that it cant find any commands: /usr/bin/bash: ls: command not found
. I presume this is because PATH isn't set.
Is it possible to keep bash from starting in home? Or, more possibly, how do I modify gVim's PATH to inherit from MSYS's PATH?
if has('win32') || has('win64')
set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
set shell=C:\msys64\usr\bin\bash
set shellcmdflags=--login\ -c
set shellslash
endif
It's a bit of a hack, but I could start up gVim by using:
C:\mingw64\bin\bash -lc "/c/Program Files (x86)/Vim/vim74/gvim.exe"
. Hoping there is a cleaner way using only the .vimrc, so I'll keep this question open. – Break – 2015-11-09T21:23:11.393So this hackneyed solution doesn't work either. http://superuser.com/questions/998377/detaching-a-process-from-a-shell-doesnt-work-as-an-argument-in-windows.
– Break – 2015-11-10T00:24:49.513