enviroment for gVim. To this end, I put the following into my _vimrc
file:
" Use cygwin shell
" Taken from http://vim.wikia.com/wiki/Use_cygwin_shell
set shell=D:\my\home\cygwin\bin\bash
set shellcmdflag=--login\ -c
set shellxquote=\"
That works fine. Whenever I issue a :call system(anything) command,
the "anything" part is taken to be something that I would normally
enter after the bash prompt in the cygwin console.
Now to the problem. In a plugin I'm doing the following:
let myfile = <path to an executable bash file>
if filereadable(myfile)
call system(myfile)
else
...
"myfile" is a bash script stored in my home directory. This means
Value of $HOME under Windows: D:\my\home
Value of $HOME under cygwin: /cygdrive/d/my/home
Value of $HOME as seen by gVim: /cygdrive/d/my/home
I tried different combinations with "~/...", $HOME, "$HOME", cygpath,
etc but I cannot find a way to define a single value of myfile that
works with both filereadable() and system(). The best I got so far is
the following:
let myfile = "/some/folder/script.sh"
if filereadable( $HOME . myfile)
call system("$HOME" . myfile)
else
...
Note the quotes around $HOME when within system() but not when within
filereadable(). In other words, seems that system correctly expects
cygwin syntax but filereadable() still expects Windows native paths.
Is this an inconsistency, or am I missing some obvious point? Is there
any better way to deal with this situation?
--
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
To unsubscribe, reply using "remove me" as the subject.
No comments:
Post a Comment