Skip to content

lgdevlop/zsh-smart-insert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

zsh-smart-insert

zsh-smart-insert Logo

Smart file search and insertion for Zsh ✨
Insert file paths from fuzzy search directly into your command line.

Contributions Welcome Changelog Available


πŸ” About

zsh-smart-insert is a Zsh plugin that provides interactive widgets to search for files and content using fd, rg, and fzf. It inserts the result directly into your shell with optional command prefixes.

  • πŸ“‚ File path selection with preview via fd + fzf
  • 🧠 Content search with reactive reload using ripgrep
  • ⌨️ Prefix support (e.g. vim, cat, less, code)
  • 🎨 Syntax-highlighted preview using bat

βš™οΈ Requirements

Tool Purpose Link
fzf Interactive fuzzy search Link
fd File system search Link
rg Content search engine Link
bat Preview with syntax highlighting Link

πŸš€ Installation

Manual

git clone https://github.com/lgdevlop/zsh-smart-insert.git ~/.zsh-smart-insert
echo "source ~/.zsh-smart-insert/zsh-smart-insert.plugin.zsh" >> ~/.zshrc
source ~/.zshrc

Zinit

zinit light lgdevlop/zsh-smart-insert

Antigen

antigen bundle lgdevlop/zsh-smart-insert

Oh My Zsh (manual plugin)

git clone https://github.com/lgdevlop/zsh-smart-insert.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-smart-insert

Then add to your .zshrc:

plugins=(git zsh-smart-insert)

Reload with:

omz reload   # if using Oh My Zsh
# or
source ~/.zshrc

πŸ’‘ Usage

  • Alt+f – Pick files by name with fd
  • Alt+g – Search files by name with rg
  • Alt+s – Search file content with live reload

Each result is inserted at the cursor with an optional prefix.

Example: Select a file with vim as prefix β†’ inserts vim ./my/file.txt

More examples in project-docs/examples.md


🧩 Configuration

You can customize behavior with environment variables:

# Custom prefix options (fzf menu)
export ZSH_SMART_INSERT_PREFIXES="nvim:less:code"

# Custom directories to ignore in fd/rg
export ZSH_SMART_INSERT_IGNOREDIRS=".git/*:node_modules/:dist/:.venv/"

⌨️ Shortcuts

Key Action
Alt+f Fuzzy file picker with preview
Alt+g File name search with rg
Alt+s Content search with live reload
Ctrl+/ Toggle preview in FZF

See project-docs/shortcuts.md for full reference.


πŸ“ Project Structure

.
β”œβ”€β”€ zsh-smart-insert.plugin.zsh     # Plugin entry point
β”œβ”€β”€ functions/                      # Reusable Zsh helpers
β”œβ”€β”€ internal/                       # ZLE widgets (fzf search)
β”œβ”€β”€ scripts/                        # Automation (e.g. release notes)
β”œβ”€β”€ project-docs/                   # Docs: shortcuts, examples
β”œβ”€β”€ .github/workflows/              # CI/CD pipelines
β”œβ”€β”€ install.sh                      # Interactive installer

πŸ›£οΈ Roadmap

  • Prefix selector with command injection
  • Search by name and content
  • Interactive previews with bat
  • Customizable prefixes and ignored paths
  • Per-widget user customization (e.g. ignoredir by mode)
  • Custom themes and per-widget configuration

πŸ“„ Related Docs


🀝 Contributing

Contributions are welcome! Open an issue or submit a pull request.

See CONTRIBUTING.md and CODE_OF_CONDUCT.md.


πŸ“„ License

MIT β€” See LICENSE.


πŸ‘€ Author

Made with ❀️ by Leonardo Gomes


✨ zsh-smart-insert β€” Insert smarter, search faster!

About

Zsh plugin to smartly insert file paths using FZF, fd, rg and custom prefixes.

Topics

Resources

License

Code of conduct

Contributing

Stars

7 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors