The only Fuzzy-Finder you'll need!
git clone https://github.com/Fr4cK5/spear
- Do either of
- Start Spear
./src/Spear.ahk
. Since there's no personal config file, it will automatically copy the default one. - Make a copy of the file
./config/config_default.json
and name itconfig.json
.
- Start Spear
- Now you can safely edit your config while also having a fallback option.
-
Fuzzy Matching
- Fuzzy matching doesn't look for the exact input, but just for the containment of every character in the right order
- Say you're searching for a
.png
image file - An input of
hlwr!
would matchhello, world!
because the input's characters are in the right order and are all contained in the so-called haystackhello, world!
tfx
would successfully findthe-file.txt
since all the characters are contained and appear in the right orderxft
would not findthe-file.txt
since there's nof
after thex
meaning not all the characters are contained in the right order- If you're using path-matching instead of just filename-matching, you can type out parts of the path and the filename to get potentially better results.
- For example, your input is
picfampho01png
- This would likely find
- Pictures
- Family Photos
- Photo-01.png
- If you're using the
ignorewhitespace
config you can also use an input like thispic fam pho 01 png
- For example, your input is
-
Suffix Matching
- To suffix match, just suffix your input with
$
. - To search for all mp3 files in your file hierarchy, try this input
.mp3$
- Since all mp3 audio files end with an
.mp3
this input will find them all - Why is
$
the suffix of choice? Probably all regex engines out there use it as their end-of-string character. this just makes it a little more familiar :)
- To suffix match, just suffix your input with
-
Containment Matching
- To containment-match, just suffix your input with
?
- You might have some file who's name you just barely remember, right?
- Assuming the file is called
some-file.txt
any of the following inputs would find itsome-file.txt?
file?
me-fi?
- Why is
?
the suffix of choice? It works
- To containment-match, just suffix your input with
-
Filemode filtering
- You can filter for different types of filesystem entries using prefixes
- Filter to only include files
:f
- Filter to only include sym-links
:l
- Filter to only include directories
:d
- Filter to only include files
- This can be combined in multiple different ways
- Need to find a directory that fuzzily matches
myfile
?:dmyfile
's got you covered! - Maybe you've got a file by the name
directory
together with a bunch of other directories.:fdirectory?
will find it for you
- Need to find a directory that fuzzily matches
- Why did I choose
:
as the prefix?- Makes for pretty good indicator that its a prefix
- The
:
characters is not permitted in filenames under windows
- You can filter for different types of filesystem entries using prefixes
-
Path matching: You can choose to
- Only use each item's name: "config.json"
- Use it's full path: "C:/Users/You/Pictures/Family-Photo.jpeg"
-
LCtrl+LWin+L
Open the UI with explorer integration if enabled -
LCtrl+LWin+K
Open the UI without explorer integration, regardless of your config -
LCtrl+F
Focus the search input -
LCtrl+M
Toggle path matching on the fly -
Clicking
LButton
Copy filepath to system clipboardLCtrl+LButton
Open entry in Explorer. This can be changed in the configLAlt+LButton
Execute the command set in the config with{}
being replaced with the file's pathClear Cache
This will clear all the cached files and directories to give the used memory back to the operating systemRefresh Cache
This will refresh the cache to account for new or deleted files. When the cache is cleared but you still want to search the same directory also press this buttonSelect Dir
Select another directory manually. As an alternative to this, you can just navigate to your desired directory and press LCtrl+LWin+L.
-
Vim-Mode
- If you've enabled Vim-Mode, you can focus the list by pressing tab (assuming the input is currently focused.)
- All your configured keybinds will now be applied.
-
Esc
Hide the UI
NOTE If you're somebody that types rather fast and the results seem to be incorrect, try pressing enter while the input is in focus. This has todo with the async nature of GUIs vs the blocking nature of a DllCall.
All of this would not have been possible without GroggyOtter's JSON parsing library: jsongo.ahk.
Note: Some values contain a {}
. This is a placeholder for a dynamically generated value. Do not remove it. Any text outside of it however can be changed.
listviewlimit
How many items the list view can display at a timeshowfulldir
Show the full directory of the item or just the last part of itautoclear
Automatically clear the UI upon hiding itdollarsuffixisendswith
Suffixing your input with$
makes the search algorithm look for suffixes insteadqmsoffixiscontains
Suffixing your input with?
makes the search algorithm look for containment insteadignorewhitespace
Ignore the white space in your input.Test File.txt
will be equal toTestFile.txt
if set to truehideafteruiinteraction
Hide the UI after interacting with itmatchignorecase
Ignore whether any input's characters are uppercase or lowercase when filteringbasedir
Starting directorymatchpath
Incorperate the path to the file in the filtering processintegrations
Integration specific settingsexplorer
Enable the explorer integrationeditcmd
The command to be executed when opening a file from the UI's list viaLAlt+LButton
orf
in Vim-Mode
native
Native library specific settingsmaxitemsforautoupdate
Maximum amount of items to automatically filter and update the list while typing making it feel "realtime"autofreebuffer
Automatically free the buffer and release the memoryautofreetimeout
The time (seconds)Spear
must be in idle (no user-interaction) to automatically free the buffers
vim
List Vim-mode specific settingsenabled
Enable vim keybinds when the list view is in focus. This will mess with the "find item via pressing the first letter of its name" feature every windows ui has built-in.list_up
Keybind to go uplist_down
Keybind to go downhalf_viewport_up
Keybind to go up half a viewporthalf_viewport_down
Keybind to go down half a viewportbot
Keybind to go to the bottom of the list view (This emulates a bunch of keypresses which makes it rather slow)top
Keybind to go to the top of the list view (This too)open_explorer
Keybind to open explorer at the selected itemedit_file
Keybind to execute theintegrations/editcmd
command on the selected itemyank_path
Keybind to copy ("yank" in vim terminology) the item's pathyank_name
Keybind to copy the item's name
To change any of the config's values, just change them! The config files are located under ./config/
.
- Spear will try to decode two different files based on if they exist or not
config.json
Your personal configconfig_default.json
Fallback default config- If the fallback config is loaded you'll get a message telling you
If both the files don't exist, the process will exit with an error.
(Note: There is no config-validation other than your config file must be syntactically correct json. If you mess with some values and it doesn't work that's on you).
- Spear's config system would not have been possible without GroggyOtter's amazing JSON library: jsongo.ahk
- I also used another one of GroggyOtter's libraries during development: Peep.ahk
Thank you for your dedication to the AHK-Community.
- An in-app config menu! (Needs some more redesigning as of right now)
Thank you for checking out my project, hope you like it!
- 28.03.2024 - (issue #1) Fixed explorer integration not working in library directories eg. "Documents", "Photos", "Desktop", ...