47 lines
1.7 KiB
Markdown
47 lines
1.7 KiB
Markdown
# Bash + fzf Setup (Fish-like UX without switching shells)
|
|
|
|
## What was done
|
|
- Decided to stay on Bash instead of switching to Zsh or Fish
|
|
- Installed `fzf` and `bash-completion` via pacman (EndeavourOS) / apt (Debian VPS)
|
|
- Added activation block to `~/.bashrc`
|
|
|
|
## Key insight
|
|
You don't need to switch shells to get Fish-like autocomplete and fuzzy history. `fzf` drops straight into Bash with zero compatibility risk — and Bash stays consistent across desktop and VPS.
|
|
|
|
## The `.bashrc` block to add
|
|
|
|
```bash
|
|
# bash-completion
|
|
[[ -r /usr/share/bash-completion/bash_completion ]] && . /usr/share/bash-completion/bash_completion
|
|
|
|
# fzf
|
|
eval "$(fzf --bash)"
|
|
```
|
|
|
|
## Commands
|
|
|
|
| What | Command |
|
|
|------|---------|
|
|
| Install (Arch/EndeavourOS) | `sudo pacman -S fzf bash-completion` |
|
|
| Install (Debian/VPS) | `sudo apt install fzf bash-completion` |
|
|
| Reload config | `source ~/.bashrc` |
|
|
| Fuzzy history search | `Ctrl+R` |
|
|
| Fuzzy file search | `Ctrl+T` |
|
|
| Fuzzy directory jump | `Alt+C` |
|
|
| Jump to line in nano | `Ctrl+_` then line number |
|
|
| Toggle line numbers in nano | `Alt+N` |
|
|
|
|
## When to use
|
|
- Any time you set up a new Bash environment (VPS, new machine)
|
|
- Same config works on Arch and Debian — package manager is the only difference
|
|
|
|
## Fixing a corrupted `.bashrc`
|
|
If a paste goes wrong and injects garbage into `.bashrc`:
|
|
1. `cat -n ~/.bashrc` to find the broken lines
|
|
2. `nano ~/.bashrc` → `Ctrl+_` to jump to line number, `Ctrl+W` to search
|
|
3. Remove the injected string carefully, leaving the rest of the line intact
|
|
4. Watch for `esac` keywords — they're easy to corrupt and hard to spot
|
|
5. `source ~/.bashrc` to verify the fix
|
|
|
|
## Index line
|
|
`bash_fzf_setup.md` — Bash fuzzy search setup; fzf + bash-completion; fixing corrupted .bashrc
|