WordPress

I got tired of maintaining (or failing to maintain, as was more often the case) my custom CMS/blogging tool that was the previous core of nerd.cx, and so I switched to WordPress. It seems pretty good, I can hack on it if I need to, and I’m generally happy with the ability to pull my content back out. The community is also quite active, so there is less chance of getting stuck with something stagnant, which is always important.

Down with Caps Lock!

The Caps Lock key does me no good at all, but I use Esc constantly as a vim user. So, I set about making the Caps Lock key a second Esc.

On Linux, I used the xmodmap command (because I spend all my time in X – the console is not necessary) in my .xinitrc file like so:

xmodmap -e "remove lock = Caps_Lock"
xmodmap -e "keycode 66 = Escape"

Because I am shackled to a Windows box day after day, I also wanted to make this work in that environment, and luckily, I can. It just took a brave bit of registry editing, like so:

REGEDIT4
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlKeyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,01,00,3a,00,00,00,00,00

It makes a huge difference to not have to reach for the Esc key all the time, but it makes it so easy that I keep shifting into command mode while typing in Word. A small price, especially since I realize I’m happiest writing in vim anyway.

vimrc

" Set settings
set autoindent
set title
"set notitle
set ruler
set nocompatible
set showcmd
set ts=2
set shiftwidth=2
set expandtab
set shiftround
set smarttab
set tw=72
set backspace=indent,eol,start
set incsearch
set showmatch
set pastetoggle=<F11>
filetype plugin on
syntax on
colors ron
let mapleader=","

" Remember where I last edited a file
set viminfo='10,"100,:20,%,n~/.viminfo
    au BufReadPost * if line("'"") > 0|if line("'"") <= line("$")|exe("norm '"")|else|exe "norm $"|endif|endif

if &term =~ "xterm-debian" || &term =~ "xterm-xfree86" || &term =~ "Eterm"
  set t_Co=16
  set t_Sf=^[[3%dm
  set t_Sb=^[[4%dm
endif
" Settings set

" Map mappings
:inoremap ( ()<ESC>i
:inoremap [ []<ESC>i
:inoremap " ""<ESC>i
:inoremap { {}<ESC>i
:inoremap < <><ESC>i

"map W :!aspell -c -x % " old - vim7 has spellcheck now
map F gqap

" http://vim.sourceforge.net/tips/tip.php?tip_id=465
" make an element out of anything you type with a CR in the middle
inoremap ,,, <esc>diwi<<esc>pa><cr></<esc>pa><esc>kA

" Fix common typos
iab teh the
iab hte the
iab adn and
iab nad and
iab taht that
iab htat that
iab fo of
iab ot to
iab wiht with

set pastetoggle=<F10>

" SmartTab wrapper
function! SmartTab()
  let col = col('.') - 1
  if !col || getline('.')[col - 1] !~ 'k'
    return "<tab>"
  else
    return "<c-p>"
  endif
endfunction

" turn on SmartTabs
inoremap <tab> <c-r>=SmartTab()<cr>

" Turn on the spellcheck
setlocal spell spelllang=en_us
set spellfile=~/.vimspell.utf8.add

" Mappings mapped

" Language-specific skeleton files
" Perl
autocmd BufNewFile *.pl 0r ~/.vim/skel/skel.pl
" HTML
autocmd BufNewFile *.html 0r ~/.vim/skel/skel.html
" Python
autocmd BufNewFile *.py 0r ~/.vim/skel/skel.py