I noticed that most people think Vim sucks and they constantly perform the following keystrokes

:wq
perl somefile.pl
vim somefile.pl


Here is the first trick, you do not need to exit vim to perform a command. Simply type the following while you are in vim

:!perl somefile.pl


Offcourse, you do not want to type the filename all the time, so you use the following

:!perl %


Now, if you are using a different scripting language it might be more portable to make the file executable (chmod u+x) and make sure the Shebang points to the right interpreter. Your script would be something like the following then

#!/usr/bin/env perl
use strict;
use warnings;
use Socket;


Now all you have to do is type the following in vim and your script will be executed

:!%


I noticed that the :!% trick does not work when your script is in your current working directory. This is how you can make it work

:!./%


I also noticed that before you execute this command you always need to type :w to save the changes. To automate this i have added the following to my ~/.vimrc file

map ,r :w<cr>:!./%</cr><cr>
</cr>


Now all i have to type is the following

,r


For other tricks and hints you have to check out Vi-IMproved.org.