Easy README Files on Your Mac
Jan 28, 2015
This article will show a way to set up an easy keystroke command to create a new README text file in the selected folder (if it doesn’t already exist), and open it for editing in your favorite text editor (iA Writer used in my example).
If you are like me, working on various projects throughout the day, you might want an easier way of documenting important notes. Instead of opening up a text editor, and either navigating to the folder where you want the file saved, or saving it and moving it to the right folder at a later time, sometimes just those few extra seconds seem enough of a nag that the notes are put off until they are eventually forgotten.
In this article, we’ll go over two ways to make this process easy, both through the GUI and through the Terminal. The text editor I am referencing in my examples is iA Writer, but you should be able to substitute that for your favorite text editor.
Setting up a service to create new README file in the selected folder and open it for editing in iA Writer.
Following these steps will allow you to automatically create a README file in a selected folder, and open it for editing in iA Writer.
First, open Automator, and create a new Service.
Next, Drag the “Run Shell Script” action to add it to the workflow. Delete any pre-populated text, and put the following lines:
Change the dropdown beside “Service receives selected” to be “folders” as the chosen object, and select “Finder” in the accompanying dropdown.
Finally, select the option for the dropdown labeled “Pass input:” to be “as arguments.”
It should look similar to this:
Save the action and give it a descriptive name that will mean something to you (ie. “Create new README”). This will be what is displayed in the services menu if you right-click on a folder.
The location of the file created by Automator is:
Create a keyboard shortcut to access the new folder service
At this point, the service should be accessible if you right-click on any folder and choose Services -> “Create new README” (or whatever you named your service). Clicking that should create a new file named README.md and open it in iA Writer, or simply open the file in iA Writer if it already exists in the folder.
However, wouldn’t it be much nicer to be able to simply use a keyboard shortcut to do the same thing? Now that we have the service created, it is just a matter of assigning a shortcut of your own choosing to accomplish that.
First, open System Preferences, and choose Keyboard. Select the Shortcuts tab, and choose Services in the left-hand menu. Now, scroll down to the “Files and Folders” section and you should see your new service listed there. Click it to highlight it, and then click “add shortcut” and type the keystroke you want to use to access it anytime a folder is selected. I chose CTRL-Command-R for mine.
Create a shortcut to do the same thing at the command-line in Terminal
This bash script is designed to make opening a file in iA Writer on the Mac from the Terminal command-line easy.
Once set up, running “ia README” at the command-line will open the file if it exists, exactly as the name is specified with no extension. Otherwise, it will create a new file called README.md with the md file extension, if it doesn’t already exist, and open it. If a file called README.md does already exist, it should be safely opened without being overwritten.
To implement this in your Terminal:
First, open Terminal and navigate to your home directory (“cd ~/”). Now open the .bash_profile file for editing (“nano .bash_profile”).
Finally, add either of the two options below to your .bash_profile file in your user directory (~/).
OPTION 2: SINGLE LINE EXAMPLE
At this point, you should be set up and ready to go.
Philippines 2019 Aug 19, 2019
June 2019 Jun 01, 2019
May 2019 May 01, 2019
April 2019 Apr 01, 2019
March 2019 Mar 01, 2019
Team Us Feb 26, 2019
February 2019 Feb 01, 2019
December 2018 Dec 19, 2018
July 2018 Jul 01, 2018
June 2018 Jun 01, 2018
May 2018 May 01, 2018
April 2018 Apr 01, 2018
December 2017 Dec 03, 2017
November 2017 Nov 05, 2017
October 2017 Oct 01, 2017
Bandina Week May 31, 2017
Book Review: The Plot to Kill God Apr 27, 2016
John (10 song series) Apr 27, 2016
Song for Songs Dec 31, 2015
Falling Away Aug 26, 2015
Easy README Files on Your Mac Jan 28, 2015
Word Clouds from the Gospels (and Acts) Sep 30, 2014
Lord of Your Life? Sep 21, 2014
Search the NY Times Archive Jul 24, 2014
The Farthest Peak Jul 08, 2014
Red River (When You See Me) Jun 26, 2014
Mapping shapefile polygons May 10, 2014
Using git to publish a website Sep 05, 2013
Roads We Don't Choose Aug 30, 2013
Killswitch/Mute Pedal Jul 09, 2013
Hold Out Jun 23, 2013
Muddle-headed Tyranny Jun 11, 2013
Arduino Arcade Controller May 13, 2013
A Place We Have Not Met May 04, 2013
Remember the Little Things Mar 27, 2013