Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/duong-db/fzf-simple-completion
[Tab] When bash-completion meets fuzzy finder.
https://github.com/duong-db/fzf-simple-completion
bash bash-completion fuzzy-finder fzf shell tab-completion
Last synced: about 2 months ago
JSON representation
[Tab] When bash-completion meets fuzzy finder.
- Host: GitHub
- URL: https://github.com/duong-db/fzf-simple-completion
- Owner: duong-db
- Created: 2024-09-08T10:55:11.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-22T05:09:12.000Z (3 months ago)
- Last Synced: 2024-11-01T06:34:04.336Z (2 months ago)
- Topics: bash, bash-completion, fuzzy-finder, fzf, shell, tab-completion
- Language: Shell
- Homepage:
- Size: 2.93 KB
- Stars: 16
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fzf simple completion
Pipe bash tab-completion suggestions into ``fzf`` fuzzy finder## Prerequisites
- [fzf](https://github.com/junegunn/fzf) (command-line fuzzy finder)
- [bash-completion](https://github.com/scop/bash-completion) (most Linux distros ship ``bash-completion`` by default, so there is less chance you will have to install it)## Quick start
Source ``fzf-simple-completion.sh`` at the end of your ``.bashrc``. For example:
```sh
source ~/path/fzf-simple-completion.sh
```
This will replace the default bash completion by fzf selection menu whenever you hit ``TAB``.
## Features
- Commands and arguments completion
- Directories shortening
- Color support
## How does it work?
This project is motivated by [Accessing tab-completion programmatically in Bash](https://brbsix.github.io/2015/11/29/accessing-tab-completion-programmatically-in-bash/). You may find some alternatives on Github as well, but the implementations looks overwhelming to me (I'm not a bash guru so I want to keep things as clean and manageable as possible).The idea this project works on is straightforward:
- Pipe all suggestions from ``bash-completion`` directly into ``fzf`` for easy search and selection.There is an extra work to make the complettion handle directories with spaces, shortening paths, and coloring. The script itself is written in just a few lines of code, making it easy to modify and customize as needed.