sponsor Vim development Vim logo Vim Book Ad

CreateMenuPath.vim : Create a menu that mirrors a directory tree

 script karma  Rating 26/11, Downloaded by 3209  Comments, bugs, improvements  Vim wiki

created by
Christian J. Robinson
script type
This file provides a function to create a menu that mirrors a directory tree.

CreateMenuPath({path} [, {menu name} [, {menu priority} [, {filename ignore pattern1} [, {filename ignore pattern2} ...]]]])

:call CreateMenuPath('~')   " Creates a menu of your home directory.

:call CreateMenuPath('~/public_html', 'Files.Web\ Page', '600.100', '\c.\(gif\|jpe\=g\|png\|ico\|bmp\|tiff\=\)$')  " Files.Web Page menu, priority 600.100, ignoring some image files.

A default filename ignore pattern is provided which ignores a number of image, audio and archive files, but it's incomplete.

The global variable "CMP_Recurse_Limit" can be set to specify the maximum sub-directory depth to scan.  Set it to 0 (the default) for infinite recursion.  Set it to 1 to scan only the specified directory.
install details
Either :source it or put it in your plugin directory.

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
CreateMenuPath.vim 2.0 2008-05-23 7.0 Christian J. Robinson Update for Vim7:
  - Allow more than one ignore pattern argument
  - Looping over the found files is simpler
CreateMenuPath.vim 1.5 2002-03-15 6.0 Christian J. Robinson - Don't add a / or \ before the glob pattern if it's already there. (Fixes that a path of 'c:' wouldn't work.)
CreateMenuPath.vim 1.4 2002-01-24 6.0 Christian J. Robinson CMP_Recurse_Limit global variable added.
CreateMenuPath.vim 1.3 2002-01-18 6.0 Christian J. Robinson - Use a dummy menu item to prevent a torn off menu from disappearing. (Does not work in the PopUp menu.)
CreateMenuPath.vim 1.2 2002-01-10 6.0 Christian J. Robinson - Rescan menu item didn't work.
- Escape some characters in CD Here menu item.
- Create a ...More menu when the number of menu items exceeds 30, and add shortcut keys.
CreateMenuPath.vim 1.1 2002-01-10 6.0 Christian J. Robinson - Two menu items added:  "CD Here" and "Rescan"
- Clear the menu out before building it.  (Marcin Juszkiewicz)
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.