TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-03-2008, 04:15 PM   #1 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default phpDoc comment generator for vim

Just thought I'd share this for those hardcore Linux vimmers out there, just a little find that has helped me loads.

It generates phpDoc comment documentation for your PHP classses, functions, methods and attributes.

Download Link

Instructions:


Download the script and put it in a place that vim will be able to access it.

next find your .vimrc file, use this if your are unsure:
Code:
example@talkphp$ locate .vimrc
Then add these code lines to it:
Code:
source /path/to/php-doc.vim
imap <C-o> <ESC>:set paste<CR>:exe PhpDoc()<CR>:set nopaste<CR>
Save it and exit the file. In vim speak that's <Esc> :x <CR> or Escape <shift>+; (to make a colon) then press x followed by enter (Carrage Return)

Next whack open a PHP file in vim:
Code:
sketch@talkphp$ vi phpfile.php
Next find the start of the class etc, then (whilst in insert mode) just press <ctrl>+o (lower case O not zero) and bam! there should be a generated phpDoc comment!
You will need to edit it slightly though, for example add variable types and descriptions (vim cant read your mind, yet)

NOTE
: You must be in insert mode inorder for the keymap to work (as its an imap), to change this to function in normal mode, change the imap line in the .vimrc file to:
Code:
map <C-o> :set paste<CR>:exe PhpDoc()<CR>:set nopaste<CR>
Just make sure your out of insert mode etc buy hitting the Escape key a few times (generally a good tip anyway)

NOTE: I did NOT write this script, full credits go to the author: Tobias Schlitt.
More information can be found in the code comments in the 'php-doc.vim' file.

NOTE: sketch@talkphp$ is my attempt at emulating the linux terminal.

Enjoy.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)

Last edited by sketchMedia : 12-23-2008 at 05:03 PM. Reason: Download link now works
sketchMedia is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 08:57 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design