Devlog :: And Wizardry

Thu, 03 Nov 2011

Vim just turned 20 and I just learned a new vim trick

It was 20 years ago, November second 1991. George H. W. Bush was president, the Soviet Union was dissolving, the World Wide Web barely existed, and the vim text editor was first released publicly, originally for the Amiga, on Fred Fish floppy disk #591. Twenty years is a hell of a long time in computer years but Vim is still going strong. During the celebrations today (ongoing, although it's now after midnight) I stumbled on the Vim session feature. It lets you save the state of a editing session with all the open files, tabs, layout, and history. You can pick up where you left off with just one command. I've been living without this since Vim 7 came out with tab pages (in 2006). I got by mostly because I worked on always-on workstations or hibernate and restore laptops. I tend to keep editing sessions open through a whole project. It was always a hassle to shut down and start up again, but no more! It's basicly simple. In Vim you can check out ":help session". To save a session use ":mks[ession] name-of-session-file". To open the session again in your shell type "vim -S name-of-session-file". I created an alias in my cygwin .bashrc to open my current project session and mapped F2 in my .vimrc to the command to save the current session. Not only that, but today I also discovered the fabulous new mintty terminal for cygwin. It's been a double awesome day. Happy Vim day! [/items/hacks] permanent link


Mon, 29 Mar 2010

Moving Subversion repositories to Git

Mostly FMI (for my information)... I've been wanting to check out git for a while and the time was right. I'll be moving one of my server accounts soon. That includes some Subversion repositories. It's not too hard to move svn to a new server but it turned out to be even easer to port it all to git. Here's what I did: [There are lots of ways to do this, but this worked for me...] > /git svn clone svn+ssh:!/!/user@pwizardry.com!/rest-of-svn-style-url/ This creates a new git repository in the current directory with the same name and all the contents of the Subversion repository, including all the revision history. A lot of stuff scrolls by listing every commit and every file involved. It died for me part way through with this encouraging message: *error: git-svn died of signal 13* which is from an unresolved bug. If you cd to the new repository and type > /git svn fetch/ it will continue where it left of. What I had when this was done was a git working copy. This includes all the diffs and objects that make a repository, plus a copy of the current versions of all files and directories. What I wanted was a "bare" repository on my server that doesn't have all the files. I'll use this to clone new working copies of my code where I will be working on it and then pushing changes back. For example, on my laptop: > /git clone ssh:!/!/munging.us!/xxx!/local!/git!/cell/ /[hack, hack]/ > /git commit -a -m "I hacked and hacked"/ > /git push ssh:!/!/munging.us!/xxx!/local!/git!/cell/ or just /git push origin/ Getting back to making a bare repostiry... It would be nice if /git svn/ took a --bare option, but it doesn't. The trick is to clone a new bare copy with a different name and blow away the original. Then rename the clone with the original name. > /git clone --bare cell cell.temp/ > /rm -rf cell/ > /mv cell.temp cell/ With all the warts showing in the first few git commands I typed, I had to wonder if it was ready for prime time! To be fair this was all in the git-svn command which, in the end, did an impressive job for me. One command and some cleanup (and a bunch web searching) did the trick. Bringing over the rest of my svn repositories was easy. git! [/items/hacks] permanent link


Wed, 05 Nov 2008

Workstation Woes

My home built desktop workstation started acting up a few months ago. It started spontaneously restarting once every week or so. Over time it happened more and more often and it became unusable. It turned out to be bad RAM but it took a long time to get to a diagnosis. For one thing, it passed an overnight RAM test way back when I first noticed the problem. At that time it had only crashed a few times with a week or more between. I've never had RAM go bad before so while the problem got worse I was looking elsewhere. After I finally solved the RAM problem I started having boot problems. I would hear the single beep that says everything is OK so far, and then I would see the monitor come out of power save mode but there would be no splash screen from the BIOS. It would just hang there forever. If I tried again latter it might start normally and then work fine until I shut down again. This went on for a few days. It turns out I'd been using my laptop as a stand in workstation with the same monitor and wireless mouse. I'd swap the USB receiver for the mouse back an forth to my main box when it was working. I also had a wired USB mouse on my workstation that I put on there while testing. It turns out the workstation will not boot with both mouses attached even though it works fine with both after it's up. (!) One or the other is OK for booting but not both. (And I'd move the wireless to back to the laptop when I gave up trying to boot my main system...) Dang! I hope the hacking gods have less tedious projects in mind for me now. Please please please! [/items/hacks] permanent link