Sunday, October 23, 2005

Trial #2

Tryin' to post by email.. ! Is it really so powerful ?

Vim and phpm

I've been using linux for a few years, and since the first time I installed it on my computer I learned using VIM. Its name stands for VI iMproved, and it is a very powerful editor, especially for programmers. Often I find myself seeking on www.php.net for php functions prototypes, I can't always remember them all: so, surfing some blogs I found this useful "vim extension", phpm. What's that ?

phpm is a little command line tool that uses a XML file that stores php function prototypes, returning it when you run the command this way:

$ phpm <part_of_function_name>


- how to install it

· download the package http://eide.org/files/phpm/phpm_0-3.tar.gz, untar it;
· edit phpm/phpm file (bash script), and replace the second line with a path where you have write permission (i.e. $HOME/phpm/phpm);
· download the xml pack (from the same site), untar it where you like;
· edit phpm/settings.xml, at line 27 change the "install path" to the path where you untar'd the xml pack;
· add the next line at the end of your $HOME/.vimrc (vim initialization file):

inoremap <C-H> <ESC>:!phpm <C-R>=expand("<cword>")<CR><CR>


all done :)

from now on, where you're writing a function name in a vim session, simply press CTRL+H when the cursor is on the function name string, and the function prototype will appear in a vim shell window.


final considerations:

phpm is a useful tool, the integration with vim is easy. The solution here provided ("stolen" around the web) is good, but I think it'd be better if the function prototype appeared on the same vim editor windows, and not in a "Hit ENTER or type command to continue" shell window. For example, it could be written on a sort of status bar in the main vim window: I think that's possibile and easy to realize, I think a bit of hack on the vim resource file will do the trick. I'll let you know.

Update:

I'm starting to understand vimrc syntax, and the next line makes the php function prototype on the window statusline. I think now phpm vim integration is nicer than the example reported above in this post:

inoremap <C-H><ESC>:let phpm=system("phpm ".expand("<cword>"))<CR><ESC>:set statusline=%{phpm}<CR><ESC>i

Thursday, October 20, 2005

First try

trial #1..
some dummy text here.

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

ehm. this is not so latin as I thought. I think they should revisit their "lorem ipsum dolor generator"