Yii API docs in vim help file format


(Mh) #1

In an attempt to move a step forward with my vim+screen based IDE i spent some time to learn new vim features (you never know them all, right?). Together with some plugins like project and minibufexplorer i soon got pretty close to what i expect from a modern IDE. What i was still missing, though, was quick access to the class reference.

Having a look a the yiic commands that create yii’s online HTML pages, it was quite easy to fork them into a VimApiCommand that created a useful API manual in vim help file format.

To me this is already useful but still misses some fine tuning when it comes e.g. to formatting of the code examples.

I’ll release the files soon, but would like to know first, how many would use them at all.

So if you’re a vim user - show yourself!! :)

I’ve attached a screenshot that shows how it looks like in action.

[size="3"]UPDATE:[/size]

[size="3"][color="#FF0000"]This project is hosted on github now[/color][/size]

https://github.com/m...rtl/yii-api-vim

You find the latest version in the tags section of the github repo.


(Imehesz) #2

MIKE!

God bless you man, I’ve been trying to come up with something smart for VIM for ages (like CTags and stuff).

I use VIM every day and night ;) One of my favorite plugins is NERDTree! Check it out!

http://www.vim.org/scripts/script.php?script_id=1658

–iM

ps: yes, I tried many others (Zend, Aptana, NetBeans, DreamWeaver!, Eclipse+PDT)


(Webshark) #3

I’m trying to migrate from NetBeans to VIM now.

Just saw the yiiframework tweet leading to here.

Mike, I’d love to take a look at the files. if you could make a screencast exposes all the power of Yii+VIM, that’d be just great and highly appreciated by those who is just starting with VIM (at least I’d be very thankful for sure :) ).

Nice shot BTW. THUMBS UP.


(Mh) #4

Heh, thanks for the feedback. Ok, guys gimme some time. I’ll try to fix the formatting for the code examples first.

@imehesz:

Didn’t try NERDtree yet. It’s only recently that i started looking for a replacement for vimcommander which i had used for years. Would you say it’s better than project? I like project as it has some nice features like filters per directory or running a vim script each time you load a file into the buffer (you can also configure that per directory).

@Nemoden:

If you’re new to vim take your time. Look up the keystrokes for the things you need most often and get used to them first. I’m not sure if i could give you much help. Things depend much on your preferences. And there are already lots of screencasts out there. Learning vim takes time, but it’s worth every second!

Shame on me, but even though i’ve been using vim for 14 years now, for a long time i’ve only used the basic commands to move around, split a window and substitute text per regex and do some more simple text editing . With these features you can already be amazingly fast if you can use all your fingers.

Now i find out, that with some additional new key strokes you can get even faster and do more things inside vim. For example don’t miss all the other window commands (they all start with <ctrl>-w). Now that i got used to opening, moving, maximizing and closing windows it’s even more versatile. Understanding buffers makes another huge difference in your everyday work.

vim has really useful features. plenty of them. ;)


(Thyseus) #5

hell yeah! i am an vim-addict for some years now, too. I’m using the minibufexplorer, NerdTREE and ctags/taglist. A vim-optimized help file for Yii’s Classes would be amazing. Can’t wait for your release!, so keep it going

edit: and yes. i also learn new things almost every day!


(Imehesz) #6

Mike,

I’ve been using NERDTree for a while, I haven’t tried the others. I works for me, but, I also learn something new every day :)

–i


(Mh) #7

Here’s a first version.

Please bear with me, this is the first vim help file i ever did. I tried to use the common help file notation (:help notation) but had to "misuse" some markup items. All in all i hope the layout is a good compromise between readability and not wasting too much precious screen space.

[ instructions where moved to top post ]


(Imehesz) #8

hello Mike,

I got it to work! yaaaay

I know there is a way to pull up help(?) by standing on a word and pushing some kind of key-combination. So let’s say I move my cursor to CHtml::activeDropDownList - press the buttons and the help would come up.

Do you know what that combination is?

thx,

–iM


(Mh) #9

Geat to hear that it works for you! :) What about the layout? Any glitches?

Try <shift>+k (See :help K) for help.

I don’t remember why but somewhere i read, you might have to add this:


autocmd BufNewFile,Bufread *.php set keywordprg="help"

But there’s one problem, though: I didn’t really think about this feature, because most of the time i don’t have text like “CGridView::columns” anywhere. That’s why the keywords now use a ‘.’ (dot) as seperator (to save another char). But you made me think. We could have lots of CHtml in the views. So maybe we should change the tag format to “class::property”? What do you think?


(Imehesz) #10

What I run into mostly with CHtml is that "oh, I forgot the parameters OR the order of the parameters, something like that" - so I need something quick. I think this would be very helpful…

The layout seemed fine, but I only played with it a little bit!

–iM


(Mh) #11

Ok, here you go.

Tags are now in this format: CClassname::method

Don’t hesitate if you have more feedback. I wonder wether it makes sense to create an extension for this. But before that it should be tested in real life for some time.


(Imehesz) #12

you mean a VIM extension? - I think so

–iM

ps: thx again for this tool!


(Mh) #13

I was thinking about a Yii extension - but you’re right, maybe better put this on the vim site.

What do you think about inherited properties/methods? I’ve left them out to keep the pages small. So you have to go to the base class (using the inheritance “breadcrumb” on top). Maybe i should still add them as a list of linked tags on top or on bottom?


(Imehesz) #14

the speed is pretty good right now - don’t you think the additional tags would slow it down?

(actually I’m using a netbook most of the time, so my processor is not the fastest :confused: )

–iM


(H Samuels) #15

This is great! I’m about to give it a try and see if I can get it to work.


(Mh) #16

Yes, please let me know of any problems. I’ve been using it for some time now and it works pretty good.

Still wonder, where’s the best place to release them. If someone’s interested: I can also share the build yiic command that i used to create the files.


(Der Coole Carl) #17

Realy great what you did, thank you I give it a try.


(Firepage) #18

Hi Mike,

Thanks a lot for the development, it looks great and I am trying to make it happen on my server and to my development team. Thanks!

NB - I registered the account here just for letting you know there are vim fans behind your work!

Cheers,

Penny


(Mh) #19

Thanks for your feedback - good to know that someone finds it useful, too :)

For those interested: You can also download the command i’ve written to create the docs. It’s a CConsoleCommand for the yiic build script of Yii. See top post.


(Mh) #20

I’ve created an updated version for Yii 1.1.6 and updated the top post accordingly.