Jason Meridth's Blog Learn, Converse, Share

Mapping Caps Lock to Esc Is Native to OSX Now

I have been using Seil for a few years now on OSX to map Caps Lock to Esc. I use Vim for my development and letting my left pinky tap the Caps Lock key instead of Esc allows me to keep my hands on the home row and move much quicker. I also can’t remember the last time I actually needed the Caps Lock key. Well as of 10.12.1 (macOS Sierra Update) you can do this mapping in System Preferences.

Thank you to my co-worker Dedi for letting me know about this.

Go to System Preferences from the Apple menu:

system preferences

Go to keyboard: Keyboard

Go to “Modifier Keys” button on bottom right: Modifier Keys Button

Change Caps Lock Key to Escape: Change Caps Lock Key to Esc

Details HTML Section In Github Issues and Gists

I recently became aware of using the <details></details> and <summary>...</summary> tags in Github issues and Gists.

Here is an example.

I will definitely be using this more when posting big logs or stack traces.

Kudos:

  • Laura Frank for showing me this feature
  • Keith Dahlby for letting me know it doesn’t currently work in Firefox
  • Matt Hinze for showing me this gist where I learned of <summary>...</summary>
  • Eric Clemmons for the awesome gist that does a great job explaining the feature

Stop and Remove All Docker Containers

Command remove all docker containers:

docker stop '$(docker ps -a -q)' && docker rm '$(docker ps -a -q)'

docker ps -a -q lists all container IDs

Get Repository Root Path

I needed to find a way to get the path to the root of my Git repository. I found the answer in the following command:

git rev-parse --show-toplevel

Example:

->$ git rev-parse --show-toplevel
/Users/jmeridth/dev/jmeridth.github.io

Vim Tagbar Plugin

I found the tagbar Vim plugin last night and finally tried it out this morning. I like it. I mapped ,tb to showing it in my .vimrc.

One of the requirements is Exuberant Ctags. Since I’m on OSX I installed it with Homebrew:

brew install ctags

In a Python file it will group/fold all of your imports, classes, methods, etc in one view. It is very nice and when you press enter on one of them it takes you to that item in the current buffer.

Here are the screenshots from the github repo screenshots (C++ files):

screenshot 1

screenshot 2

I’m really liking it so far.