bug-bash
[Top][All Lists]
Advanced

[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: Fri, 2 Feb 2024 23:15:32 +0100

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
(which may be better than glob-expand-word, as it doesn't need a glob)


What I did (bash 5.1):

INPUTRC=/dev/null bash --norc --noprofile
set -o vi
bind 'set show-mode-in-prompt on'
bind -m vi-command "\C-f": glob-expand-word

Then type: l s space * esc ^F
Result: ls  *
(space inserted before the *)

Otoh, if I type: l s space * space esc ^F
Result: ls file1 file2 space

(both stay in command mode)


-- 
Regards, Mike Jonkmans



reply via email to

[Prev in Thread] Current Thread [Next in Thread]