[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: glob-expand-word and vi-command mode
From: |
Chet Ramey |
Subject: |
Re: glob-expand-word and vi-command mode |
Date: |
Sat, 3 Feb 2024 16:59:08 -0500 |
User-agent: |
Mozilla Thunderbird |
On 2/2/24 5:15 PM, Mike Jonkmans wrote:
On Fri, Feb 02, 2024 at 09:50:46AM -0500, Greg Wooledge wrote:
On Fri, Feb 02, 2024 at 03:39:54PM +0100, Mike Jonkmans wrote:
[ mkdir test; cd test; touch file1 file2 ]
Going into `vi-command' mode on the line `ls *' puts the cursor on the `*'.
Then `glob-expand-word' does nothing with the `*', it just inserts a space.
Resulting in `ls *' (cursor still on `*').
Expected: nothing happens.
I'm not sure what keystrokes you're actually using, or what bind calls
you've done leading up to this, but in a vanilla instance of bash with
nothing done except 'set -o vi', typing
l s space * esc *
will replace the * with file1 file2 and another space, and also puts
you in insert mode for some reason. Probably historical.
esc * is bound to insert-completions
It's bound to vi-complete, which bash replaces with something that does
the pathname expansion that POSIX requires.
(which may be better than glob-expand-word, as it doesn't need a glob)
Well, it appends a `*' if the word doesn't have any globbing chars.
If your goal is to be in vi command mode when the command completes, why
not use a macro?
bind -m vi-command '"\C-f":"*\e"
does that.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
Re: glob-expand-word and vi-command mode, Chet Ramey, 2024/02/03