Entries from December 2002 ↓
December 30th, 2002 — Vim
Cursor movement in most editors (ed users can stop now) is
a fundamental operation. In Vim (and old vi) cursor movement commands can be
used in combination with other commands.
Most users know that dd deletes a line, but many do not know that it
is actually a simplified form of the d command that deletes whatever
you define with a cursor movement operation. I’ll explain with examples:
- l (and the right-arrow key) moves one character right, so
dl deletes the character under the cursor (since the cursor
position is actually the left hand edge of the visible cursor), but
x also deletes to same character, so use that instead;
- w moves to the start of the next word, so dw
deletes to the start of the next word;
- ^ moves to the start of the line, so d^
deletes to the start of the line;
- $ moves to the end of the line, so d$
deletes to the end of the line, but D also deletes to the end
of the line, so use that instead;
- G moves to the end of the file, so dG
deletes to the end of the file;
- { and } move back and forward paragraphs, so d{
deletes a paragraph backwards and d} deletes a paragraph
forwards;
- t moves forward (within a line) until it finds a character
you specify, so tp will move forward until it finds
a p (it won’t move if there is no p), so dtp
will delete up to the p;
- ‘ moves to the start of the line containing the mark you
specify (you do know how to make marks, don’t
you?) and ` moves to the actual mark position, so d’a
will delete to the start of the line you marked with a and
d`o will delete to the o mark;
There are too many other cursor movement commands for me to show, and there
are many other commands that can use them. Of these, my next 2 favourites are
y and =. y is the copy equivalent to the
cut of d, and I’m assuming you know that p is
paste. = is the smart indent command.
December 27th, 2002 — Vim
Making marks in Vim (and old vi) allow you to find particular places in your
file without having to scroll or remember line numbers: just remember a letter.
For example, typing ma will mark your current position with the
a mark; you won’t see anything, but Vim will remember. Now move
somewhere else in your file and type mb to mark it as b (or
replace b with your favourite letter).
Once you have marked positions, you can jump to them: ‘a will jump
to the start of the line you marked with a and `b will jump to
the exact position you marked with b.
December 14th, 2002 — GNU/Linux
Our new server has PXE support to boot from scratch from the network, so
I decided to try to install Debian with it. I didn’t just do this for fun
(it wasn’t much fun): the new server had a gigabit ethernet card
that wasn’t supported by my usual Debian network boot CD.
I started with syslinux, as it
includes pxelinux and lots of helpful documentation. I choose
atftpd for my TFTP server since its author (Jean-Pierre Lefebvre) wrote
it to use with pxelinux.
I wanted to use udhcpd as the DHCP server because I liked
udhcpc, but the client machine didn’t seem to like it: it seems that PXE
might use some non-standard DHCP features. So, I used ISC dhcpd3, and it
worked. But that was another surprise: it worked even though the DHCP port was being
filtered by the local firewall! I assume this is becuase dhcpd3 uses the packet
protocol to bypass the normal protocol stack. That’s also why it requires
packet socket and socket filtering to be compiled into the kernel. I don’t like
it, but it works.
December 4th, 2002 —
I don’t post to this blog as frequently as I would like. There are many
reasons why, but there is now 1 less than before.
I didn’t like editing in the browser, and I didn’t want to edit offline and
then cut’n'paste. What I wanted was to be able to edit offline and then simply
upload the finished file whenever I next connected. So, I wrote a short Perl
script to do that for me, and this entry is my test case.
December 3rd, 2002 —
I haven’t been replaced, but Simon is using my chair and desk. He can drink my tea as well, if he wants.