A contributor to the Hackaday blog has a good old rant about how Vim is superior to Emacs.
Of course it is (a silly argument), but he manages to give a quick overview of Vim and describes a few neat tricks beginners will find useful!
And after writing the text above I realised that there are going to be people reading this who have absolutely no idea what either Vim or Emacs are! They’re text editors, and they have passionate users. Yeah, that includes me too. 🙂
I hold on to things for way too long! The last four weeks have felt like a continuous purging of old “stuff” with several trips to the Kinsale Road site (BTW, it was a bit creepy to see a guy rummaging around in the electrical bins as soon as I dumped stuff in them, he could at least have waited until I left), and there’s still more to go. At least now I can walk around the attic without tripping over random objects.
The Bash command line can be edited using the cursor keys but for the real power user you need to enable Vi mode:
$ set -o vi
Or add it to one of your Bash startup files.
Now, instead of the slow interactive editing you’ll get the command and insert mode of Vi! Users of Vi or Vim will feel right at home. You start in insert mode by default so it feels the same as before. You can type new text, move left and right with the cursor keys and delete text but press ESC and you can do all the things Vi command mode allows you to do.
Check out this extensive cheat sheet with examples or jump directly to the ascii version here!
The best thing may well be the Bash command prompt and MacPorts.*
* most Mac owners probably won’t agree with me.
Making the switch from Windows or Linux to Mac OS X is not without pain. The extra CMD key plays havoc with muscle memory, and the “Windows Explorer” of Mac OS X, Finder, is quite a different beast to what you might be used to in the Windows or Linux worlds.
About two weeks ago I decided to make the switch again to Mac OS X and I lamented the difficulty in using Finder to do simple tasks. I’m still not 100% happy with Mac OS X it but the tips on the following pages made things easier:
- Home and End keys work on a line, not a document, silly.
- Disable natural scrolling.
- Switch CMD and ALT if you’re using a PC keyboard. I have a lovely split keyboard but the default configuration hurt my fingers.
- Change the keyboard layout if your keyboard doesn’t work the way you’re used to. I still haven’t got this set up exactly as I want it to. In my terminal some keys act differently I think but I haven’t set aside time to work out which. I need to swap ” (shift-2) with @ (key to the top/left of right-shift). My muscle memory gets them mixed up all the time.
- Automount SMB drives automatically. I haven’t been able to get the fstab method to work yet because my password has spaces but the “User Login” one works well enough.
- Change Finder search so it searches the current directory by default.
- Type the path into Finder.
- 9 tips to improve Finder.
- Sorting and arranging in Finder.
- Right click on the directory name in Finder and show a dropdown of the path to that directory.
- Install Mac Ports to get a working copy of Rsync and a better ls that lets me put parameters after the filename.
There are still oddities. When Mac OS X mounts an SMB share it does so with permissions that only allows the current user to edit files in the share. That’s perfectly understandable but it messes things up for Rsync when I’m syncing directories with a remote host. I’ve had to resort to using the “–size-only” parameter of Rsync so it won’t attempt to sync every file each time. I need to figure out if that can be fixed somehow.
I’ll update this post from time to time as I come across more oddities.
I upgraded Linux on this server a while back and in the course of that upgrade PHP was upgraded too, to version 5.5.9.
Since I had a modified php.ini it asked me to check over any new options. There were a few but I fixed anything that looked like it might break things. I saved the php.ini and let the upgrade go on.
Some time later I saw odd notices in the PHP error log. Usually it referred to wp-comments-post.php but files outside of WordPress raised the warning too:
PHP Notice: Undefined variable: _SERVER in ..
It turns out the fix is rather easy. Jacques Marneweck on his blog posted a solution. Simply switch off “auto_globals_jit” in your php.ini and restart Apache (if required).
From the PHP manual entry for auto_globals_jit:
When enabled, the SERVER and ENV variables are created when they’re first used (Just In Time) instead of when the script starts. If these variables are not used within a script, having this directive on will result in a performance gain.
The PHP directives register_globals, register_long_arrays, and register_argc_argv must be disabled for this directive to have any affect. Since PHP 5.1.3 it is not necessary to have register_argc_argv disabled.
It looks like the bug is ancient although I’m not using APC, and the JIT compiler can be fooled if you access the super globals like _SERVER through variable variables. Sneaky!
The default for auto_globals_jit is “On” so next time you upgrade PHP keep an eye on the error log.
I’m back in the world of Linux on my desktop machine again. Well, mostly.
Desktop Linux has been a “thing” for so long now it’s a cliche but I used it as such for well over a decade and it wasn’t until I was lured away by the shiny games offered by Steam that I installed Windows on a machine. Well, time passes and Linux support for games improves. Many fabulous indie games now have Linux versions. I’m glad I can play Kerbal Space Program, Prison Architect, Papers Please, Luftrausers and more without booting into Windows!
I’m mostly back in the Linux fold. There are still apps I use regularly that don’t work in Linux. Lightroom and Ynab are the main offenders. Both run to a certain degree in Wine, and the latter runs quite well, but I’m afraid I’ll be cheating on Linux. I have a Macbook laptop here too that runs Lightroom just fine. My 1TB of photos (and some videos) resides on an external drive in my Linux box but with the catalog copied over to the laptop, Lightroom runs reasonably well.
It hasn’t been plain sailing either. I corrupted one external drive when I let Ubuntu try to resize and partition it. It was probably my own fault for not defragging it first. I thought I had lost everything as Windows couldn’t see anything on it. Luckily, after booting into Linux on a USB flash drive I could see everything I wanted copied off.
I have an Nvidia graphics card and I noticed ugly tearing in web pages in Chrome. I found a page that suggested enabling “Override software rendering list” in chrome://flags/ but while that worked it also stopped my cursor changing when hovering over links and hover actions on menus didn’t register. Luckily I found this thread that suggested disabling the “Composite” module in the X server. (That’s the program that displays things in Unix)
I couldn’t find the file, /etc/X11/xorg.conf in my Ubuntu 14.04 install but I found Composite was mentioned in /etc/compizconfig/unity.ini and when I removed it, restarted X and logged in again Chrome scrolled like melted butter on hot scones. (yum)
Unity is a lot nicer than I remember it, or maybe it’s because I have a better machine now. I have no doubt I’ll get bored of it and start installing Gnome, KDE, Xfce and everything else to play with, before coming back to it again. I fondly remember the days of Windowmaker.
So, Linux is back.