ℹ️ This is a machine-translated document. In case of discrepancies, refer to the original document.
search_rules.sh – Interactive rule search with fzf¶
⚠️ Linux/macOS only. No Windows support (fzf + xdg-open).
What it does¶
search_rules.sh searches all map files in config/maps/ interactively with fzf.
Hits can be opened directly in the editor or viewed on GitHub.
Files in the repo¶
scripts/search_rules/search_rules.sh ← offizielle Version
tools/search_rules.sh ← veraltet, hat hardcodierten Pfad-Bug
The version in tools/ should be removed or replaced with a symlink:
rm ~/projects/py/STT/tools/search_rules.sh
ln -s ../scripts/search_rules/search_rules.sh ~/projects/py/STT/tools/search_rules.sh
Requirements¶
# fzf installieren (falls nicht vorhanden)
sudo apt install fzf # Debian/Ubuntu
sudo pacman -S fzf # Arch
brew install fzf # macOS
Usage¶
cd ~/projects/py/STT
bash scripts/search_rules/search_rules.sh
fzf Keyboard Shortcuts¶
Key |
Action |
|---|---|
Type |
Enter search query |
|
Open file in editor (Kate) |
|
Open line on GitHub in browser |
|
Previous search request from History |
|
Next search from History |
|
Previous History Entry |
|
Next History Entry |
|
Select all hits |
|
Cancel |
|
Wordwise Navigate |
|
Delete word (left) |
|
Delete word (right) |
Configuration¶
Customizable at the beginning of the script:
PREFERRED_EDITOR="kate" # Editor für Ctrl+Enter
HISTORY_FILE="$HOME/.search_rules_history" # Suchverlauf
DEFAULT_QUERY=".py pre # EXAMPLE:" # Startsuche beim ersten Aufruf
REPO_URL="https://github.com/sl5net/SL5-aura-service/blob/master"
Preview Window¶
The fzf window displays a preview of the match at the top (50%):
5 lines before and after the match
The hit line is marked with
>Line numbers are displayed
Search History¶
The last search query is automatically used as the starting value the next time it is called.
The course is located in ~/.search_rules_history.
Typical search queries¶
FUZZY_MAP_pre # alle pre-Map Regeln
# TODO # auskommentierte Aufgaben
^.*$ # Fullmatch-Regeln (Pipeline-Stopper)
re.IGNORECASE # alle Regex-Regeln mit Flag
koans # alle Koan-Dateien
Known Limitations¶
Only Linux/macOS (no Windows because of
fzfandxdg-open)Editor hardcoded to
kate– change toPREFERRED_EDITORfor another editorSearch only in
config/maps/– not in the entire repo