Now that I have been using it for several months, I have become absolutely dependent upon tmux, the terminal multiplexer.
It is both ruthlessly efficient, and can be configured to match exacting requirements. One of those options is to initialize sessions with a preloaded window configuration. After reading the man page (which, truth be told, could be a little clearer) and some experimentation, I have worked out how to set up my tmux sessions how I want them.
I have just updated the Arch Wiki tmux entry,
so thought I would share it here.
The relevant part of my config file looks like this:
n(){$EDITOR ~/notes/"$*".txt }nls(){ ls -c ~/notes/ | grep "$*"}
Unfortunately, the second function – for retrieving the list of files in
the notes directory has two significant shortcomings — it uses ls1
and it will only list files in the top level directory. If you are an
inverterate note taker, this plainly won’t scale.
My first attempt at hacking a solution yielded this little beauty:
Which removes ls from the function and allows nested directories, but
is needlessly complex and, with four pipes, hideously inefficient
inelegant.
After reading up on Awk, particularly
Bruce Barnett’s primer,
I arrived at something marginally longer but relying solely on the
awesome power of awk to make the various transformations I was seeking…
12
nls(){ tree -CR --noreport ~/.notes | awk '{ if (NF==1) print $1; \else if (NF==2) print $2; else if (NF==3) print " "$3 }' ; }
An added advantage is that it is scalable irrespective of how deep the
directories go. I’m sure that with some more awk-foo I could write a
more effective set of conditionals, but this seemed a pretty good start
for a simple note taking utility.
Updated 3/11/10
To remove a little of the visual clutter, I amended the awk script to
strip the .txt extensions from the output.2
12
nls (){ tree -CR --noreport ~/.notes | awk '{ if ((NR > 1) gsub(/.txt/,"")); \if (NF==1) print $1; else if (NF==2) print $2; else if (NF==3) printf " %s\n", $3 }' ;}
And if you really want this to work well, create your .notes directory
in a dropbox folder and
symlink to it from ~/.notes.
Rather than just download Thunderbird, you can always install something a little more interesting that will a) provide hours of fun setting up and configuring so that it works exactly the way you want it to, and b) will free you of the rodent…
Mutt - a small but very powerful text-based mail client for Unix operating systems. Eminently extensible and configurable. mutt + imap + gmail ftw!
Alpine - based on the Pine® Message System. Not as intimidating for the novice as mutt…
Sup - a console-based email client for people with a lot of email. “The goal of Sup is to become the email client of choice for nerds everywhere”
Notmuch - an answer to Sup. Still in the early stages of development, there are two user interfaces available for it, one for vim and one for those poor benighted souls still using emacs…
Cone - a screen-oriented E-mail/News reader and writer. Cone contains an experimental implementation of a new remote mail access protocol, SMAP