Psst, are you a Vim user? Check out this article here with keybinds in mind.

First, make sure you're signed in to your Snipline account, either on the web or download the Desktop application.

Snipline's main UI can be split into three segments, Search bar, Command list, and Command bar.

Lets add our first snippet. If we press the green + icon next to the search bar we'll be greeted with the Snippet form. Here we can fill-in the name, an alias, and a command.

Image of the Snippet form.

The name can be used as a short reminder of what the command does and can be helpful for searching. The command is the command which will be copied to our clipboards. Finally, the alias is an optional field which can be used as a shortcut for referencing a snippets in the command bar.

For our first snippet, use the name Summary of subdirectory sizes, the alias duh and the command du -h --max-depth=1 ./. Press save at the bottom of the page.

Tip: This command summarizes the size of all the child subdirectories in the current directory.

Back in the main interface we can see our new snippet has been added. The number 1 appears to the left of it. Depending on what we search this snippet will change but the number 1 will always appear first.

Preview of the Snippet in the Command List

If we type in du into the search bar then the list still shows the snippet. The search updates as your type. Press Enter to take yourself out of the search, ready for copying commands. To clear the search bar, press Esc or the x icon in the field.

Searching Snippets

To copy the command we can either use our mouse and click into the Command Bar at the bottom of the page or use the keyboard shortcut, :. (You must be out of the search to do this - You can keep the search term active by pressing Enter while in the search input).

From the Command Bar type the number of the command (in this case, it's 1). Press enter to copy it to your clipboard.

Tip: You an also copy a command by hovering over the snippet and clicking the clipboard icon.

Hovering over the snippet shows the copy/edit buttons

Dynamic Snippets

Now that we can create and copy commands, let's edit a command to make it dynamic.

We can edit a snippet by hovering over it with our mouse and clicking the cogwheel icon. This will take us to the edit snippet page.

We'll change the snippet to this similar but slightly different command:

du -h --max-depth=#{[Depth=1]} #{[Directory=.]}

Variables in Snipline start with #{[ and end with ]}. Inbetween here we can give the variable a description name that will help us remember what it means later on. We can also add a default value by adding an = after the name. In this example we've given Depth a default of 1 and Directory a default of . (Current directory).

Let's test the command. Click save at the bottom of the form to go back to the main UI.

Type :1 into the command bar (or hover over the  snippet and press the clipboard icon). We'll now be prompted to fill in the Depth and the Directory.

Image of variable prompt

Keep the depth as 1 and press Enter . Next, change the directory to ~/ (Your user home directory). Now let's try pasting this command into the terminal. We can see the command that has been copied looks like this

du -h --max-depth1 ~/

Pasting the command into iTerm

And that's the basics of Snipline! Read on for more advanced usage!