octopus | the octopress commander


How to Set Your Default Text Editor in Octopus

The Octopus write and edit commands automatically open a Markdown file in the text editor of your choice. If you can open the application from the command line with a filename argument, then Octopus can be configured to use it.

Assign the Default Editor

The path to your default editor (or the command for the editor if it is on your PATH) is used to define a shell variable in your shell startup file. If you are using the bash shell, this will be your ~/.bashrc or ~/.bash_profile file. Octopus uses the $OCEDITOR variable in these commands. Let's set it up.

Open your shell startup file in a text editor and enter a new line that includes a variable definition following the syntax shown in the examples below:

Default to Vim

export $OCEDITOR="vim"

Default to Emacs

export $OCEDITOR="emacs"

Default to Sublime Text

export $OCEDITOR="subl"

Default to Text Mate

export $OCEDITOR="mate"

Default to Another Text Editor

export $OCEDITOR="/path/to/the/editor"

If your terminal is open, run a source command on the file that you modified, either source .bashrc or source .bash_profile, to export the variable in the open shell and you should be good to go. This final step is not necessary the next time that you open your terminal.

Once these configuration steps are complete, the write and edit commands will automatically launch your file in the text editor that you specified.