Forcing myself into vim
by Mike Levin SEO & Datamaster, 04/19/2012
Well, it’s Thursday morning, and my SSH sessions are still open on my desktop, meaning my Client-side SSH ServerAliveInterval keep-alive attempt in /etc/ssh/ssh_config worked. That’s good. Rule of the day: get back that wonderful sense of continuity, and always being in the code that made 360iTiger actually happen in the first place. It’s all about full-immersion–full immersion in a location that is just a little bit resistant to the allure of the web browser. By design, web browsers are distracting now. You can’t go into any Google service without that little red counter in the upper right calling to you like the sirens’ song. Tabs, the bookmark favorite bar, and even the thumbnail start screen in Chrome all contribute their own little slice of white rabbit. Must… not… chase… it down the rabbit hole!
Okay, that’s a good start. Hopefully, I can keep my attention fixed. It will be a matter of continual refinement to get back to where I once was. There’s a whole world of things that shook my foundations–some that were my own fault, and some that were the powers-that-be. Of course, switching to the Commodore 64x, with its slightly different keyboard (albeit awesome!), and the corresponding move to Ubuntu workstation as my main day-to-day desktop contributed. But there was also an office move and a hard drive crash. I also (finally) upgraded my back-up PC (in case I need one) from XP to Windows 7. The MIS group actually replaced my laptop to do that, and all that just forced me all-the-more onto Ubuntu, which just feels so much more natural than Windows. Also, I FINALLY put Microsoft Office on my personal MacBook Air so that I can do work that MUST still be Microsoft-based (Outlook and Powerpoint) on my Mac instead of my PC laptop.
This all may sound like a lot of moving parts, but it’s the right path. As a developer, I’m repositioning myself onto the general plumbing of Unix/Linux. My main platform for development is shaping up to be either “any” Debian-based Linux, or the Micro Core Linux variation of Tiny Core Linux. That’s all server-based stuff, but because of the rule-of-immersion to force familiarity (like learning a foreign language), it only stands to reason that I move my desktop environment over to Unix/Linux as well. So one is Unix (the Macbook Air), and the other is Linux (the Commodore 64 with Ubuntu). It’s turning out that the largest up-side to this is a similarity between terminal environments. On the PC, I used PuTTY because of its ubiquitousness, but it has so much strangeness to it, it is not where I want to commit my muscle-memory neurons to. It’s much better to learn the default Gnome Terminal, and iTerm on Mac–which despite not being the built-in Terminal, is similar enough that everything I learn is applicable generically.
Okay, this is the dangerous ramble, which in itself is almost as dangerous as surfing the net. I have to get my stream of consciousness under control, so that I can focus on the business of the day. I put in a Helpdesk request for a long-standing issue of getting my monitor mount-arms centered. As subtle as it is, an uncomfortable monitor position is contributing to lack-of-immersion. Request submitted. Okay… Next! Client calls and meetings… unavoidable. Mark off as much time as you reasonably can in your calender. Just generally maintain expectations that you are not necessary in most meetings, unless you need to be “called in” for special discussions. We have a lot of excellent people who can and should field the simple stuff. I’m only necessary when things get of the well-worn paths. That’s the image I have to promote and foster.
Okay, it’s already 1:50PM. There was a client call, and I got tripped up on a WordPress nuance that shouldn’t be delaying me. But it was to help get Python code that I post formatting nicely, which happened to conflict with a page whose “slug” was Python, messing up the fonts. Nuanced stuff, but it didn’t take long to realize it was a plugin conflict, and I switched to SyntaxHighlighter Evolved, which doesn’t have the conflict. Anyway, back to the business at hand.
Yesterday was critical now that Tiger is public–locking down the directories a little tighter than they were, by using .htaccess files. It was a little bit of a revelation how a distributed revision control system can work so well with .htaccess files. I was worried that server restarts would be needed, but of course they’re not, or that would have defeated the purpose of user manageable .htaccess files–which means they’re perfect in distributed version control! I locked down the .hg directories, among other things. And in the future, if I ever make file-types that reside in the app folder, I can optionally filter them to be inaccessible through http, but keep them where it’s convenient to keep them, due to both dvcs repository locality, AND simplified pathnames inside of apps.
Okay, don’t feel bad about not being totally productive today in terms of producing code or anything. This is getting into the best possible position to be productive from. First, we deal with idea-processing, which is what we did with moving the journal entries back into the code-base, and making a way to blog directly to WordPress from Mercurial.
Okay, perhaps the best I am going to hope for today is organizing my thoughts. I don’t think any real coding will occur. In going back to my daily journal in vim, there are a few realizations. The first is that I like 80-column line-wrapping, both for programming, and because of how it’s nice and clean in moving around the text. One long wrapped line is annoying in navigation. It just doesn’t feel natural, so I’m keeping line-wrapping off and hard returns on, which is the same environment I use for programming. The down-side is that I have to manually reformat occasionally, which should be done with shift+v, arrow-keying to highlight the entire paragraph, and hitting gq to recalculate line-breaks. Always have that at the front of your mind for reformatting.
The next thing is that I keep spell-checking off by default for programming, but I like it on for my journal. In general, I have to get better at the spell-check commands, but this is one of the places I should take advantage of creating new keyboard shortcuts. I’m keeping customizations to a minimum, because I think it’s advantageous to work on a default vim installation, so you can be just as productive no matter where you sit down, regardless of your own personal shortcuts. But this is an indulgence to rapidly turn spell-check on and off without typing :set spell and :set nospell. It was in the video I watched today at http://vimcasts.org/episodes/spell-checking/
Okay, I edited my ~/.vimrc with the following lines:
” Toggle spell checking on and off with `,s` let mapleader = “,” nmaps :set spell!
…which now lets me toggle on and off spell-check mode very quickly. I should also consider doing this to toggle on and off 80-column hard returns. But I will keep that for another time, along with understanding precisely what’s going on here. Suffice to say, it works, and it serves as an example for when I need to do the next similar thing.
Okay, now this reminds me of something that I would like to make part of my website-proper. I have a file in the 360iTiger version control system where I keep my realizations, big and small. These are the things that I wish I knew a long time ago, and now that I know, can and should improve the way I work from here forever forward. These are little gems in life, because it what makes you a dynamic, changing, learning personality instead of a static one. This applies to life in general, but is particularly clear and easy to do in an environment like vim, so I’m going to make that into the vim section of MikeLev.in. In prep for that, I had to separate Python and vim, which I previously and wrongfully combined due to menu real estate.
Okay, I broke it out, and gave it its own picture from istockphoto.com. Replenished my account credits there, and actually took the time to google up a promo code before-hand, and saved myself $10 on the $80 purchase (cost $70). It’s worth taking that extra few seconds whenever you see a promotion code box when you’re getting ready to purchase. I hate using coupons in the physical world, but a few seconds in the digital world is fine. Okay, so then what now? Time to start transposing some of the actual revelations over.
Okay, it’s 5:30, and it’s time for me to push this journal entry out to WordPress, so I’m not struggling with it come 6:00PM. I still have some smoothing out of that process to do. I’m not the expert at Bash script that I need to be, and that will eventually become another one of the subjects of this blog, because I think you simply can’t get away from it. Python is nice, but already, I’m finding the need to pipe commands through commands, which is a decidedly Bash command-line thing to do. Perhaps later, since Mercurial itself is written in Python, I can move the entire process native in Python, but until then, I need to use the interfaces provided on the command-line.
Interesting! I haven’t even committed, and an hg diff against the repository tip still produces this journal entry precisely up to this point. Okay, I can work with that. I didn’t really do any commits today, and I can do this journal entry trick even without a commit. I think that’s a good work-flow for when I haven’t touched the code at all. Do a commit at the end of the day before you leave, but not necessarily before then, just for the journal. Lots of commits is reserved for when you’re in the code.
This daily journal entry was blogged into WordPress out of a Mercurial version control system, with a command that looked like:
hg diff -r789 journal.txt sed ‘s/^+//’ fmt -w 2500 python hg2wp.py