How to show line numbers in Vim for use with terminal and servers

Why it’s taken me quite this long to decide I actually really want to just see line numbers in VIM on one or all of my live servers I have no idea.

I think it’s mainly because out of lazyness when an apps in development I have got into the habit of using “mate” (Textmate’s CLI) instead.

Needless to say to enable line numbers in vim, for use with any installation of vim be it server or local machine is really easy.

Open up a terminal (connect to your server if your doing it to remote) once ready type:-

vim ~/.vimrc

Hit “i” for insert mode and enter “set number”.

Now esc – :wq to save and quit and that’s it.

Line numbers will now show in your next document opened by vim.

Rsync folder from one server to another

Incredibly useful function that i’ve been using alot today to help move clients sites into a new server setup quickly using rysnc.

rsync is a software application and network protocol for Unix-like and Windows systems that synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate (thanks Wikipedia).

rsync -avz -e ssh username@yourotherserver:/pathto/domain/html/wp-content/plugins .

In this case I rsync the plugins folder into the current working directory (make sure if your copying and pasting this command to CD into the right folder first before running).

Trust me this will save you time!

How to add a new vhost with mamp on mac osx

Adding a new vhost is something I have to do on a regular basis when working on new projects locally.
Its a fairly straight forward task as well.

Download and install:- MAMP

Once you have done this navigate either with a finder window or via terminal to /Applications/MAMP/htdocs/

Once here create a folder again either with finder or terminal e.g mkdir myfirstsite

cd myfirstsite – to enter that folder and create another folder: mkdir http

Lets also add a test landing page so add a file called index.html into your http directory either in finder window or just by the following command in terminal.

Cd /Applications/MAMP/htdocs/myfirstsite/http/
vim index.html
hit ‘i’ to insert
type “Hello this is my first site”
hit escape-key + type ‘:wq’

Now we want to do 2 things, firstly add the virtual host to the httpd.conf file:

Navigate to: cd /Applications/MAMP/conf/apache/httpd.conf

Once here either open the text file in a text editor or simply enter it with: vim httpd.conf in terminal if your familiar with this method.

Scroll the very bottom and add the following:

DocumentRoot /Applications/MAMP/htdocs/myfirstsite/http
ServerName myfirstsite

Then secondly you need to add the site to the your local OS X machines host file with the following command via terminal window only.

printf “” | sudo tee -a /etc/hosts

After that restart MAMP by ‘stop servers’ and then start servers option.

Then open up your browser pop into the address bar:- http://myfirstsite:8888/ and with any luck you’ll be on your way.

Twitter versus Facebook

As the tides start to rise and more and more people are jumping on there surf boards and heading to the land of Twitter, I ask myself the question “why?” and again “why?”. How does a site which comprises of the most tiny amount of coding possible, get so big? To be honest who knows exactly how they managed to do it, alot of people think its down to celebrities taking it under its wing and promoting it through use.

What is for certain though is it has become a viral internet phenomon in the last few months. Maybe its the querkyness of “twittering” in the rather sort of “sad” way. Or maybe its the less intrusive style of keeping up to date with what your friends, favourite celebs or favourite businesses / entertainment are up to.

In my opinion there is little to no comparison between the two sites in terms of useability and technical expertise expended in development. Facebook is by far the more powerful tool and has hugely developed since hatching from its first embryo years back.

Despite that these two large social networking sites look set to continually grow and are perhaps heading for a full on confrontation?

The other big question is, does twitter currently make much money? Yes it has alot of users, but how does it try to monetise the fact that it does. Amid reports google are interested in buying Twitter, however they have refused to speculate as at current twitter has little to no monetising on its site.

Who will win the war of the social networks? We will see in the coming months.

TwitterFacebook | The Choice is yours!