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.
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.
I mentioned in a tweet recently that I’ve been using some form of Vi for about twenty years. It all started in college where we had highly advanced green screen monitors attached to a large Unix box. I can’t remember what Unix it was ran on that machine (it may have been UnixWare) but it was a far cry from the nice GNU interface we’re used to on modern Unix systems. Vim certainly was not a part of the default install.
However, Vim has been my editor of choice all my working life. All this time I’ve known I’m only scratching the surface of it’s functionality but only recently has it become clear how much. I can navigate through it with ease, open numerous files in separate splits, search/replace and of course vimdiff was partly responsible for every single WordPress MU release as I used it to pull over changes from WordPress.
So, thanks to /r/vim I discovered the following today:
- /r/vim_magic is indeed full of magic.
- More Instantly Better Vim is a great talk on some insane things to do with Vim.
- I had no idea Vim had tabs but I still prefer splits.
- snipMate.vim is a snippet plugin for Vim based on the snippets in TextMate. Around the turn of the century I had messed with abbreviations but this is way better. Found that here where there’s plenty more tips to read.
- Coming home to Vim is the story of the return of a TextMate user to Vim. Why didn’t I know about daX and diX?
- Since I use split files, I’m always tapping CTRL-w w or CTRL-w UP/DOWN to switch between splits. It never occurred to me that I could map the TAB like this to switch split files. TAB switches to the next split file, SHIFT-TAB hops back.
map <Tab> <C-W>w
map <S-Tab> <C-W>p
- I am tentatively mapping ; to : with
nnoremap ; : but I probably won’t use it. My fingers are too used to LSHIFT-; to stop now. I’ve never used the ; command, I had to look it up to see what it did!
From my tweet comes some productivity tips. I have never used the Leader key. The shame, the shame!
So much to learn. I’ll probably leave comments on this post linking to all the bits and pieces I find. Yes, I’m excited about a bloody text editor. Haha!
I tried to install fdupes this morning on my Ubuntu Linux server but the install bombed out with this error, followed by a string of other warnings before dpkg rolled back everything:
gzip: stdout: No space left on device
What? I’d installed a 500GB drive in that machine recently. It was /boot/. A quick look in there revealed a number of old Linux kernels but luckily there’s an easy way to get rid of them.
This showed me a list of all my installed kernels, and “uname” told me the name of the current kernel which I shouldn’t remove.
[sourcecode]dpkg -l linux-image-\* | grep ^ii[/sourcecode]
Removing them was as easy as this:
[sourcecode]apt-get purge linux-image-3.8.0-29-generic linux-image-3.8.0-31-generic linux-image-3.8.0-32-generic linux-image-3.8.0-33-generic linux-image-3.8.0-34-generic linux-image-3.8.0-35-generic linux-image-3.8.0-36-generic[/sourcecode]
When I finally installed fdupes it kindly removed all the kernel headers saving me a further 505MB of space. I’m pretty sure this is the first time /boot has filled up on me.
fdupes is pretty nice too. It finds duplicate files by comparing file sizes first and then does MD5 checks.