Discussion:
FIGNORE not effective if it contains a full filename
(too old to reply)
Josh Triplett
2020-08-19 19:15:54 UTC
Permalink
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-vu7ylu/bash-5.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security
uname output: Linux s 5.7.0-2-amd64 #1 SMP Debian 5.7.10-1 (2020-07-26) x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.0
Patch Level: 18
Release Status: release

Description:
If FIGNORE contains the complete filename of a file, tab
completion will not ignore it.

Repeat-By:
First, `touch Cargo.{toml,lock}` to create a pair of files with a
common prefix. (These two names commonly appear side-by-side in Rust
projects, and you almost always want to tab-complete Cargo.toml, not
Cargo.lock.)

To test the baseline behavior, type `echo C` and press tab; bash
will complete "Cargo." and wait for more input.

Set FIGNORE=lock and try again; bash ignores Cargo.lock and
completes Cargo.toml.

Set FIGNORE=argo.lock and try again; bash again ignores
Cargo.lock and completes Cargo.toml.

Set FIGNORE=Cargo.lock and try again; bash just completes
"Cargo." and waits for more input.
Chet Ramey
2020-08-19 19:33:49 UTC
Permalink
Post by Josh Triplett
Bash Version: 5.0
Patch Level: 18
Release Status: release
If FIGNORE contains the complete filename of a file, tab
completion will not ignore it.
FIGNORE is a list of suffixes, and requires at least one character before
the suffix when matching.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU ***@case.edu http://tiswww.cwru.edu/~chet/
Josh Triplett
2020-08-19 20:01:33 UTC
Permalink
Post by Chet Ramey
Post by Josh Triplett
Bash Version: 5.0
Patch Level: 18
Release Status: release
If FIGNORE contains the complete filename of a file, tab
completion will not ignore it.
FIGNORE is a list of suffixes, and requires at least one character before
the suffix when matching.
I'm wondering if either that might be changeable or there could be a way
to specify full filenames to get the same treatment. I'd like to ignore
specific filenames, rather than all filenames ending in a suffix. Or
perhaps there could be an option that does a regex match (allowing
things like ^ and $)?
Chet Ramey
2020-08-19 20:20:58 UTC
Permalink
Post by Josh Triplett
Post by Chet Ramey
Post by Josh Triplett
Bash Version: 5.0
Patch Level: 18
Release Status: release
If FIGNORE contains the complete filename of a file, tab
completion will not ignore it.
FIGNORE is a list of suffixes, and requires at least one character before
the suffix when matching.
I'm wondering if either that might be changeable or there could be a way
to specify full filenames to get the same treatment.
FIGNORE has behaved this way for 30 years, so there's not much chance that
behavior will change.
Post by Josh Triplett
I'd like to ignore
specific filenames, rather than all filenames ending in a suffix. Or
perhaps there could be an option that does a regex match (allowing
things like ^ and $)?
You can do this with programmable completion, but you have to go through
the effort of defining the compspecs for the commands of interest. Or
you can use it in the default programmable completion (complete -D).
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU ***@case.edu http://tiswww.cwru.edu/~chet/
Loading...