altfile : easy switching between related files 
 
 
  |  script karma  | 
  
    Rating 1/1,
    Downloaded by 3786   | 
  
   Comments, bugs, improvements 
   | 
  
    Vim wiki
   |   
 
 
 
| created by |  
| Alex Kunin |  
|   |  
| script type |  
| utility |  
|   |  
| description |  
Screenshot: http://altfile.googlecode.com/files/shot1.png
 Project site: http://code.google.com/p/altfile/
 
 -----
 
 Suppose we have a project which resides in a "proj" directory. Content of that directory might look like this:
 
   proj/classes/Class1.php
   proj/classes/Class2.php
   proj/classes/Namespace/Class3.php
   proj/tpl/Class1.html
   proj/tpl/Class2.html
   proj/tpl/Namespace/Class3.html
   proj/tests/Class1.phpt
   proj/tests/Class2.phpt
   proj/tests/Namespace/Class3.phpt
 
 Create "proj/.altfile" and put these lines inside:
 
   class: classes/{MATCH}.php
   template: tpl/{MATCH}.html
   test: tests/{MATCH}.phpt
 
 Now load "proj/classes/Class1.php" and hit the hot key. Menu will
 appear:
 
   class  [template]  test
 
 Now you can use it as any other wild menu: cursor keys, <CR>, <Esc>.
 
 By default previously active item is highilighted (works like Alt-Tab for Windows or Cmd-Tab for Mac OS X). So, to quickly switch between two files all you have to do is <M-Tab><CR>.
 
 Now load "proj/tpl/Class4.html" - it does not exist, and you'll get empty window. Hit <M-Tab>, select "class" and hit <CR> - VIM will create new buffer for (still non-existing) "proj/classes/Class4.php". Ta-dah! Actually, this is my main reason for creating this plugin.
 
 Note that it DOES NOT matter what is your current directory: you can cd to whatever place you want. But it DOES matter where ".altfile" is, becase patterns inside it are relative to its placement.
 
 To show visual file selector hit <F3>. Use movement/cursor keys to highlight a file; <CR> loads file; <Tab> switches between labels.
  |  
|   |  
| install details |  
Copy this file to your ~/.vim/plugin/ folder. Bind some key to AltFile_ShowMenu() and AltFile_ShowSelector():
 
     nmap <expr> <M-Tab> AltFile_ShowMenu()
     nmap <F3> :call AltFile_ShowSelector()<CR>
 
 Make sure that wildmenu is enabled:
 
     set wildmenu |  
|   |  
 
script versions (upload new version)
Click on the package to download.
 
 
        | altfile-0.2a.zip | 
    0.2a | 
    2008-03-01 | 
    7.0 | 
    Alex Kunin | 
    No more ":drop" (i.e. no more GUI dependency). File load/activation code is smarter now. Uncommented forgotten try...catch block. Removed all inline docs, added link to the project site. | 
 
        | altfile-0.2.zip | 
    0.2 | 
    2008-02-26 | 
    7.0 | 
    Alex Kunin | 
    Added visual file selector (resembles BufExplorer; also, some tricks were borrowed from source code of that really nice script).
  | 
 
        | altfile.vim | 
    0.1e | 
    2008-02-22 | 
    7.0 | 
    Alex Kunin | 
    Autoload support and "write-plugin" guidelines (thanks to Thomas Link for advices). Couple of minor bugs fixed.
  | 
 
        | altfile.vim | 
    0.1d | 
    2008-02-19 | 
    7.0 | 
    Alex Kunin | 
    Now wildmenu is used as "engine", so look & feel are much better now. No more numeric shortcats, however. Lots of code cleanup.
  | 
 
        | altfile.vim | 
    0.1c | 
    2008-02-18 | 
    7.0 | 
    Alex Kunin | 
    Default choice now mimics Alt-Tab (Cmd-Tab for Mac users), i.e. hitting the hot key and then <CR> will cycle between last two files. Visual adjustments: current file is square brakets, and asterisk indicates default choice.
  | 
 
        | altfile.vim | 
    0.1b | 
    2008-02-18 | 
    7.0 | 
    Alex Kunin | 
    If selected file is already visible in some window, the script will activate it.
  | 
 
        | altfile.vim | 
    0.1a | 
    2008-02-16 | 
    7.0 | 
    Alex Kunin | 
    When GUI is available, dialog forced to be console-friendly, i.e. no GUI window is poping up.
  | 
 
        | altfile.vim | 
    0.1 | 
    2008-02-16 | 
    7.0 | 
    Alex Kunin | 
    Initial upload | 
 
 
ip used for rating: 142.132.191.50
           |