[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How does one disable completion when nothing but tabs or spaces is o
From: |
Chet Ramey |
Subject: |
Re: How does one disable completion when nothing but tabs or spaces is on the line? |
Date: |
Tue, 01 Jan 2013 19:40:16 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
On 1/1/13 6:31 PM, Linda Walsh wrote:
> Chet Ramey wrote:
>> On 12/31/12 4:48 PM, Linda A. Walsh wrote:
>>
>>> If I have nothing but tabs or spaces on a line, how do I disable completion
>>> but have it return the char typed? (space or tab) -- and if bash is looking
>>> for a command, then execute any command.
>>>
>>
>> If you don't want TAB to perform completion, you have two choices:
>>
> I did not say I wanted to disable TAB completion.
> I want a conditional disabling similar to that which disables
> empty-command-completion, but I want it:
> 1) ANY time the cursor is in column 0
> 2) Any time there is only white space on the line before the cursor.
>
>
> That's not something that any of the suggestions I've seen allow for.
OK, if readline as it currently exists doesn't offer the feature you want,
why not take a shot at writing it? You might find that others like it as
well, though none of them have spoken up so far.
>> If you want to insert a TAB without having it perform completion while
>> leaving it bound to `complete', you can:
>>
>> 1. Bind some key sequence to `tab-insert' and use that (readline binds
>> M-TAB to that, but bash overrides it)
>> 2. Use the key sequence bound to `quoted-insert' (^V by default) before
>> typing TAB.
>>
> ----
> Neither would work with normal text processing -- either cut/paste
> or a program reading a script and driving a bash session via a pty or similar.
I would argue that neither of those -- and certainly not the latter --
constitutes `normal text processing' as readline is most often used.
> ----
> Create an inputrc file with:
>
> "`": completion
> "TAB": self-insert
What you've done here is bind backquote to a non-existent function and the
three-character sequence `T'`A'`B' to `B'.
A few minutes of testing with an inputrc consisting of
"`": complete
TAB: self-insert
seems to produce expected behavior.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/