sponsor Vim development Vim logo Vim Book Ad

LocateOpen : Open files without having to supply a path

 script karma  Rating 44/19, Downloaded by 2169    Comments, bugs, improvements  Vim wiki

created by
Ciaran McCreesh
script type
This script is now being maintained by user "yokomizor" on Github. See https://github.com/yokomizor/LocateOpen for updates.

This script uses slocate (or a similar application) to allow the user to open a file without having to enter a path. If multiple files are found the user is given the choice of which file to open.


:LocateEdit somefile.txt
:LocateSplit somefile.txt
:LocateSource somefile.vim
:LocateRead somefile.txt


To enable case insensitive mode:
:let g:locateopen_ignorecase = 1

To disable smart case mode:
:let g:locateopen_smartcase = 0

To enable always prompt mode:
:let g:locateopen_alwaysprompt = 1


You need 'slocate' or a similar application. This probably means that you need to be on Linux, or possibly another Unix-like OS. Most Linux distributions seem to ship with slocate by default, so this probably isn't a problem. This script will almost certainly not work on Windows, sorry.

An up-to-date locate database helps, too. If you find that this script gives out of date information (eg doesn't list some files or still shows old files), you may want to consider putting updatedb on a cron...

Finally, I've not tested on Vim below 6.2.

Possible Todo List:

* Help document
* Less inefficient 'array' handling
install details
Install the .vim file to ~/.vim/plugins/ or your global plugins directory. No post-install configuration should be required, although you may want to edit the script if your distribution uses a strange locate version...

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
locateopen.vim 1.3 2006-01-16 6.0 Ciaran McCreesh Fix rlocate support.
locateopen.vim 1.1 2005-01-11 6.0 Ciaran McCreesh Added :LocateRead
locateopen.vim 0.8.0 2004-01-13 6.0 Ciaran McCreesh * smart case mode
* always prompt mode
* :LocateSource
locateopen.vim 0.6.2 2003-12-18 6.0 Ciaran McCreesh Added case insensitive mode
locateopen.vim 0.6.1 2003-12-14 6.0 Ciaran McCreesh Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo