Archive for April, 2009

F1 in vim

April 30, 2009

When typing quickly in vim I tend to hit F1 instead of Escape, at least on my Asus EEE 1000HA.

gnome-terminal catches the F1 before vim does, so it loads the manual.. how annoying. I never want to read that anyways, and it causes a bunch of hard disk reads. So I disabled it in gnome-terminal in Edit/Keyboard Shortcuts…

Then vim receives the F1. I don’t want to see Vim help either, so.. shove this in your .vimrc:
map <F1> <Esc>
imap <F1> <Esc>

yes, you need both.

This epic accomplishment (or lack thereof), like the previous post, deserved its own post.

Advertisements

LaTeX and work efficiency

April 30, 2009

I blame LaTeX for making me spend 3-4 days on this presentation. But that’s what it’s for, right?

It even deserved its own blogpost..

vim-latex and the beamer LaTeX presentation class, among other vim-latexey things

April 29, 2009

the norm is to compile beamer presentations with pdflatex. this wasn’t good enough for me, since I wanted to compile using vim-latex‘s nifty \ll command, while using the .vimrc settings that I use for all other documents. (compiling via the latex, dvips, ps2pdf method.)

if you use \usepackage{lmodern} you can get around the fontsize warnings when compiling beamer class documents with latex. the page labels warning can be dealt with like so:

\documentclass[hyperref={pdfpagelabels=false},xcolor=pst,dvips]{beamer}

the hyperref part deals with the page labels. xcolor and dvips make it so that I can compile with the regular latex (as many times as necessary), dvips, ps2pdf combination. (this is also what I have vim-latex configured to in my .vimrc.)

i have the following stuff in my .vimrc:
let g:Tex_FormatDependency_pdf = 'dvi,ps,pdf'
let g:Tex_CompileRule_ps = 'dvips -Ppdf -o $*.ps $*.dvi'
let g:Tex_CompileRule_pdf = 'ps2pdf $*.ps'
let g:Tex_ViewRule_pdf = 'evince'
let g:Tex_DefaultTargetFormat = 'pdf'
if has('win32')
    let g:Tex_ViewRule_dvi = 'yap'
    let g:Tex_ViewRule_pdf = 'SumatraPDF-TeX'
endif

(yes, I use the same .vimrc for vim and gvim across different Windows and Linux machines.. =D)

the dvips command used to have a -t letter argument, but we don’t want that anymore with presentations. besides, we can specify to use letter paper in the .tex file itself like: \documentclass[letterpaper]{article}.. for some reason this (more proper way) doesn’t seem to be working correctly for me, though.

on Windows I use SumatraPDF-TeX while editing LaTeX documents for its autorefresh features (and random bug fixes.) the rendering isn’t up to my standards, and I actually prefer viewing the .dvi using Yap for most documents, but this will have to do for now.

now, when you want to separate your files so that you have some sort of main.tex and 2 separate .tex files that \input{main.tex}, getting that to work with vim-latex‘s compiling is kinda weird. as with most multi-file projects, you can specify a name.tex.latexmain file that will be compiled when you \ll from another file. (see here for exact mechanics.)

so how do you edit main.tex and have \ll compile a presentation.beamer.tex (the presentation files) and a presentation.article.tex at the same time? I have no idea.

WordPress <code> and escape characters

April 13, 2009

I had to edit my last post over 10 times to get it right.

Within <code> you need to insert non-breaking spaces (&nbsp;) for spaces. WordPress will ignore actual spaces.

To escape a \ you can type &#92; instead. There may be other ways to escape this but \ did not work.

Also, to type &#92; you need to separate the & and the #92; into two <code> segments, so they don’t merge together (but still display properly). So something like this:
<code>&</code><code>#92;</code>

set terminal title when viewing man pages

April 13, 2009

when I view man pages, man/less doesn’t set the terminal title. with a bunch of manpages open on various tabs, I wanted them to be labeled, so I messed around and searched a bit.. I’m using bash, so I put this in my .bashrc and it works!

# when reading man pages, set term title to "man name"
function man()
{
    for i ; do
        command echo -ne "\033]0;man $i\007"
        command man "$i"
    done
}

this (or something like it) is very useful to have!

EDIT: however, this solution is incorrect. it runs “man x” “man y” and “man z” if you say “man x y z“. this approach (which took me at least 2 hours, sadly.. I don’t know bash scripting) is more logical:

# when reading man pages, set term title to "man name"
function man()
{
    echo -ne "\033]0;man $@\007"
    command man "$@"
}

Windows: resolve Ubuntu PC by name

April 5, 2009

My Windows desktop is “ricky” and my Ubuntu laptop is “ricky-eee“. I cannot ping ricky-eee from Windows but if I install the samba package on Ubuntu, it works.

CSL quotas

April 1, 2009

The CSL finally fixed their quota limit system, so people above the limit are having trouble.

You can switch to a non-GUI mode with Ctrl+Alt+F1 and log in to delete some items (Ctrl+Alt+F7 to change back.)

Also, use du -skh to find the disk usage of a certain file or directory including its subdirectories. This will help you find things to clean out.

rwong@pc38:~ $ du -skh ~
181M /home/rwong
rwong@pc38:~ $ du -skh ~/.mozilla
158M /home/rwong/.mozilla

Mozilla is using most of my quota. Ridiculous.