[TxMt] FileNameAutoCompletion + AutoCorrection

Hans-Joerg Bibiko bibiko at eva.mpg.de
Fri Jan 12 16:14:02 UTC 2007


Dear all,

Thomas Aylott wrote a nice Filename Completion within the  
Experimental bundle. With this command you can simulate the TAB  
behaviour at the console writing paths or file names.

By myself I prefer to see all suggestions with their real names (not  
only the rest). That's why I wrote my own humble version, and I added  
a nice 'auto correction' function to it.

With 'auto correction' I mean:
Examples:

I type '/Apppli' , invoke the completion, and finally it writes '/ 
Applications/'

or

I type '~/Dyskt' , invoke the completion, and it goes back to the  
first valid path and makes a pull down list of 'Desktop, Documents'


The next thing I changed is that if the completion finds only one  
match it outputs it directly without asking me.
Together with the auto correction the completion makes it easier to  
insert a specific file name with a typo. For instance, I have a file  
at my desktop named 'test3.txt' and I type '~/Desktop/test33.txt' ,  
start the completion, it changes it at once to '~/Desktop/ 
test3.txt' (of course, if you have no other files beginning with  
'test3').

The feature to select a part of the path with the mouse to indicate  
what I want to change is missing in my script, because I'm a keyboard  
person. If I take the mouse to select something, then I also can  
press 'DELETE' before I invoke the completion script.

As default the pull down menu doesn't list files beginning with a  
dot. If you want to see them, then you have to type:

'~/.+' (to see all) or '~/.p' (to see all with a p)

I bound the script to the key CRTL+TAB and the scopes: source.shell,  
string.interpolated.ruby; but here are no limits.


Please check it and don't hesitate to comment my script ;) (Maybe I  
forgot something)

Cheers,

Hans

-------------- next part --------------
A non-text attachment was scrubbed...
Name: FileNameAutoCompletion.tmCommand
Type: application/octet-stream
Size: 3439 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20070112/c6c3525b/attachment.tmCommand>


More information about the textmate mailing list