Welcome to fzf-picker 👋
File Picker with fzf and rg
This project is a fork of the amazing work done by @tomrijndorp. While the initial intention was to contribute via a pull request, the changes became quite extensive, leading to this separate project.
About This Fork
This fork aims to extend and enhance the functionality of the original project. We're actively working on incorporating workflows inspired by tools like fzf-lua to provide a more comprehensive and flexible file picking experience in VS Code.
Prerequisites
Ensure you can run fzf
, rg
, bat
, and sed
directly in your terminal. If those work, this plugin will work as expected.
[!TIP]
Installing prerequisites with mise
You can easily install all the required tools globally using mise. Here's how:
First, install mise by following the mise installation guide.
Then, install the required tools globally:
mise use -g fzf@latest
mise use -g ripgrep@latest
mise use -g bat@latest
mise use -g node@lts
Activate mise in your shell:
eval "$(mise activate bash)" # or zsh, fish, etc.
This will ensure you have all the necessary tools installed globally and available in your environment.
For more information on global installations, refer to the mise install documentation.
Default Key Bindings
cmd+shift+j
/ ctrl+shift+j
: Search files
cmd+shift+u
/ ctrl+shift+u
: Search for text within files
cmd+shift+ctrl+u
/ ctrl+shift+alt+u
: Search for text within files with type pre-filtering
cmd+shift+alt+f
/ ctrl+shift+alt+f
: Pick a file from git status
cmd+shift+alt+t
/ ctrl+shift+alt+t
: Find TODO/FIXME comments
You can change these using VS Code's keyboard shortcuts.
Recommended Settings
{
// Setup fzf-picker extension
"fzf-picker.customTasks": [
// Choose folder to open on new window
{
"name": "zoxide",
"command": "cursor $(zoxide query --interactive)"
}
],
// Allow top open a file with line number
"fzf-picker.general.openCommand": "code -g"
}
Features
This plugin is useful for:
- Very large projects with lots of files (which makes VS Code's search functionality quite slow)
- Users who love using
fzf
and rg
and would like to bring those tools inside VS Code
The extension provides five main commands:
- Search for files and open them
- Search within files for text and open them
- Search within files with file type pre-filtering
- Pick file from git status
- Find TODO/FIXME comments
All commands now support toggling the preview window using Ctrl+G
while in the fzf interface.
Demo
Search files
Search within files
Search within files with type pre-filtering
Pick file from git status
Find TODO/FIXME comments
Extension Settings
This extension contributes various settings. Please refer to the VS Code settings UI for a complete list and descriptions.
Commands
Command |
Title |
fzf-picker.findFiles |
Find It Faster: search file |
fzf-picker.findFilesWithType |
Find It Faster: search file (with type filter) |
fzf-picker.findWithinFiles |
Find It Faster: search within files |
fzf-picker.findWithinFilesWithType |
Find It Faster: search within files (with type filter) |
fzf-picker.resumeSearch |
Find It Faster: resume last search |
fzf-picker.pickFileFromGitStatus |
Find It Faster: Pick file from git status |
fzf-picker.findTodoFixme |
Find It Faster: Find TODO/FIXME comments |
fzf-picker.runCustomTask |
Find It Faster: Run Custom Task |
Settings
Key |
Description |
Type |
Default |
fzf-picker.general.batTheme |
The color theme to use for bat (see bat --list-themes ) |
string |
"1337" |
fzf-picker.findFiles.showPreview |
Show a preview window when searching files |
boolean |
true |
fzf-picker.findFiles.previewCommand |
When populated: Used by fzf to produce the preview. Use {} to indicate the filename. Example: bat {} . |
string |
"" |
fzf-picker.findFiles.previewWindowConfig |
When populated: Used by fzf to determine position and look of the preview window. See the fzf documentation. Example for a horizontal split: top,50% . |
string |
"" |
fzf-picker.findWithinFiles.showPreview |
Show a preview window when searching within files |
boolean |
true |
fzf-picker.findWithinFiles.previewCommand |
When populated: Used by fzf to produce the preview when searching within files. Use {1} to indicate the filename, {2} for the line number |
string |
"" |
fzf-picker.findWithinFiles.previewWindowConfig |
When populated: Used by fzf to determine position and look of the preview window. See the fzf documentation. Example for a horizontal split: top,50%,border-bottom,+{2}+3/3,~3 . |
string |
"" |
fzf-picker.advanced.useEditorSelectionAsQuery |
By default, if you have an active editor with a text selection, we'll use that to populate the prompt in fzf such that it will start filtering text directly. Uncheck to disable. |
boolean |
true |
fzf-picker.pickFileFromGitStatus.showPreview |
Show a preview window when picking a file from git status |
boolean |
true |
fzf-picker.pickFileFromGitStatus.previewCommand |
When populated: Used by fzf to produce the preview when picking a file from git status. Use {} to indicate the filename. Example: git diff --color=always -- {} . |
string |
"" |
fzf-picker.pickFileFromGitStatus.previewWindowConfig |
When populated: Used by fzf to determine position and look of the preview window when picking a file from git status. See the fzf documentation. Example: right:50%:border-left . |
string |
"" |
fzf-picker.findTodoFixme.previewEnabled |
Enable preview for TODO/FIXME search results |
boolean |
true |
fzf-picker.findTodoFixme.previewCommand |
Preview command for TODO/FIXME search results |
string |
"bat --decorations=always --color=always {1} --highlight-line {2} --style=header,grid" |
fzf-picker.findTodoFixme.previewWindowConfig |
Preview window configuration for TODO/FIXME search results |
string |
"right:border-left:50%:+{2}+3/3:~3" |
fzf-picker.findTodoFixme.searchPattern |
Regular expression pattern for searching TODO/FIXME/HACK comments. Matches keywords followed by a colon and optional space. |
string |
"(TODO|FIXME|HACK|FIX):\\s" |
fzf-picker.customTasks |
Custom tasks that can be executed by the extension |
array |
[] |
fzf-picker.general.openCommand |
Select the command to open files base on your current editor |
string |
"code -g" |
fzf-picker.general.debugMode |
Enable debug mode for the extension. This will log additional information to the console. |
boolean |
false |
FAQ
Please refer to the FAQ.md file for known issues and frequently asked questions.
Contributing
For information on contributing fixes and features, see CONTRIBUTING.md.
Release Notes
For detailed release notes, please see the CHANGELOG.md file.
Future Plans
We're actively exploring ways to incorporate additional workflows and features inspired by other powerful tools like fzf-lua. If you have suggestions or specific workflows you'd like to see implemented, please feel free to open an issue or contribute to the project.
Author
👤 Dung Huynh Duc dung@productsway.com
Show your support
Give a ⭐️ if this project helped you!
📝 License
Copyright © 2024 Dung Huynh Duc dung@productsway.com.
This project is MIT licensed.