Handling NERDTree when Vim starts up

The NERDTree plugin is great for making Vim feel more like an IDE but it can really get in the way if you have it enabled all the time. Especially if vi is your default editor on an Ubuntu system. So adding this to your vimrc file looks like a good solution. Only open the file browser if no file name is specified on the command line:

autocmd VimEnter * if !argc() | NERDTree | endif

Source – http://stackoverflow.com/questions/1447334/how-do-you-add-nerdtree-to-your-vimrc

Getting database model code using peewee’s pwiz

One of the great things I love about peewee is it’s ability to generate a Python database model from an existing database:

C:\Users\joel\git>python -m pwiz -e mysql -u root -P vagrant -H -p 13306 test_1 -t coa

from peewee import *

database = MySQLDatabase('test_1', **{'host': '', 'password': 'va
grant', 'port': 13306, 'user': 'root'})

class UnknownField(object):

class BaseModel(Model):
class Meta:
database = database

class Coa(BaseModel):
account = CharField(db_column='Account', null=True)
accountno = CharField(db_column='AccountNo', null=True)
activestatus = CharField(db_column='ActiveStatus', null=True)
banknonote = CharField(db_column='BankNoNote', null=True)
job = IntegerField(db_column='job_id', null=True)
code = CharField(db_column='Code', null=True)
description = CharField(db_column='Description', null=True)
taxline = CharField(db_column='TaxLine', null=True)
type = CharField(db_column='Type', null=True)

class Meta:
db_table = 'coa'