delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/08/12/21:28:06

X-Spam-Check-By: sourceware.org
Message-ID: <956f9b610608121827n46e1c555j8b35dfb8239ba0c8@mail.gmail.com>
Date: Sun, 13 Aug 2006 03:27:51 +0200
From: "Joe Tree" <tree DOT joe AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cygpath as a key binding
In-Reply-To: <44DE8373.3030909@gmail.com>
MIME-Version: 1.0
References: <44DE8373 DOT 3030909 AT gmail DOT com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 8/13/06, Jochen Wiedmann <jochen DOT wiedmann AT gmail DOT 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 AT cygwin$ complete -C "sh -c 'cygpath --dos \$2' --" justatest
user AT cygwin$ justatest /etc/<tab>
user AT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019