<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc=" http://purl.org/dc/elements/1.1/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>briancarper.net (λ) (Tag: Dotfiles)</title><link>http://briancarper.net/tag/97/dotfiles</link><description>Some guy's blog about programming and Linux and cows.</description><item><title>Vim joy, Lisp woes</title><link>http://briancarper.net/blog/vim-joy-lisp-woes</link><guid>http://briancarper.net/blog/vim-joy-lisp-woes</guid><pubDate>Thu, 15 May 2008 00:17:11 -0700</pubDate><description>&lt;p&gt;I symlinked my .vimrc to my local mirror of my website so that every time I rsync it (which is pretty often) it'll automatically update my the &lt;a href=&quot;/vim/vimrc&quot;&gt;vimrc&lt;/a&gt; on this server.  So that should be fun.  I experiment with things in there all the time so at any given moment there are likely to be things horribly broken, but maybe someone can use some of it.  &lt;/p&gt;

&lt;p&gt;This &lt;a href=&quot;http://docs.google.com/View?docid=dfkkkxv5_65d5p3nk&quot;&gt;mirror of Ciaran McCreesh's vimrc&lt;/a&gt; which I found linked from &lt;a href=&quot;http://steveno.wordpress.com/vimrc/&quot;&gt;here&lt;/a&gt; (edit: updated version &lt;a href=&quot;http://ciaranm.wordpress.com/2008/05/15/my-vimrc/&quot;&gt;here&lt;/a&gt;) has lots of good stuff in it.  In particular using &lt;strong&gt;:set listchars&lt;/strong&gt; to display tabs and trailing whitespace as some funky Unicode characters is a really good idea.  When I first tried that good idea I realized my favorite font ProggySquare didn't properly display most Unicode characters, which was part of my motivation to switch to Terminus.  (That, and those tiny Proggy fonts aren't so great on a 1920x1200 monitor.)&lt;/p&gt;

&lt;p&gt;After a long time putting it off, I finally hunkered down one day and figured out how the heck Vim script works.  The difference between statements and expressions in Vim script language confused me for a while, which goes to show that I'm far too used to Ruby and Lisp where almost everything or everything returns a value as an expression.  Vim expects expressions in certain places and colon-prefixed commands in others.  But then there's &lt;strong&gt;normal&lt;/strong&gt; and &lt;strong&gt;eval&lt;/strong&gt; and &lt;strong&gt;execute&lt;/strong&gt; and &lt;strong&gt;&quot;=&lt;/strong&gt; some of which let you do things from one mode in another mode if you mix and match them.  But I think I've gotten a handle on it now.&lt;/p&gt;

&lt;p&gt;Today I came across &lt;a href=&quot;http://mikael.jansson.be/hacking/limp&quot;&gt;Limp&lt;/a&gt; which is a recent attempt to get Lisp to work well with Vim.  It seems quite new and buggy and had dependencies on things I had to guess until I was able to install it (like &lt;strong&gt;rlwrap&lt;/strong&gt;), but I still was excited about it.  Until I realized that it's just a wrapper around GNU screen.  SBCL runs separately, and some keystrokes send stuff from Vim to screen, but that's about it.  Nice, but not nearly as nice as SLIME in Emacs.  So that disappointed me.  In the back of my mind I always think about how Vim could possibly be integrated with Lisp like SLIME does but I don't see any good way.  Vim doesn't have the ability to embed shells like Emacs and it doesn't look like it will gain that ability any time soon.  Ah well.&lt;/p&gt;</description></item><item><title>Keeping bash history in sync on disk and between multiple terminals</title><link>http://briancarper.net/blog/keeping-bash-history-in-sync-on-disk-and-between-multiple-terminals</link><guid>http://briancarper.net/blog/keeping-bash-history-in-sync-on-disk-and-between-multiple-terminals</guid><pubDate>Fri, 14 Sep 2007 14:55:13 -0700</pubDate><description>&lt;p&gt;I rely on my &lt;code&gt;~/.bash_history&lt;/code&gt; extensively to avoid retyping things, both short-term and long term (when I want to look up something I typed yesterday or last week).  &lt;/p&gt;

&lt;p&gt;First, an obvious necessity is&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;shopt -s histappend
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;in &lt;code&gt;~/.bashrc&lt;/code&gt;, so that bash just keeps on adding to the end of the ~/.bash_history file rather than obliterate the file at regular intervals.&lt;/p&gt;

&lt;p&gt;By default, bash reads from your ~/.bash_history once when you log in to a terminal, and it updates ~/.bash_history once when you log out.  I dislike both of these default behaviors.  &lt;/p&gt;

&lt;p&gt;Writing out to ~/.bash_history only when you log out is no good, because what if your terminal dies unexpectedly?  You'll lose the history of any commands you typed there.  This can happen if you &lt;code&gt;kill&lt;/code&gt; a bash process, or if the machine powers off unexpectedly, or who knows what.  So, to manually update your ~/.bash_history immediatety, at any time you can use this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;history -a
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which tells bash to append to ~/.bash_history any commands in the current terminal that aren't already in there.&lt;/p&gt;

&lt;p&gt;The second behavior of bash I dislike is that it reads from the history file only at login, mostly because I always have many terminals open at once.  I run a command from one terminal, then run a different command from another, switch back and forth etc.  These terminals may be appending all kinds of nice new lines to the end of my ~/.bash_history, but because bash never reads the history file except at login, they're never accessible except in the terminal where the command was originally run. Luckily you can force bash to re-read your history file via:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;history -n
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which tells bash to read any new lines that have appeared in ~/.bash_history since the last time it looked.&lt;/p&gt;

&lt;p&gt;Now, say I type a really long command, e.g. a huge long Perl one-liner, in one terminal, and I want to then access and run that command in another terminal via bash history.  With bash's default behavior, I can't do it; each terminal has its own history.  What I could do is type &lt;code&gt;history -a&lt;/code&gt; in the first terminal, and &lt;code&gt;history -n&lt;/code&gt; in the second terminal; then it'd work wonderfully.&lt;/p&gt;

&lt;p&gt;I find the thought of having to do that all the time tedious, though.  Better would be for bash to do it for me every time I run a command.  You can accomplish this by putting something like this in &lt;code&gt;~/.bashrc&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;export PROMPT_COMMAND=&quot;history -n; history -a&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;code&gt;PROMPT_COMMAND&lt;/code&gt; lets you specify a command that bash will run every time it shows you a fresh command prompt, i.e. every time you run a command and the command finishes.  So the above tells bash to read any new lines that have appeared in ~/.bash_history since the last time it read it, and then append the last-run command from this terminal to ~/.bash_history, every time you run a command.&lt;/p&gt;

&lt;p&gt;So now, if you type a command in one terminal, and want to access it via the history of another terminal, run a command in the other terminal (or just hit Enter) to trigger PROMPT_COMMAND, and then your history will be nicely up-to-date and synchronized with any other terminals you have open. Almost certainly, you'll never notice the tiny bit of overhead caused by bash constantly reading and writing to ~/.bash_history.&lt;/p&gt;

&lt;p&gt;See &lt;code&gt;man bash&lt;/code&gt; for more info on the &lt;code&gt;history&lt;/code&gt; builtin.&lt;/p&gt;</description></item><item><title>HISTIGNORE</title><link>http://briancarper.net/blog/histignore</link><guid>http://briancarper.net/blog/histignore</guid><pubDate>Sun, 01 Jul 2007 12:05:56 -0700</pubDate><description>&lt;p&gt;&lt;code&gt;HISTIGNORE&lt;/code&gt; is a handy bash option.  You can specify certain strings that you want bash to ignore when storing command line history in &lt;code&gt;~/.bash_history&lt;/code&gt;.  For those using &lt;code&gt;sudo&lt;/code&gt;, you could automatically prevent bash from saving any of your run-as-root commands in your history.  Or you can prevent it from storing &lt;code&gt;exit&lt;/code&gt; or &lt;code&gt;fg&lt;/code&gt; or sundry &lt;code&gt;ls&lt;/code&gt; any other such commands that aren't worth remembering.&lt;/p&gt;

&lt;p&gt;See also &lt;code&gt;man bash&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Darn you, failglob</title><link>http://briancarper.net/blog/darn-you-failglob</link><guid>http://briancarper.net/blog/darn-you-failglob</guid><pubDate>Sat, 05 May 2007 20:14:34 -0700</pubDate><description>&lt;p&gt;I turned on &lt;code&gt;bash_completition&lt;/code&gt; today.  Couldn't quite remember why I had it turned off.  I quickly realized though.  bash would fail on any filename with a square-bracket in it.  It looks something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;~ $ touch 'test [1]'
~ $ ls&amp;lt;I HIT TAB HERE&amp;gt; bash: no match: test [1]
~ $
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In other words, hitting TAB to tab-complete filenames would dump me back to a command prompt giving me that unhelpful error message, and I'd have to start the whole command over.&lt;/p&gt;

&lt;p&gt;The problem was that I had this in my &lt;code&gt;~/.bashrc&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;shopt -s failglob
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I can't for the life of me remember why that was in my &lt;code&gt;.bashrc&lt;/code&gt;.  Clearly it wasn't doing anything I never had any use for, because this is the first time I got this &quot;bash: no match&quot; error.  Removing that line makes &lt;code&gt;bash_completion&lt;/code&gt; work again though, so all is well.&lt;/p&gt;

&lt;p&gt;This was a nightmare to debug too.  Google was totally useless.  I tracked it down to the &lt;code&gt;_filedir&lt;/code&gt; function in &lt;code&gt;/etc/bash_completition&lt;/code&gt;, and then it was trial-and-error.  Next time I'm going to start off loading a clean login environment before I bother checking the system scripts for things.  I did also learn that &lt;code&gt;set -v&lt;/code&gt; in a bash script makes it dump every line it executes to STDIN as it's executing them.&lt;/p&gt;</description></item><item><title>~/.inputrc</title><link>http://briancarper.net/blog/inputrc</link><guid>http://briancarper.net/blog/inputrc</guid><pubDate>Mon, 20 Nov 2006 19:02:12 -0800</pubDate><description>&lt;p&gt;&lt;a href=&quot;/dotfiles/inputrc&quot;&gt;I have posted my old Gentoo inputrc&lt;/a&gt; largely so I don't lose it.  The one that comes with Ubuntu sucks.  This one fixes PageUp / PageDown to scroll through bash history.  And it fixes the Delete key to delete rather than belch out a ~.  I don't understand why these things aren't fixed by default on all distros.  Is it backwards compatibility?  Are there really enough people using keyboards without a Delete key that the rest of us should suffer?  Or maybe I'm missing something, which is very possible.&lt;/p&gt;</description></item><item><title>.vimrc</title><link>http://briancarper.net/blog/vimrc</link><guid>http://briancarper.net/blog/vimrc</guid><pubDate>Wed, 19 Apr 2006 20:58:20 -0700</pubDate><description>&lt;p&gt;I've uploaded my &lt;a href=&quot;/vim/vimrc&quot;&gt;.vimrc&lt;/a&gt; file, mostly so I can have access to it next time I'm stuck on some strange unknown box somewhere.  I always find myself needing it and then trying to re-type the whole thing from memory.&lt;/p&gt;</description></item><item><title>GDM and .xsession</title><link>http://briancarper.net/blog/gdm-and-xsession</link><guid>http://briancarper.net/blog/gdm-and-xsession</guid><pubDate>Thu, 23 Mar 2006 17:47:20 -0800</pubDate><description>&lt;p&gt;I finally figured out how to get GDM to recognize my &lt;code&gt;~/.xsession&lt;/code&gt;.  I had to go read &lt;code&gt;/etc/X11/gdm/Xsession&lt;/code&gt; and see what it was doing.  It's testing -x for &lt;code&gt;~/.xsession&lt;/code&gt;, which is what I was missing.  So&lt;/p&gt;

&lt;ol&gt;&lt;li&gt; Make a `~/.xsession` and `chmod u+x` it.&lt;/li&gt;
&lt;li&gt;When you start GDM, select &quot;Custom Session&quot;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then it will work.  This is necessary because openbox doesn't provide any kind of startup feature.  (PS I'm trying openbox now.  Screenshots coming soon.)&lt;/p&gt;</description></item></channel></rss>

