Ability to specify from which directory to search (#75)
- This new behavior allows the user to choose to search a directory other than the current directory. If the current token is a directory and it has a trailing slash (e.g.
vim functions/<CURSOR>
), then we assume the user wants to search for files in that directory. - This can be useful when the current directory contains large subdirectories (e.g. on macOS, the home directory contains
~/Library
, which is very large). Moreover, it also allows searching a parent or sibling directory by using../
(e.g.../Downloads/<CURSOR>
). - What's great is that this behavior complements tab completion. When a user wants to access a file in a subdirectory, they may start typing the name of the directory and hit TAB. When tab completion writes out the directory's path, it will already append a trailing slash for the user, allowing the user to quickly execute the search files feature and search for the file in a more narrow scope.
Credits for @kidonng for writing most of the code and @paddor and @imr0 for pushing the idea!