[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: glob-expand-word and vi-command mode
From: |
Mike Jonkmans |
Subject: |
Re: glob-expand-word and vi-command mode |
Date: |
Sun, 4 Feb 2024 00:23:47 +0100 |
On Sat, Feb 03, 2024 at 04:59:08PM -0500, Chet Ramey wrote:
> 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.
How can I find this out?
INPUTRC=/dev/null bash --norc --noprofile
set -o vi
bind -m vi-insert -p
bind -m vi-command -p
Both show no bindings for "*".
(`man 3 readline' mentions "*" on vi-complete in command mode)
> > (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.
Seems logical.
> 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.
Clever.
--
Regards, Mike Jonkmans
Re: glob-expand-word and vi-command mode, Chet Ramey, 2024/02/03