ThingyMaJig

Thingy Ma Jig is the blog of Nicholas Thompson and contains any useful tips, sites and general blog-stuff which are considered interesting or handy!

Connect

LinkedIn GitHub

Topics

announcement 25 apache 3 Apple 1 bash 8 code 7 cool 30 Days Out 8 Dark Basic Pro 4 design 12 doctor who 1 Drupal 74 E4600 1 EOS 400D 3 firefox 2 Flickr 3 free 21 games 5 geek 38 git 2 GreaseMonkey 1 hardware 7 Homebrew 1 How to 37 humour 5 iphone 1 javascript 1 jquery 1 K800i 6 k850i 4 lighttpd 3 linux 33 mac 9 miscellaneous 4 mobile phone 9 music 4 mysql 8 n73 1 n95 1 New Relic 1 Ogre3D 1 OS X 2 performance 3 photos 10 programming 40 Quicksilver 1 review 19 security 3 SEO 6 software 12 svn 2 technology 4 tip 7 tips 10 tv 3 video 3 vim 7 webdev 2 websites 33 wii 1 windows 1 YADS 10

vim

You can find any of my VIM tips</strong> in the list below. After converting to VIM, I decided to catalogue anything useful I learned.

Quick Tip: Drupal Hook Commenting Using Vim

14 November 2011
vim Drupal programming

According to the Drupal Coding Standards for Documenting Hook Implementations, its considered a good practice to quickly chuck a comment before any function which implements a Drupal hook (eg, hook_menu). This helps someone reading your code quickly see that the function is actually linked with a hook in Drupal and isn't just a function in your module to be called directly.

But… Well… The thing is… Does anyone else get bored of writing the following over and over again? I know do…

Vim Tips: Replace 0px with 0

23 June 2009
vim tips programming Drupal

I like little wins. I was just looking through the CSS file for this site and noticed that - for some reason - I'd used 0px instead of 0 a LOT of times. Most values need numbers (10em, 10px, 10% and 10pt are all very difference sizes) however 0 is one of the few valeus which is the same in all cases (0px, 0pt, 0% and 0 are all zero!). This adds up to wasted data and bandwidth; admitedly not a lot, but still Every Little Helps!

So I fired up Vim. Initially, I just did:

Indenting in Vim

27 May 2009
vim linux How to

Ever had that situation where you've enabled :set paste and pasted in hundred of lines of code into vim only to see it all fully left aligned? I just did… And bugger going over each line and manually indenting it! Want know how to indent a visual block of text?

Neat commenting in Vim

12 January 2009
vim programming linux Drupal

I am a bit of a "neat geek" when it comes to coding. Things should be indented neatly and should have well laid out comments! Why? Well… It's easy to do and in 6 months time when you look at your code you will appreciate it! It will also me even more appreciated by another developer in less than 6 months time ;-)

Vim and Drupal Modules

18 August 2008
vim programming linux geek Drupal

I just finished upgrading a server to Ubuntu 8.04 which came with Vim 7.1 rather than 6.3 on the older server. It seems 7.1 does things slightly differently to 6.3.

In 6.3 I could create ~/.vim/filetype.vim and in there define a line as follows:

au BufRead,BufNewFile *.module,*.install,*.theme setf php

However in 7.1, it looks like a line similar to this has to go into ~/.vimrc instead…

Removing trailing spaces with vim

16 July 2008
vim linux Drupal

After recently reading about how great VIM is for the three hundredth and fifty second time (I kept count), I decided to take a look.

It really is quite cool! I've also decided to try to log any cool tips I learn about it. Here is the first which I found after running the coder module on one of my modules (Page Title 2) and it threw hundreds of errors about too many trailing spaces on empty lines.