61 comments

[ 5.0 ms ] story [ 136 ms ] thread
"A commenter mentioned using Dropbox for synchronization as well, which seems attractive, but I’m not sure how clean that would be on headless Linux servers." Dropbox does work pretty nicely on headless Linux servers, you just have a daemon running constantly with none of the GUI extensions. I use it for keeping some code in check.

Nice list of things to try, I don't use vim but I've been putting off doing 3 of them (caps remap, iTerm and zsh).

For some (entirely irrational, I'm sure) reason, the idea of constant and automatic deployment of my dotfiles across all my boxes gives me the shivers. I like that extra bit of control I get from doing it with a git repo.
Same, which is why I git repo them as well. It's mostly a nice way to keep a few bits of code in check, plus handy for quick private repos without needing all the nice stuff from GitHub/BitBucket.
Caps remap is my favorite. My pinky is much happier.
(comment deleted)
I do this as well, but I sometimes question whether or not it was worth the frustration when using a colleagues computer.
There are certain kinds of customizations that I think are backwards compatible in a way. No matter how many custom mappings I make in Vim, when I am using someone else s settings I have never had an issue with not having them. Maybe if that other person also happened to use the colourscheme I like that would be different.

For whatever the reason though, capslock/escape remapping is not one of those changes for me. Working on a machine that doesn't have that is absolutely crippling; it takes a great deal of effort to not constantly hit capslock.

My solution is to only use my own computers. Mileage may vary. ;)

As any book about RSI will tell you, you should not use your pinky finger for pressing Ctrl regardless of whether it's mapped on Caps Lock or on the default key.
Which finger should you be using (with Ctrl in the usual place)?
Does the same apply to shift? I think that should be a far more concerning key than Ctrl.
I started doing this when bouncing between a Thinkpad and a regular keyboard. That damn Fn key on the Thinkpads!
I'm a full-time Vim user who has never taken to `bindkey -v`. The reason is simple: I'm using insert mode 99% of the time, so using vi keybindings just makes me have to hit an extra key.

However, it is useful some of the time. Since viins is pretty useless by default, you can spice it up by setting custom bindings (e.g. copy emacs') and get the best of both worlds. Furthermore, this may be helpful: http://www.bewatermyfriend.org/media/vi-mode.zsh

`bindkey -v` puts you in insert mode by default (there's a way to make it not do that, but the default is insert first).

So there's not really an extra key, you get both benefits :).

I meant that you have to hit an extra key to actually make use of the mode's default bindings.
> inoremap jj <ESC>

A mapping I've been using for years. I'm pretty sure between this and Ctrl-c, I never hit escape in Vim anymore.

I've always used Ctrl-[. It's there in all Vim installs, doesn't conflict with anything else that I know of, and is a quick, no-glance pinky shift for both hands (assuming you remap your Capslock to Control). Edit: Ninja'd by top-level comment!
In OSX at least, there's a way you can make Caps Lock behave as Ctrl when used as a modifier key, or Esc when pressed alone. Way better than adding an extra keystroke to every time you want to hit Esc.
Do you happen to know a resource that explains how you do this?
(comment deleted)
When you have already remapped Caps-Lock as an additional control, why not just use Ctrl-[ instead of the 'jj' remapping for Escape. It saves a bit of Vim configuration, and also works in Bash vi mode.
Same. I'm weary of inoremaps and Ctrl-[ is just really easy.
I just remapped Caps Lock as Escape. I use Escape a lot between tmux with vim modes, bash, and vim itself. I do this in OSX and for the linux console and X11.
I've also seen setups that somehow let Caps Lock work as Ctrl when used as a modifier key, and Esc when used regularly.
(comment deleted)
One small suggestion (I make this every time vim comes up):

Don't remap "jj" to escape. Remap "jk" instead. All of the same benefits, plus one more - if you get into the habit of nervously hitting "jk" all the time, as most people do in vim, using "jk" means your cursos stays in place. On the other hand, "jj" means your cursor will move.

Hah, I thought I was the only one doing the stupid "jk" thing.
I was going to suggest mapping both jf and fj to escape so you could mash the two keys at the same time without worrying about order, but jk and kj would work as well
Why is this article so Mac oriented?

So here's tip 9:

Use a nice Linux or similar machine with a pleasant to use clicky keyboard and a mouse which allows text highlight and middle click paste.

I've got a pleasant clicky keyboard, a mouse, a linux host (slackware) available in terminal with X11 apps piped over ... and OS X.

A long time ago, OS2 was better at running Windows apps than Windows was. The same is true for OS X running Linux ..

You know I don't really get this sentiment. And I just think people hate on the Mac because they want to.

I never saw the appeal of Linux. Yes, it's free, and I can buy a cheap PC to run it on but why would I do that? My Macbook Pro has the best keyboard I've ever used (the 2008 "pro keyboard", not the chicklet keys Apple uses these days) and the trackpad is better than ALL trackpads out there. Seriously, Apple knows how to make trackpads. And on top of that, OS X is as much Unix as Ubuntu or any other distribution of Linux and I can do whatever work I would have done on Linux on my mac. If I don't have a command line tool, I just use homebrew to install it or build it from source if homebrew doesn't have that formula. And you know what I get including those nice things? The wealth of awesome OS X apps, like Textmate, Keynote, iTerm, Kaleidoscope, QuickSilver/Alfred, XCode, Pixelmator, Time Machine etc that are available. So I ask you, why would I use a Linux machine when OS X is supremely better in almost every way?

1) The article has a title making it seem like it's unix shell tips straight from the unix master, then instead is advising to use certain Mac programs.

2) A trackpad can NEVER replace a regular mouse with scrollwheel and many buttons. Maybe the apple.com website triggers your emotions. But the following website triggers mine: http://www.razerzone.com/gaming-mice

3) OS X may be supremely better for you, but not every person is the same, you may be their target audience, other people are not and, gasp, may actually prefer a different design philosophy.

4) Being free or cheap is not usually a reason why one runs Linux on a PC. Can you imagine someone can actually prefer something, independent of cost?

5) Mac OS X has apps. Other OSes also have apps. They all have their selection of awesome apps. Usually one prefers the ones they're used to I guess.

1. There's only ONE tip out of 9 that tells the user to use iTerm over the default Terminal. I don't agree with many of the tips here and I wouldn't use them to "enhance" my workflow but you have to critique the article on what it actually says, not what it's geared towards. You can't just say "why is this geared towards OS X?" because that's not a valid criticism.

2. Sure, I never said it could replace a mouse. Only, I rarely ever use a mouse because I don't want to carry around a mouse just for middle click when I can use a Modifier key + single click to achieve the same thing. I also use my keyboard more, even to switch between applications and rearranging my windows using a Window Manager app like Slate. I also never said Apple's website triggers any of my emotions so I don't know where you got that from. I just said Apple has the best trackpads around and you can actually not use a mouse if you don't want to since Apple's trackpad is so good. Also, a Mac app called "BetterTouchTool" further enhances the track pad so you can do almost anything with trackpad gestures, something you really can't do easily on Linux.

3. Yeah, that was just my opinion. I wasn't speaking on behalf of other people.

4. Okay, got it. Many of my friends use that as a reason when I ask them why they run Linux though. They say it's cheap and they don't want to pay $2000 for a Mac which is fair enough. They just want a Unix machine and they can run Ubuntu on a VirtualBox without paying a cent.

This may be heavily opinionated, I know, but like I said, the reason Linux never appealed to me is because I can run Linux apps on the Mac since open source usually means I can run it on different platforms. Take any linux app, and I can bet 99% of the time, it's also available on the mac and I can further bet 80% of the time, there's an alternative on the Mac which is better (in my opinion). The truth of the matter is, there are many Mac exclusive apps that are far better than anything available on other platforms. This is just my opinion, that's all. You may view it differently than me, that's okay!

A trackpad can NEVER replace a regular mouse with scrollwheel and many buttons.

I disagree. I find the multi-touch trackpad on my MacBook Air much better to use than a mouse.

Less effort, good accuracy, great multi-touch controls like two fingers for scrolling, pinch in-out for zooming, three-finger swipe for 'back' on the browser.

4) Being free or cheap is not usually a reason why one runs Linux on a PC.

It's a reason that's often cited as being in its favour.

Or create a vagrant VM that almost emulates your web deployment server and develop in it while using any OS you like for other purposes :).
While I partially understand where you are coming from (OSX specific articles bug me in the same way that Ubuntu specific or Fedora specific articles bug me), you can have sensible mouse behavior outside of just Linux. When I work on Linux from a windows box I find that Putty's support for middleclick-paste works great (putty can be annoying for other reasons, but it can be made to work okay).
Only one of the tips is Mac specific, unless I'm missing something...
Do people really not use caps lock? I use it every day, when I need to type more than one upper case character in a row. Like, every time I type NSString, not to mention CLOCKS_PER_SEC.
Caps Lock is also the most simple way to input Ç, À or É with a french keyboard. Not everyone needs it though.
It's better than that: several quality keyboards do not even come with a CAPS LOCK key anymore.

For example if you're into quality switches, rated for 50 millions keypresses and providing a better tactile feedback than the typical $5 chinese mass-produced keyboard, you may want to shell out $250 to buy an Happy Hacking Pro 2 or a Realforce keyboard using Topre switches (you can have very good Cherry MX based boards for way less than that that said).

Some of these keyboards, like the HHKB Pro 2, don't even have Caps Lock. They have Control in place of Caps Lock.

So "Do people really not use caps lock?" is not the correct question. The correct question is: "Do programmers who touch-type and who spent time figuring out which keyboard switch they like really not use caps lock?" and then the answers becomes "yeah, most really don't use caps lock because Ctrl is so much more useful and so easier to use when it's located where caps lock typically is. To the point that companies building $$$ keyboard for that market don't even bother selling keyboard with caps lock" : )

"CLOCKS_PER_SEC" should be "CLO" and then auto-complete anyway. Regarding NSString, that's keypress, keyrelease (turning capslock on), 'n' 's' 's', keypress, keyrelease (turning capslock off). Doing it without capslock is keypress (shift), 'n' 's' 's', keyrelease. Which IMHO is faster but YMMV.

People touch-typing are alternating Shifts when needed when typing all-caps or typing lowercase and uppercasing the whole word using some vi(m)/emacs magic shortcut anyway ; )

I use caps lock, but I use 'ctrl' more often.
I tried iTerm for about a year. After getting fed up watching it lag or crash all the time. I definitely went back to stock Terminal and haven't looked back.
I had the same issues. It's gotten better.
It's definitely gotten better. I've been running the iTerm 2 beta release and it never crashes. I've literally never had a crash after I began using it.
"7. Use vi-mode in Your Shell"

Tried this and gave it up. Your shell may be (somewhat) vi compatible but the applications you use mostly are not so you'll have to break out of the vi mindset at all sorts of inopportune moments. That, and modal editing, while perfectly alright for text editing, maps rather lousily to command line operations. You're much better off getting used to some basic Emacs-style key bindings that work consistently across a wide number of applications (including OS X text fields, IIRC).

What I did, for example, was that I enabled vi-mode in my shell but also re-enabled some emacs-keybindings like CTRL-E and CTRL-A for ending and beginning of a command because I learned them like a lifetime ago when I first got used to the shell without even knowing they were emacs-keybindings.

But that way I am also able to hit ESC and do a / for a search, like within vim, which I am much more used to than a search in emacs. I found that way combines the best of both worlds.

I use vi-mode in my shell but the end/beginning Vi commands (A,I,0,$,etc) are the only ones I find myself using regularly. I also use c[motion] and d[motion] on occasion, but that is pretty much it.

I'm not convinced that powerful editing is necessary for the command line, but familiar shortcuts for beginning/end seem very useful.

There are absolutely times that powerful editing is mandatory at the command line; I am skeptical that there are times when powerful editing at the command line is necessary but pulling the line into your $EDITOR (v in vi-mode, ctrl-x ctrl-e in emacs-mode) is not the best way to deal with it.
but it's not about powerful editing alone. it's about nice things that are just in your fingertips, say using 'df ' to delete a --long-argument=/a/very/long/path from a command...
As a Vim user, I've always been drawn toward using vi keybindings in bash.

However, as a Mac user, all of the Cocoa text widgets more or less support emacs keybindings, so having a working knowledge of basic emacs movement commands has been very useful.

The emacs bash/readline keybindings also have a really neat trick that the vi bindings don't -- keyboard macros!

Ctrl-( to start recording, Ctrl-) to stop, and Ctrl-x to execute.

How is Ctrl- different from using "q" in vi?
It's a matter of muscle memory. I used Vim exclusively for several years, and used vi-mode on my shells. Now that I've switched to emacs, my fingers are more comfortable using Ctrl-<key> for commands.
At least for me, macros don't work in Bash vi-mode. Perhaps it is only implemented in emacs-mode? Or maybe it is the readline version I have in OSX.
1. Remap Your CAPSLOCK Key

Another upside to this is that people will gradually stop asking to use your laptop 'for just a minute'.

Remapping the arrow keys to switch between Vim windows instead of moving the cursor is a great way to achieve that goal. ;)
echo "set editing-mode vi" >> ~/.inputrc

This will turn on vi mode for anything that uses the readline library (there's a good chance your favorite database command line uses it and any other apps that also use the readline library)

One of the issues I have with tmux is that like xterm, but unlike screen, it doesn't reflow text when you resize. I understand doing that probably is not an ideal default, but it would be nice to have the option.
I wonder if it makes sense to map capslock to, effectively, ConnectBot's use of the "okay" button on Android - where a single tap is ctrl and a double tap is alt/esc (or vice-versa - it's muscle memory at this point...)