Skip to content

Instantly share code, notes, and snippets.

@astoilkov
Created March 15, 2021 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astoilkov/2ffccee92dc88f21ae28f33ba9e0bee9 to your computer and use it in GitHub Desktop.
Save astoilkov/2ffccee92dc88f21ae28f33ba9e0bee9 to your computer and use it in GitHub Desktop.

Custom Commands

⚠️ Nota extensibility is highly experimental. You can experiment with it and give us feedback but expect a lot of changes.

Custom commands are an easy way to extend Nota. They show in the Command Palette...(⌘⇧P) just like any other Nota built-in command.

You can create a new custom command by opening the Command Palette...(⌘⇧P) and selecting "Create New Custom Command". This will create a file that will be pre-filled with a template command that when executed copies the opened file's path to the clipboard.

#!/bin/bash
# @parameters file
pbcopy $1

@parameters

In the previous example you could have noticed the @parameters file comment. This comment tells Nota to pass the path to the currently opened file as a first argument to the script.

You can pass a few different values to the paste hook:

  • file – the path to the currently opened file
  • workspace – the path to the currently opened workspace

You tell Nota which values to pass to the script add a @parameters decorator with the parameters separated by spaces: @parameters file workspace. This will make: $1 the currently edited file and $2 the path to the currently opened workspace.

Ideas for custom commands

  • Open Random Note – Some people use Nota for a knowledge-base. This command can help you discover some notes what you may have forgotten.
  • Open Daily Note – Some people use Nota for journalling. In that case you can make a command that creates a file with the current date as a name and opens it.
  • Upload as Gist – Upload the currently opened file as gist. Useful for sharing something quickly. You can use Potentially the best command line gister.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment