21 4 / 2012

I’ve been reading The Pragmatic Programmer (http://pragprog.com/the-pragmatic-programmer) and one thing they really emphasize (other than Don’t Repeat Yourself) is trying to make sure the computer doesn’t get in your way while programming.

I’ve made a few tweaks that should make my programming life more streamlined.

  1. In my ~/.inputrc, I added set editing-mode vi which makes the Python interpreter act like vi instead of emacs. I don’t type a lot of code into the interpreter, but it’s nice that my muscle memory will be more applicable.
  2. On my Mac, at some point, the Python interpreter began doing filename autocomplete (and stopped inserting tabs). I think I noticed the latter first, but the former makes it worth having to type those 4 spaces. I decided to try to implement this on my Debian VM, and found this documentation: http://docs.python.org/tutorial/interactive.html
  3. I figured out how to make the vi modeline specify language. Whitespace is key! # vim: set filetype=python :

Although of course the time I most often use tab completion of files in the interpreter is when I’m writing tests, and this means in the long term I should work on automating more types of tests.

Now I have to see if my Debian vi has Python language tab completion.

…and speaking of muscle memory, I just typed :wq to save this blog post. :)

Edit: Somehow I broke literally everything I just did, and I can’t figure out why it’s broken. Tab completion will only show me the current directory.