I just discovered a way to use templates in Vim where when I create a file, depending on the extension of the file, the boilerplate text that should always be there will be there.
You can find out how to do this from the Vim Recipe book, in particular this page: http://vim.runpaint.org/typing/using-templates/
Tags: templates
The most attractive feature that VI has to offer is the block visual mode. It is amazingly powerful, especially for those who do coding. With it you can add characters to or remove characters a block of text in a column fashion. For example, you can add characters to a block of text (Figure 1) instantly (Figure 2).

Figure 1

Figure 2
Of course, with power comes complexity. It’s something meant for users whose keyboard (shortcut) dexterity surpasses that of the mouse.
Tags: block, vertical edit, visual
Some of the commands that you use for every session can be placed in a file named “.vimrc” in your home folder.
Personally, when editing code, I like to have my tabs to be of 4 characters wide. I also want the tab characters to be changed to 4 spaces. So in my .vimrc file, I place the following lines:
set smartindent set tabstop=4 set shiftwidth=4 set expandtab
I can then code and have the next line auto-indented. (There is another option called autoindent but it is not as good as smartindent.)
With the options set, the lines can also be indented in command mode or visual mode with the characters >> (shift dot key twice) and un-indented with << (shift comma key twice).
Tags: indentation, vimrc
More on VI…
H – position the cursor at the top of the screen (left most position)
M – position the cursor in the middle of the screen (left most position)
L – position the cursor in the bottom of the screen (left most position)
G – position the cursor at the bottom of the file (left most position); last line in file
gg – position the cursor at the top of the file (left most position); first line in file
:n – position the cursor at line n of the file
Tags: positioning
This is a one of many mini-posts that I will do on using the VI editor. I’ve recently bumped into some pages that contains valuable information on how to use VI. The problem with it is its too wordy and that makes it hard to look for information when you need it.
So this post and the following ones will use tags relevant to the subject to help the search for relevant information quicker.
D – delete the characters of the line after the cursor position
C – delete the characters of the line after the cursor position and change to insert mode
R – change to insert & overwrite mode; it’s like pressing the Ins key on the keyboard; whereas ‘r’ replaces a single character, ‘R’ replaces every character that you type over
s – behaves like ‘x’ but switches to insert mode
S – deletes the whole line and change to insert mode
Tags: delete, substitute, tips
Finally, I’ve started on the follow-up post on Zend Framework Unit Testing (link to previous post)! After a whooping four months. I’ve been really busy – perhaps with the wrong reason. Anyway, this post shall follow up on the previous post by continuing on the AllTests.php file that was created at the end of the last post.
Readers who are first time users of Zend Framework should find this and the last post helpful in getting your feet wet with unit testing with Zend Test. The focus of this post is on preparing the setup and teardown phases of the testing sequence.
(more…)
Frequent Linux users who dual boot their machines with Linux and Windows will inevitably find their GRUB boot loader corrupted at some point in time. This post will help you restore your GRUB boot loader.
(more…)
This post describes how to set up automated testing with Zend Test and PHPUnit. The latter is a unit testing package for PHP applications done in PHP. I had searched for posts on how to do this but there weren’t any easy-to-understand or straightforward examples to follow, so I decided to write one myself. This post will thus be written in a way that newbies are able to get a test working straight away by following the examples in this article. After reviewing the length of the post, I decided to break this article into several smaller ones that are much easier to digest. It’ll be easier for you to get to specific information with smaller articles rather than a large one as well.
I hope this post will help some newbie down the road. Bear in mind that I’m no expert on this – only enough to get it working (and maybe to screw up, which I hope doesn’t happen.) So if I make any mistakes, please point them out and I will make amendments where necessary. If you have something to ask or simply want to share, please comment at the end of the post. Hope you find the following useful!
(more…)
Tags: phpunit, testing, unit testing, zend, zf
This post describes how you can perform text field auto-completion with Zend Framework (ZF) and jQuery. To make full use of this post, you will need to have a working knowledge of Zend Framework and of jQuery. You don’t need to be an expert at using them though cos if you do, you probably won’t be reading this post. Here goes.
The basic assumptions here are that you’ve got your application running on the Zend Framework already and that your jQuery script is placed in the right place which means all your view scripts can access jQuery code.
(more…)
Tags: ajax, autocomplete, javascript, jquery, zend, zf