I finally have a newish Windows 10 64-bit laptop for a course and, per
instructions, have installed Git Bash that uses MinGW from:
https://git-scm.com/downloads
I also have a standard native Window build of GVIm 8.2 installed under:
C:\Program File (x86)\Vim\vim82
which I believe was the default for the standard installer.
MinGW Git Bash ships with a built-in version of vim 8.2 as MinGW program, but
does not include GVim.
What I am looking to do is to start the native Windows version of GVim from a
the Git Bash prompt. Rather than change the path I hoped to use a simple bash
alias with a full path to start Windows GVim 8.2. This works except that the
bash prompt blocks as if Windows GVim is a console program and the shell is
waiting to get control back of the console. I am not entirely sure why the
shell waits for Gvim to exit. The same technique I am trying to was recommended
for MSysGit Bash and Vim 7.4 by Albert Armea at:
https://blog.albertarmea.com/post/115102365718/using-gvim-from-git-bash
The best reason I can fathom is that I read elsewhere that MinGW is a more
minimalist UNIX implementation than say Cygwin and does not implement fork()
despite providing the header file. Another possibility is that some trick
integration set up in the bundle for Vim and GVim with Git is inadvertently fighting my
attempt to use a Windows executable.
Due to how Bash is invoked by the Git Bash bundle, the easiest way for me to
configure user specific bash aliases or the like is to create two files:
~/.bash_profile is minimal and contains:
if [ -f ~/.bashrc ]; then. ~/bashrc; fi
~/.bashrc has my local alias and a bash function gvim () as follows:
gvim () { (env -u HOME -u VIM "/c/Program Files (x86)/vim/vim82/gvim.exe" "$*")& }
Another place on the Internet, I found advice to unset the HOME and VIM
environment variables local to MinGW Bash as Windows GVIm 8.2 is started, but I
converted a simple bash alias to bash function. While the env command above
would run GVim as a simple alias, the Git Bash shell blocks waiting for GVim to
exit. The bash function is needed so I can embed the env in a subshell with
parentheses and push it to the background, while still passing parameters to the
inner command line. This bash function works, starting GVim and letting the
shell continue. I do notice that this Windows GVim shows up as a process when
using the ps command at the Git Bash prompt. I am not sure if anything funny
happens, based on the order I close Git Bash and GVim.
I am not sure if this is the best approach. Another idea I saw on the Internet
suggested using the bash disown built-in command, but I was getting syntax
errors. I tried debugging with set -x in Git Bash but extra commands I did not
expect were being generated, probably due to Git integration. I decided that
this method is best, for now, but I am wondering if there are any gotchas
lurking here.
Thanks in advance for any advice.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200514191755.GB1444%40linux.site.
No comments:
Post a Comment