How to swap keys on a Mac Keyboard

Hi folks,

In this post I will talk about a great app for remapping keys on keyboards. It’s called Kirabaner-Elements.

Recently, I found that one key on my keyboard has become worn out. It would sometimes take multiple presses for the key to register. My initial thought was, well, just go to the Apple Store and have it replaced.

Scheduling an appointment with the neighbourhood Apple store was proving to be a bit of a pain, so I thought to myself: How about swapping the broken key with another key which I rarely use on the keyboard? Surely, it can’t be that difficult.

After a bit of research I found a few things. Apple only provides built-in functionality for remapping modifier keys, not arbitrary keys. It’s a bit of a shame on Apple’s part in my opinion. However, there is an awesome app called Kirabaner-Elements that allows you modify any key.

So, I installed Kirabaner-Elements and gave it a go, and behold it did the job excellently. I now have another previously useless key remapped to my previously broken key. Note that the worn-out key still works. Note that some work is required to train my muscles to use the new key though. Nevertheless, it’s great to be able to swap keys easily. So, if you ever need to remap keys on your keyboard, I highly recommend Kirabaner-Elements. You can download it from their website. Till next time.

How to copy from vim in ssh session to local clipboard on Mac

If you are using a Mac computer and editing vim inside an ssh session, then you can’t copy from the remote vim session to your clipboard using the familiar “+y. This is because the remove vim doesn’t know anything about your local pc’s clipboard. So, how do we copy text from a remote vim session to your local clipboard? There are 2 options :

1. Highlight the text with your mouse then press cmd+c

Note: if you have

set mouse=a

in your .vimrc file, this won’t work as any highlight with mouse switches vim to visual mode making cmd+c invalid. In this case you could press and hold alt before highlighting.

2. Put the text in a temporary file and transfer it to your local pc by scp, then put it in a the clipboard with pbcopy, i.e. go to local terminal and run these commands:

scp username@remotehost /tmp/stuff.txt
cat /tmp/stuff.txt | pbcopy