A Bash tool for managing and executing one-liner commands via fzf's fuzzy search, inspired by yuki-yano/zsh-fzf-snippet
Assuming you have a Markdown file in the following format:
# Print line number X of a file
`head -n <num> <file> | tail -n 1`
https://www.linuxquestions.org/questions/programming-9/print-line-number-x-of-a-file-in-shell-273849/
# Remove duplicate lines from a file
`awk '!seen[$0]++' <file>`
https://linux.cn/article-6881-1.html
- Press
Ctrl + a
to launch the fzf search console. - Use the arrow keys to navigate through the list of commands.
- Press
Enter
to select a command or pressEsc
to exit the search. - The selected commands would prompt into your command line.
- First, you need to install fzf.
- Clone this repository:
git clone https://github.com/5uperb0y/fzf-oneliner-manager
. - Open the
fzf-oneliner-manager.sh
in a text editor. - Set your preferred shortcut and paths to your command markdown file in the
fzf-oneliner-manager.sh
ReplaceFZF_ONELINER_SHORTCUT="\C-a" FZF_ONELINER_COMMANDS="$HOME/.oneliners"
$HOME/.oneliners
with the path to your markdown file containing your commands. - Add the following line to your
~/.bashrc
file:source /path/to/fzf-oneliner-manager.sh
- Restart your terminal or run
source ~/.bashrc
to activate the changes. - Type your shortcut to open the one-liner searching console.
Here are some similar tools that you might find useful: