I have written a replacement command for the C Library Bundle and placed in the C Bundle. Type at least the first letter in the function you want to autocomplete and hit ctrl-M, this will bring up a menu where you can choose which function you want to complete. The completions are stored in the file CLib.txt.gz, add that file to the Support folder in the C Bundle in. The completions where taken from the (now removed) C Library Bundle running the following command in the Snippet folder.
ruby -e "Dir["*"].each do |name| puts open(name).read.match(/content</key>\n\s*<string>(.*)/)[1] end"
if for some reason CLib.txt.gz is to large for the list use that to generate CLib.txt and gzip it.
On Dec 14, 2006, at 2:59 AM, Joachim Mårtensson wrote:
I have written a replacement command for the C Library Bundle and placed in the C Bundle. Type at least the first letter in the function you want to autocomplete and hit ctrl-M, this will bring up a menu where you can choose which function you want to complete.
Great work Joachim! Some comments:
1. ctrl-M might not be the most appropriate combo. In general ctrl-.. combos are reserved for the user to use as they please.
2. Is it possible for the command to have two fall-back options? a) If the current word/selection doesn't match the beginning of the command, then search anywhere in the command name. b) If that doesn't work either, then search in some "keyword list", perhaps in another file containing one line of keywords for each snippet. For starters, this could be taken possibly from the menu structure that the C Library menus were using, for now at least.
3. Is it significantly more efficient to use the gz file instead of the txt file? With the txt file, it would be easier for the user to customize at will. In fact it might be nice to allow for a user- created file with similar format, and the command would then search in that file as well, in which case the original file can be kept at gz state without problems. Then another command would be allowing users to edit this file, kind of like the "Edit Configuration File" command in the LaTeX bundle works.
The completions are stored in the file CLib.txt.gz, add that file to the Support folder in the C Bundle in. The completions where taken from the (now removed) C Library Bundle running the following command in the Snippet folder.
ruby -e "Dir["*"].each do |name| puts open(name).read.match(/content</key>\n\s*<string>(.*)/)[1] end"
if for some reason CLib.txt.gz is to large for the list use that to generate CLib.txt and gzip it.
Haris
Great work Joachim! Some comments:
- ctrl-M might not be the most appropriate combo. In general ctrl-..
combos are reserved for the user to use as they please.
I agree. But since the community has not yet decided on a common completion key-combo, I thought I would use the same combo I used for the Cocoa-completions
- Is it possible for the command to have two fall-back options? a)
If the current word/selection doesn't match the beginning of the command, then search anywhere in the command name.
that could work. I'll note it as a feature request.
b) If that doesn't work either, then search in some "keyword list", perhaps in another file containing one line of keywords for each snippet. For starters, this could be taken possibly from the menu structure that the C Library menus were using, for now at least.
I think that such a feature comes pretty close to documentation lookup and that it should be handled by a separate command, probably using a treelayout with a searchfield.
- Is it significantly more efficient to use the gz file instead of
the txt file? With the txt file, it would be easier for the user to customize at will. In fact it might be nice to allow for a user- created file with similar format, and the command would then search in that file as well, in which case the original file can be kept at gz state without problems. Then another command would be allowing users to edit this file, kind of like the "Edit Configuration File" command in the LaTeX bundle works.
I reused the code from my Cocoa completions command, and there it makes a huge difference in space saving.
Haris
Joachim Mårtensson wrote:
Great work Joachim! Some comments:
- ctrl-M might not be the most appropriate combo. In general ctrl-..
combos are reserved for the user to use as they please.
I agree. But since the community has not yet decided on a common completion key-combo, I thought I would use the same combo I used for the Cocoa-completions
Yes, please remove ⌃M as a key equivalent from any bundle items. Items in the bundle repository should respect the bundle guidelines, and not stomp on users' personal items.