External commands not available in gvim on windows - windows

When starting a gvim session on windows 7, it appears that globally available commands like autopep8 or pylint cannot be executed. I.e. the command :!pylint opens up a console windows saying 'pylint' is not recognized as an internal or external command.
However, I can execute these commands from cmd.exe by just typing the respective names.
This is because I have added the path C:\Program Files (x86)\Python 3.5\Scripts; to the System Path environment variable. For some reason this is not picked up by the shell behind gvim.
The weird thing is that typing :echo $PATH shows a list or folders which includes C:\Program Files (x86)\Python 3.5\Scripts;.
I should also note that this problem does not occur when starting normal vim in a terminal like cmd.exe or git bash.
Any hints on what might be going wrong?

Related

What is the difference between the PATH listed by 'env' in git-bash and the PATH in Windows 10's control panel?

My goal is to write a shell script that will ensure that a bunch of Windows 10 computers with Python freshly installed on them can run the 'python' command from a git-bash command line in Windows Terminal by having the script check the PATH environment variable and modify it if necessary.
More specifically, I want my script to check if the following three paths are part of each computer's PATH, and if they aren't already a part of it, edit the PATH so that it permanently contains them.
C:\Program Files\Python311
C:\Program Files\Python311\Scripts
C:\Users\ <localUser>\AppData\Roaming\Python\Python311\Scripts
What threw me off is that I noticed that the PATH variable that I get from the 'env' command on the git-bash command line is different from the PATH variable that I can see in Windows 10's control panel. I tried adding a junk path to PATH from the command line by typing
export PATH=/c/someNonexistentPath in git bash but it didn't change the PATH that I could see in the Windows 10 control panel. Moreover, I couldn't even see if it changed the PATH I get from running env on the command line because for some reason after you run any export command git-bash gets amnesia and refuses to recognize the env command until you start a new session of git-bash.
Shouldn't there only be one PATH on a computer? If the two seemingly different PATHs that I have mentioned are not supposed to be the same, what is the difference between them, and how can I accomplish my goal of writing the script so that it does what I need it to do?
Please let me know if I need to include any more system-specific info. Thanks in advance for your help.

Running shell script on Windows via Cygwin mintty.exe doesn't execute runcoms

Problem summary
I'm trying to launch a .sh script via Windows 10 Cygwin (i.e. mintty.exe > bash.exe) but neither .profile, .bash_profile, or .bashrc are loading, which I need to update PATH env variable with Cygwin's bin directory.
Background
I'm trying to launch a script finder.sh:
#!/bin/bash
find .
read
from C:\Users\Bo\Temp\. It has unix line endings and executable bit set.
I have Cygwin installed at C:\Users\Bo\AppData\Local\Programs\cygwin64\. I do not have this path in either System or User Windows' Environment Variables (and I don't want to!). My runcoms all live in this directory under /home/Bo. My .bash_profile (and ATM .bashrc) have an export PATH="/cygdrive/c/Users/Bo/AppData/Local/Programs/cygwin64/bin":${PATH} in them.
I want to launch the script from Windows Explorer. I tried using the bash.exe and mintty.exe in the cygwin64\bin\ folder via Open > Choose another app > More apps > Look for another app on this PC. In either case the mintty window displays:
FIND: Parameter format not correct
meaning the Windows' find command was used not Cygwin's. So I have my script echo $PATH and the Cygwin/bin directory is not in PATH. If I add the proper export PATH statement from above to my own script it works fine. So, now to debug the launcher and runcoms...
I've put echo ${0} statements in .profile, .bash_profile, and .bashrc, none of which trigger which I run the .sh script, they are never run. I've read SO and the mans. I've tried creating a Shortcut to both mintty.exe and bash.exe passing a variety of -l -i -e - commands to each using Properties > Shortcut > Target and they are never run. E.g. running simply [..]\mintty.exe -h always doesn't even leave the window open.
How do I get my script to run in Windows Explorer via Cygwin's mintty.exe/bash.exe, and to read from a runcom to update PATH (to find Cygwin Linux commands, vs. updating Windows Environment Variable)?
Two part fix:
A) set a Windows Environment Variable for BASH_ENV to a .bash_env under your Cygwin HOME, and export the PATH variable to include the Cygwin/bin directory from that file. I cannot find a decent reference for this in Cygwin documentation because it seems to be simply a bash thing, but this variable is what bash looks for when running non login/interactively. Best reference: Cygwin shell doesn't execute .bashrc.
And B) run the .sh with bash.exe from Cygwin/bin using Open With....
ALSO, annoying Windows bug: when you select a program to Open With... your .sh script, it will always run 1x with a CWD from your C:\Windows\System32 directory(?!) and all other times will run fine with the CWD as the directory from your .sh script.

How to setup Intellij idea terminal path with cmder but initiated with git bash.exe?

So I have installed both Cmder and Git bash, and my Cmder is setup in a way that to run git bash.exe inside.
Currently my Intellij idea's path for terminal is set to:
C:\Program Files\Git\bin\bash.exe, which works fine for bash.exe
However, one disadvantage for directly using bash.exe is that it will not automatically convert a windows directory, for example:
D:\Documents\Adobe, when I copy this after cd, it will be:
cd D:\Documents\Adobe instead of:
cd /d/Documents/Adobe which I will get in cmder.
I have looked up online, people shared about how to incorporate cmder in idea's terminal by using the path:
"cmd.exe" /k ""%CMDER_ROOT%\vendor\init.bat""
However, that is only using cmder as a coating for cmd.exe, not bash.exe as I want.
I have tried to replace with:
"C:\Program Files\Git\bin\bash.exe" /k ""%CMDER_ROOT%\vendor\init.bat"", it was not working.
also tried:
"C:\Program Files\Git\bin\sh.exe" --login -i /k ""%CMDER_ROOT%\vendor\init.bat""
and:
"C:\Program Files\Git\bin\sh.exe" /k ""%CMDER_ROOT%\vendor\init.bat""
All failed.
Any sugestons? Thanks!
Or if someone can show me how to change git bash.exe so that it can automatically translate the windows directory to Linux type, that would also work.
I don't think you can run git-bash in cmder AND from Intellij IDEA terminal.
I tried this: creating a task for git-bash in Cmder and try to use cmder.exe /TASK xxx in Intellij. I have the task, but it seems that Intellij does not support args after an executable in Terminal settings, so /TASK xxx is not parsable.
Then I changed path in Terminal settings to a BAT file, but terminal seems not support running it; I see terminal flashes and closes. Maybe only executable is allowed. Branch info is shown at the right of current path. I think it is convenient.
So, you have two options:
change terminal to git-bash.exe and get used to slash as path separator(and that is much saner than back slashes, trust me)
just configure Intellj Terminal to open cmder, with default task like this: cmd /k ""%ConEmuDir%\..\init.bat" ". This will open cmder in the current folder, and you also have git support. That is, stop using mingw64 and only ConEmu + clink. You have color support, Windows backslashes and so on. And you also can mix Win commands with bash syntax(with "Shell integration" ticked). This is what I am doing right now. Branch info is shown, lambda symbol as well. It is already perfect.

MobaXterm windows PATH variable prepends system32 directory

So launching CMD in MobaXterm you have the option to user Windows Path variable. However, rather than using the same %PATH%, MobaXterm prepends the following directories into %PATH%.
C:\Users\${USER_ID}\AppData\Local\Temp\Mxt82\bin;C:\WINDOWS;C:\WINDOWS\system32;
I wonder why it does this? This gives us inconsistent behavior as if we launched cmd directly.

'gitk --all' command not being recognized in Windows 8 Powershell

gitk is not working for me. I get the error saying "the term 'gitk' is not recognized as the name of a cmdlet, function, script file, ...."
One interesting thing I noted was that inside C:\Program Files(x86)\Git\bin\, there was a gitk file, but it had no extension. Most other files in that folder had a .exe extension.
I also made sure that C:\Program Files(x86)\Git\bin\ is specified in the PATH environment variable.
Also, I tried adding C:\Program Files(x86)\Git\cmd\ to PATH because it contains a gitk.cmd file, but that did not help either.
Edit : I was using Powershell earlier, since I have poshgit installed. I switched over to bash, and I was able to do gitk --all from there.
I just got it to work after having the same problem.
At the PowerShell prompt it typed: "Bash" and hit return.
This put me into a bash shell.
Then I typed "gitk" at the Bash prompt and it worked.
So that gitk file is a UNIX shell script and requires the shell to work.
I suppose you could always have one of your Power Shell window in Bash mode and then this tool is available.

Resources