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
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.