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.jsonand 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
.pngimage 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! tfxwould successfully findthe-file.txtsince all the characters are contained and appear in the right orderxftwould not findthe-file.txtsince there's nofafter thexmeaning 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
ignorewhitespaceconfig 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
.mp3this 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.txtany 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
directorytogether 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+LOpen the UI with explorer integration if enabled -
LCtrl+LWin+KOpen the UI without explorer integration, regardless of your config -
LCtrl+FFocus the search input -
LCtrl+MToggle path matching on the fly -
Clicking
LButtonCopy filepath to system clipboardLCtrl+LButtonOpen entry in Explorer. This can be changed in the configLAlt+LButtonExecute the command set in the config with{}being replaced with the file's pathClear CacheThis will clear all the cached files and directories to give the used memory back to the operating systemRefresh CacheThis 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 DirSelect 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.
-
EscHide 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.
listviewlimitHow many items the list view can display at a timeshowfulldirShow the full directory of the item or just the last part of itautoclearAutomatically clear the UI upon hiding itdollarsuffixisendswithSuffixing your input with$makes the search algorithm look for suffixes insteadqmsoffixiscontainsSuffixing your input with?makes the search algorithm look for containment insteadignorewhitespaceIgnore the white space in your input.Test File.txtwill be equal toTestFile.txtif set to truehideafteruiinteractionHide the UI after interacting with itmatchignorecaseIgnore whether any input's characters are uppercase or lowercase when filteringbasedirStarting directorymatchpathIncorperate the path to the file in the filtering processintegrationsIntegration specific settingsexplorerEnable the explorer integrationeditcmdThe command to be executed when opening a file from the UI's list viaLAlt+LButtonorfin Vim-Mode
nativeNative library specific settingsmaxitemsforautoupdateMaximum amount of items to automatically filter and update the list while typing making it feel "realtime"autofreebufferAutomatically free the buffer and release the memoryautofreetimeoutThe time (seconds)Spearmust be in idle (no user-interaction) to automatically free the buffers
vimList Vim-mode specific settingsenabledEnable 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_upKeybind to go uplist_downKeybind to go downhalf_viewport_upKeybind to go up half a viewporthalf_viewport_downKeybind to go down half a viewportbotKeybind to go to the bottom of the list view (This emulates a bunch of keypresses which makes it rather slow)topKeybind to go to the top of the list view (This too)open_explorerKeybind to open explorer at the selected itemedit_fileKeybind to execute theintegrations/editcmdcommand on the selected itemyank_pathKeybind to copy ("yank" in vim terminology) the item's pathyank_nameKeybind 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.jsonYour personal configconfig_default.jsonFallback 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", ...
