[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
glob-expand-word and vi-command mode
From: |
Mike Jonkmans |
Subject: |
glob-expand-word and vi-command mode |
Date: |
Fri, 2 Feb 2024 15:39:54 +0100 |
>From the manual, glob-expand-word:
The word before point is treated as a pattern for pathname expansion,
and the list of matching filenames is inserted, replacing the word.
If a numeric argument is supplied, an asterisk is appended before
pathname expansion.
[ With a block cursor, `before point' would be left of that. ]
[ 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.
Also in `vi-command' mode, line is `ls "*"', cursor on the last `"'.
Then `glob-expand-word' produces `ls file1 file2 "'. Munching a quote and
adding a space.
Expected: `ls "file1 file2".
And again in `vi-command' mode with line `ls *1*', cursor on last `*'.
Then `glob-expand-word' produces `ls file1 *'. Not sure why this is useful.
Note that `ls "f"* ' with cursor on the last space, doesn't expand.
Would be a `nice to have' to do quote removal and maybe other expansions.
Wow, tilde expansion is done: `ls ~/b*' expands. Cool, but undocumented.
I would argue that `glob-expand-word' should expand the word the cursor is in.
Then only if the cursor is on whitespace, the `word before point' is used.
For `vi-command' mode it might be nice if the cursor didn't move onto the
last character.
vi-insert mode: `ls *' cursur is after the `*'
then going to vi-command mode, the cursor moves onto the `*'.
This prevents the `glob-expand-word' from doing its thing.
--
Regards, Mike Jonkmans
- glob-expand-word and vi-command mode,
Mike Jonkmans <=
Re: glob-expand-word and vi-command mode, Chet Ramey, 2024/02/03