Skip to main content
added 60 characters in body
Source Link

Whenever I tab-complete a file path after a git command in bash, e.g. git add, I have to press <TAB> multiple times to complete to the actual filename, depending on how many subfolders there are up to the file.

Example: I want to add the file my/example/file, then I enter:

git add <TAB>
git add my/<TAB>
git add my/example/<TAB>
git add my/example/file

This is the case even when my/example/file is the only changed file and hence the only current tab-completion option. In this case bash could as well complete the full path with the first <TAB> already, but it doesn't.

fish actually does this by default:

git add <TAB>
git add my/example/file

Is there a way to configure this behavior in bash as well?

I am on Ubuntu 20.04 using its default bash completions.

Whenever I tab-complete a file path after a git command in bash, e.g. git add, I have to press <TAB> multiple times to complete to the actual filename, depending on how many subfolders there are up to the file.

Example: I want to add the file my/example/file, then I enter:

git add <TAB>
git add my/<TAB>
git add my/example/<TAB>
git add my/example/file

This is the case even when my/example/file is the only changed file and hence the only current tab-completion option. In this case bash could as well complete the full path with the first <TAB> already, but it doesn't.

fish actually does this by default:

git add <TAB>
git add my/example/file

Is there a way to configure this behavior in bash as well?

Whenever I tab-complete a file path after a git command in bash, e.g. git add, I have to press <TAB> multiple times to complete to the actual filename, depending on how many subfolders there are up to the file.

Example: I want to add the file my/example/file, then I enter:

git add <TAB>
git add my/<TAB>
git add my/example/<TAB>
git add my/example/file

This is the case even when my/example/file is the only changed file and hence the only current tab-completion option. In this case bash could as well complete the full path with the first <TAB> already, but it doesn't.

fish actually does this by default:

git add <TAB>
git add my/example/file

Is there a way to configure this behavior in bash as well?

I am on Ubuntu 20.04 using its default bash completions.

This question is not about fish, it's about adding a fish-like behavior to bash
Link
Source Link

bash tab-completion: complete full path on single tab in git commands?

Whenever I tab-complete a file path after a git command in bash, e.g. git add, I have to press <TAB> multiple times to complete to the actual filename, depending on how many subfolders there are up to the file.

Example: I want to add the file my/example/file, then I enter:

git add <TAB>
git add my/<TAB>
git add my/example/<TAB>
git add my/example/file

This is the case even when my/example/file is the only changed file and hence the only current tab-completion option. In this case bash could as well complete the full path with the first <TAB> already, but it doesn't.

fish actually does this by default:

git add <TAB>
git add my/example/file

Is there a way to configure this behavior in bash as well?