cygpath as a key binding

Joe Tree tree.joe@gmail.com
Sun Aug 13 01:34:00 GMT 2006


On 8/13/06, Jochen Wiedmann <jochen.wiedmann@gmail.com> wrote:
> Hi,
> is it possible to invoke cygpath as a key binding? For example, if my
> current command line is
>     tar c:\temp
> and my cursor is on c:\temp, then it would be nice to convert c:\temp
> into a Windows path by pressing a certain key.

sadly it would seem that the answer is "no, except with a lot of
hacking bash (or rather, readline)"

relevant documentation would be the "Readline" section of man bash
(readline is the library bash uses to read user input)
readline DOES allow for some configuration, but it does not seem to
have any option to run external commands to manipulate input, only
rather primitive editing, which consists mostly of predefined key
actions.

a rather silly option (not very useful for you, because it only works
for specific commands, and removes normal tab completion) is to set up
a programmable completion (a bash feature, see man bash, builtins,
complete) that calls cygpath:

user@cygwin$ complete -C "sh -c 'cygpath --dos \$2' --" justatest
user@cygwin$ justatest /etc/<tab>
user@cygwin$ justatest F:\cygwin\etc\

(one could try to make it act like normal completion, except when it
seems a path it can convert or thelike, but it doesn't seem very
workable)

- Joe

--
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/



More information about the Cygwin mailing list