Mail Archives: cygwin/2003/05/14/21:07:38
Jim Kleckner wrote:
>
> Igor Pechtchanski wrote:
>
>> On Tue, 13 May 2003, Jim Kleckner wrote:
>
> ...
>
>> FYI, the following works for me:
>>
>> cygstart gvim '"file with spaces.txt"' '"another file with spaces.txt"'
>
>
> Yep, you did it, thanks! A gold star for you, though
> definitely not as valuable as cgf's.
>
> Another case of peeling off layers of
> "quoting the quotes". There must be some
> DOS shell buried in there as part of the
> invocation or something.
No DOS shell involved here. (cygstart directly calls the Win32 API
ShellExecute function.) It's actually the (UNIX) shell which peels of
the quotes.
I'll make some changes to cygstart so that arguments with whitespace
will be (re-)quoted. I should be able to do this at the latest this
weekend.
(Note that this won't be 100% backwards compatible - for instance, this
breaks the above workaround. But I think we can live with that, it's
better than the current behaviour.)
>
>
> If anyone cares, here is a small bash
> snippet that will create either a shell
> alias or a function to figure out which
> version of gvim/vim/vimx/vi is available
> to use.
>
Here's mine:
vi()
{
local args=""
local arg dir
# Loop through arguments to command
for arg; do
# Is it an existing file? Translate to Windows format
if [[ -f "$arg" ]]; then
# Use short name iff filename contains space
if [[ "$arg" != ${arg/ /} ]]; then
arg=`cygpath -w -s "$arg"`
else
arg=`cygpath -w "$arg"`
fi
# Or is it a non-existing file in an existing directory (not
.)? Also
# translate to Windows format
else
dir=`dirname $arg`
if [[ "$dir" != "" && "$dir" != "." && -d "$dir" ]]; then
arg=`cygpath -w $arg`
fi
fi
args="$args $arg"
done
# Run gvim
gvim $args <&0 &
disown
}
Note that I don't use cygstart, but run 'disown' to solve the 'problem'
of job ownership.
(Actually, this is my Bash version of this function. in my Zsh version,
which I use normally, I run "gvim $args <&0 &!" instead.)
- Michael
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -