sponsor Vim development Vim logo Vim Book Ad

GetFile : Select and Open a File by typing part of its path.

 script karma  Rating 16/4, Downloaded by 273    Comments, bugs, improvements  Vim wiki

created by
Romain Maurer
script type
This script  caches the content of a part of the filesystem and help retrieves the appropriate file based on a pattern.
It has been heavily inspired by the FindFile plugin. However, this plugin is not limited to filename patterns only as you can type any part of a file path (thus including folders).
The plugin also comes with some options that allow faster search like automatic search 'completion' of folders, case sensitivity, ...
The pattern supports wildcards (* / ?).

It is a 2 step process to use:
    1. cache the files
    2. search through them

This is my first vim script so feel free to give me advices :)

Here is the documentation that you can find inside the script header:

               You can use the following functions:

                 ":GetFileCacheFiles <path>" - Caches the files. Has to be called at least once before a call to ":GetFile".
                 ":GetFileClearCache" - Clear the cache.
                 ":GetFile" - Start searching for a file.

               You may want to add the following lines in your ~/.vimrc file:
               (or whatever shortcut you find suitable)

               "nmap <silent> <unique> fc :GetFileCacheFiles .<CR>"
               "nmap <silent> <unique> ff :GetFile<CR>"

               Once in the "[GetFile]" buffer:
                 Use "<Up>" / "<C-p>" and "<Down>" / "<C-n>" to select a file.
                 "<CR>" opens the selected file. (If no selection done, it opens the first file).
                 "<ESC>" exits the buffer.

               Supported Options that you can specify in your .vimrc file:

                       List of patterns to ignore.
                       Default = ['*.o', '*.pyc', '*/tmp/*', '*~', '*/.svn/*', '*#']

                       Do not take case into account when searching files.
                       Default = 0

                       Speeds up the search when searching through folders as
                       typing '/' is equivalent to typing '*/'.
                       There are 3 possible values:
                           0: do not use this option
                           1: auto complete the current folder only. (match till
                           the next '/' only)
                           2: auto complete the entire sub hierarchy. (match
                           till the last possible '/')
                       Default = 1

               Example of how to set an option in you .vimrc file:
                   "let g:GetFileAutoFillFolder = 2"
install details

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
getfile.vim 1.0.3 2010-05-07 7.0 Romain Maurer 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