Difference between revisions of "vim"

Jump to: navigation, search
Line 4: Line 4:
 
to ensure you get powerful use out of vim with moodle development
 
to ensure you get powerful use out of vim with moodle development
  
== Indentation ==
+
== Old Progress Bar ==
Moodle [[Coding|Coding Guidelines]] state that indentation should be spaces of 4 spaces (not Tabs). Some .vimrc options will help you adhere to these guidelines with ease:
 
 
 
 
<pre>
 
<pre>
" insert space characters whenever the tab key is presse
+
function print_progress($done, $total, $updatetime=5, $sleeptime=1, $donetext='')
set expandtab
 
 
 
" insert 4 spaces characters when tab key is pressed
 
set tabstop=4
 
 
 
" insert 4 spaces wen autoindent indents
 
set shiftwidth=4
 
 
 
" automatically indent files
 
set autoindent
 
 
 
" Do smart indentation depending on code syntax (e.g. change after { }, keywords etc)
 
set smartindent
 
 
</pre>
 
</pre>
 +
== OOP Progress Bar ==
  
== Syntax Highlighting ==
+
Usage:
Recent versions of vim have robust syntax highlighting for php. In order to switch syntax highlighting on add the following to your .vimrc:
 
 
<pre>
 
<pre>
" set syntax highliging on
+
set_time_limit(0);
syntax on
+
$pb = new progressbar('bar', 500);
 +
$pb->create();
 +
$num_tasks = 200; // the number of tasks to be completed.
 +
for($cur_task = 0; $cur_task <= $num_tasks; $cur_task++)
 +
{
 +
    for ($i=0; $i<100000; $i++)
 +
    {
 +
        ;;;
 +
    }
 +
    $pb->update_adv($cur_task, $num_tasks, 'this is'. $cur_task . 'h');
 +
}
 +
?>
 +
<hr/>
 +
<?php
 +
$pt = new progressbar('zbar', 900);
 +
$pt->create();
 +
$num_tasks = 200; // the number of tasks to be completed.
 +
for($cur_task = 0; $cur_task <= $num_tasks; $cur_task++)
 +
{
 +
    for ($i=0; $i<100000; $i++)
 +
    {
 +
        ;;;
 +
    }
 +
    $pt->update_adv($cur_task, $num_tasks, 'this is'. $cur_task . 'h');
 +
}
 
</pre>
 
</pre>
 
== Other Useful vimrc settings ==
 
<pre>
 
" show a ruler with line number, % through file on status line
 
set ruler
 
</pre>
 
 
== Ctags ==
 
See the [[ctags|Ctags Article]] for details on how to setup ctags usage with moodle and vim
 

Revision as of 05:05, 22 May 2008

Setting up Vim for Moodle Development

There are many powerful features available in vim, here are a few tips to ensure you get powerful use out of vim with moodle development

Old Progress Bar

function print_progress($done, $total, $updatetime=5, $sleeptime=1, $donetext='')

OOP Progress Bar

Usage:

set_time_limit(0);
$pb = new progressbar('bar', 500);
$pb->create();
$num_tasks = 200; // the number of tasks to be completed.
for($cur_task = 0; $cur_task <= $num_tasks; $cur_task++)
{
    for ($i=0; $i<100000; $i++)
    {
        ;;;
    }
    $pb->update_adv($cur_task, $num_tasks, 'this is'. $cur_task . 'h');
}
?>
<hr/>
<?php
$pt = new progressbar('zbar', 900);
$pt->create();
$num_tasks = 200; // the number of tasks to be completed.
for($cur_task = 0; $cur_task <= $num_tasks; $cur_task++)
{
    for ($i=0; $i<100000; $i++)
    {
        ;;;
    }
    $pt->update_adv($cur_task, $num_tasks, 'this is'. $cur_task . 'h');
}