Thursday, December 20, 2007

Vim modelines

Regularly I've wondered why vim modeline settings don't take effect when they're embeded in a file.

Historically modelines have opened up vim to security exploits, so the default is for modeline parsing to be disabled. You can check the status in vim with

:set modeline? modelines?
nomodeline
modelines=0


This is the default setting and can be overridden in your ~/.vimrc file like this

:set modeline modelines=20


Now a modeline appearing in a file will be parsed, so something I find useful for python scripts is:

# vim:ts=4:sw=4:sts=4:expandtab

Tuesday, December 4, 2007

mkfs.xfs tweaks

A couple of tweaks I'm using these days for XFS are:

mkfs.xfs -l size=64m /dev/md3


And in /etc/fstab mount the partition with the following options:

/dev/md3    /srv    xfs    noatime,nodiratime,logbufs=8    0 0


For a discussion of why these options see the bearded man.

Screen and backspace

Aarrrgghh! The backspace in screen doesn't work out of the box!

It's really simple to fix, but rather annoying. I'm using Debian and Ubuntu and SSH to my boxes from OSX.

The steps to clean this are:

echo 'bindkey ^? stuff ^H' >> /etc/screenrc


You may also want to know you're in screen from the prompt. Add this to the beginning of your PS1:

$(test $TERM == 'screen' && echo '{screen}')


Finally, if you have a PROMPT_COMMAND variable, you may want that to be run from within screen too.