My Good Easy from 2002 is interesting reading, if only to see how little I’ve changed over the years. I still obsessively prune my Start menu, I still set my home page to about:blank, I still use Emacs locally and vi remotely. In fact, my .emacs file has stayed virtually unchanged for seven years on three platforms and a dozen different Linux distributions. It’s true that you can spend a lot of time editing configuration files, but most people don’t realize how portable they are and how long they remain useful. The cost of customizability is amortized over years, not months. The cost of setting up a new workstation is near-zero.

Now that I’m using Linux full-time, I thought I’d share some of my other current configuration files.

~/.xinitrc runs the ratpoison window manager when I start X. Ratpoison is a minimalist window manager with no window borders, no title bars, no panels, no docks, no menus, no icons, no eye candy, and no mouse commands of any kind. All keyboard commands are prefixed by a special key to minimize application conflicts. Naturally the default prefix key (Ctrl-T) conflicts with a command I use constantly (”open new tab” in Firefox/Iceweasel), but you can change it in .ratpoisonrc (below). Of course the mouse still works in applications, if you need it.

[~/.xinitrc]

Did I mention Ratpoison is minimalist? It’s also configurable. ~/.ratpoisonrc configures ratpoison the way I like it.

[~/.ratpoisonrc]

Ctrl-Space gives me a ratpoison input line to run arbitrary programs; PrintScreen does what I expect (GNOME users install ksnapshot now, you’re missing out); Ctrl-Alt-arrows switch between frames if I have multiple frames open. F12 runs ~/bin/f12, a little script I whipped up to make urxvt act like tilda or yakuake. I want to be able to press F12 to toggle a full-screen terminal session (with screen, see below).

[~/bin/f12]

Of course that window-finding algorithm relies on the fact that the terminal window always starts with “urxvt” regardless of what’s going on inside the terminal. I use zsh as my primary shell, and I define functions in .zshrc to ensure the terminal window is always findable.

[~/.zshrc]

most is the best pager ever. Install it now. It has Emacs-style key bindings and displays man pages in color. less is better than more, but most is better than both.

My .zshrc integrates with screen to dynamically set the caption of each “tab” in screen based on what’s being executed in that tab. The preexec and precmd functions handle setting the caption, then my .screenrc displays them in a caption bar that is always showing on the last line of the terminal window. There is no way to do this properly in Bash. zsh has a reputation for being bloated and slow, but who cares? It’s 2007. I have a 3 GHz processor. Two of them, in fact. zsh can autocomplete apt-get/aptitude queries. It can dynamically set captions in screen. It can do mindblowing things like autocomplete pathnames over ssh. I can’t begin to describe how useful that is.

[~/.screenrc]

There’s a nice symmetry in using my left ring finger to hit the prefix key in screen and my right ring finder to hit the prefix key in ratpoison. I tried blackslash instead of Pause, but it made Python programming hell.

~/bin/nowplaying is a quick script to display the artist/title of the song currently playing in MPD (Music Player Daemon), which I can control with ncmpc, which is automatically opened with a new screen. If nothing is playing, it displays the hostname instead, which is especially useful when ssh’ing into the screen session over the network. My mpd.conf is nothing special, so I’ll skip it.

[~/bin/nowplaying]

Ratpoison takes care of maximizing the terminal window and trimming off the window borders, but I still want urxvt to fill the screen, with a nice font, readable line spacing, and no scroll bar (since I’m always inside screen which implements its own per-tab backscroll). ~/.Xresources takes care of that.

[~/.Xresources]

That also takes care of customizing Emacs’ appearence in X. Sometimes I run it within screen, depending on the nature of my edits. And it’s set as the EDITOR in my .zshrc, so it gets used for quick edits like crontabs. Putting appearance-related configuration in .Xresources ensures that these tweaks only apply to Emacs-in-X, not Emacs-in-terminal.

§

Thirty four comments here (latest comments)

  1. Holy crap. I didn’t think there was a human alive that could switch between emacs and vi regularly and voluntarily.

    Proof that Mark Pilgrim has two brains.

    — DeWitt Clinton #

  2. Nice one Mark. I’ve added up mine too.

    1:59 AM Neil: I feel a seminal blog post coming where you talk about config files and a thousand people flock to read it. If I did that the only comment I’d get would be from my sister asking what the fuck it all means!

    I was right :-)

    — Neil Dunn #

  3. `sudo update-alternatives –config pager`, sir yes sir. Not too convinced by KSnapshot (I’m anal-retentive, I post process my screenshots in GIMP anyway); also, Bash *can* complete dirs over SSH, but I’ll give zsh a try one day (same for ratpoison).

    Use ThinkPads, you’ll get your mouse in the middle of the keyboard!

    — Shot #

  4. zsh can autocomplete apt-get/aptitude queries.

    bash too.

    It can dynamically set captions in screen.

    bash too, apparently.

    It can do mindblowing things like autocomplete pathnames over ssh.

    bash too.

    zsh has a reputation for being bloated and slow, but who cares?

    bash too :-)

    — saharvetes #

  5. How about some screenshots? :)

    — André Cruz #

  6. Proof that the Linux Desktop (KDE/Gnome) is dead with a WM like ratpoison. ;)

    I’ve been using dwm as my bloat-free desktop WM. Though you need to compile dwm to configure it.

    I’m stealing some stuff of your .screenrc and putting into my configs. I would like to try zsh, though I am happy with bash.

    I recommend `scrot` for screenshots. I use `feh` for a bg image if I want one and for general image viewing.

    Good to see you here Mark. Best wishes,

    — Kai Hendry #

  7. skippy dot net » QOTD: most (pingback)
  8. Btw, it’s technically better to write the conditionals in your F12 script like so:

    if ratpoison -c info | grep -c $foo 2>&- ; then
        ...
    fi

    That avoids spawning an extra subshell on each and every if.

    Although this is so long that I’d write a function for it:

    have_window() { ratpoison -c info | grep -c "$@" 2>&- ; }
     
    if have_window $foo ; then
        ...
    fi

    PS.: be nice if your typographic smartening doodad skipped the contents of <code> tags…

    — Aristotle Pagaltzis #

  9. The escape codes in your .zshrc have invalidated your feed.

    — Anonymous #

  10. FYI, the escape codes in your .zshrc have invalidated your feed.

    — random passerby #

  11. Fucking Wordpress.

    — Mark #

  12. Not just yet, Mark

    — Arthur #

  13. Another (generally) non-tiled window fan here too, using dwm here running on Xorg/FreeBSD. Two thumbs up for your comment on the usable lifespan of config customization for *nix apps - amortizing all that fiddling makes it dirt cheap.

    dwm appealed to me more than its predecessor wmii which I used and it appealed to me more than ratpoison and other similar wms. Might have been the default keybindings, or window handling - can’t remember why now. Suspect it was the way wmii stacked windows initially but I grew frustrated with its slavish devotion to plan9 style configuration mechanics. dwm you edit a config.h and that’s it.

    My dwm - vim style keybindings for moving around windows, moving windows. Zoom any terminal window with alt-space alt-enter. Handles floating windows well enough. Status line simply based on dwm’s stdin, so hack up a script in anything - I’ve got a small python script putting mpd | sysload | date time together.

    Editing config.h for keybindings and the 5 second recompile and install works for me; most often a `pull` and `update` from dwm’s Mercurial repository and make install just-works. Thoughtful improvements continuously noted over the past year.

    DWM is not xinerama capable on purpose, so I run dwm on two displays and xwarppointer assigned to ctrl-\ to flip screens.

    — Mike #

  14. How do you manage to use Emacs effectively with your window manager stealing Control-space? Do you bind M-space to set-mark-command?

    — Faried Nawaz #

  15. Cool! I have a trick similar to your f12 for my urxvts that works on any WM with the tool wmctrl, but it’s WM-independent:

    http://technomancy.us/blog/post/65

    I still can’t believe you don’t touch your .emacs… I thought regularly improving that was an essential part of the Dao of Emacs. Maybe after you’ve been improving it for ten years it could become hard to think of new things to do…

    — Phil #

  16. Might not matter to you, but I like to have the load as the last line in my screen sessions:


    defmonitor on
    hardstatus alwayslastline "%-Lw%{= bW}%50>%n%f* %t%{-}%+Lw%

    — Mark A Hershberger #

  17. truck trader » My Good Easy (2007) (pingback)
  18. How about posting your .emacs file (and other custom emacs files)? I am a very recent convert from vim (3+ years) to emacs. I would love to see what your setup looks like.

    — Peter #

  19. Mark A.: use caption always instead of hardstatus alwayslastline. This looks the same, but leaves the status available so you can also say something like this:

    # pass hardstatus through to xtermtermcapinfo xterm*|rxvt* 'hs:ts=\E]2;:fs=07:ds=\E]2;screen07'

    Then the title of the xterm displaying your Screen session can be changed just as if Screen wasn’t there.

    — Aristotle Pagaltzis #

  20. Good call on most. I’m on a Mac, and have found that antiword + most handles the majority of my copy deck reading needs. Way better than firing up a GUI-based word processor.

    — Andrew White #

  21. regarding bash setting screen captions. The ‘trap’ command can trap bash events and attach commands to them.

    “trap ‘echo hello’ DEBUG” traps the DEBUG event which fires *just before* a command line is executed - this prints hello just before it executes a command.

    $BASH_COMMAND contains the name of said command.

    echo -e “\ekHello!\e\\” will set your screen’s title to “Hello!”

    Combining all these we have:
    trap ‘echo -ne “\ek${BASH_COMMAND%%\ *}\e\\”‘ DEBUG

    Tada!

    — aaron griffin #

  22. Ah crap, I posted before i finished…

    Just wanted to say I generally work in a similar fashion, though I really just use two(ish) applications - firefox and urxvt/screen. I do most things at the terminal simply because of the same concept you bring up - the ability to ‘pipe’ plain text around is lost in gui-land.

    While a bit contrived, here’s a recent screenshot of how I actually work:
    http://img.phraktured.net/screenshots/screenshot-20070305122500.png

    Please note, the screen vsplit is in CVS. I don’t actually work that way, but screenshots are always flashier!

    — aaron griffin #

  23. mmb » Blog Archive » links for 2007-03-16 (pingback)
  24. How do you copy/paste from [k|c]onsole to firefox? (The other way around I use Ctrl-C / Shift-Insert)

    — Peter van Kampen #

  25. genehack.org » Blog Archive » tab dump // 20070318 (pingback)
  26. > less is better than more, but most is better than both.

    Or to put it another way:

    Less is more than more, but most is more than less.

    :)

    — Clay #

  27. Mark: are you still using Ubuntu, or did you conclude that gNewSense ready for primetime day-to-day use in the end?

    — Anonymous #

  28. Actually I switched to Debian around the first of the year, on my primary machine. I have Ubuntu Feisty on an old laptop.

    — Mark #

  29. > How do you copy/paste from [k|c]onsole to firefox

    Pipe to /tmp/1, which I have bookmarked.

    Embrace the minimalism.

    — Mark #

  30. Any chance of an illustrative screenshot?

    — Anonymous #

  31. > Pipe to /tmp/1

    Heh, nice. I’ll have to keep that trick in mind.

    — Bob Aman #

  32. How do you copy/paste from [k|c]onsole to firefox?

    You select the text in the terminal using hold-mouse-button-and-drag, then middle-click to paste the selection. Just as god intended. This doesn’t just work with terminals, it works with pretty much any selectable text anywhere in X. I barely ever use the clipboard; when I’m forced to work on Windows, the absence of the select → middleclick gesture alone is enough to make me cranky.

    — Aristotle Pagaltzis #

  33. You have a problem with firefox -remote ‘openURL(http://poop.example/)’?

    — dbt #

  34. Doesn’t anyone else use CTRL-SHIFT-C to copy from gnome-terminal or konsole, and regular old CTRL-V to paste into Firefox? Maybe it depends on desktop-environment integration, but it’s been part of the whole Just Works thing that Ubuntu does since I first installed Breezy last year.

    — grendelkhan #

Respond privately

I am no longer accepting public comments on this post, but you can use this form to contact me privately. (Your message will not be published.)



§

firehosecodeplanet

© 2001–8 Mark Pilgrim