Using the Textsmith Terminal Bookmarks: A Quick Tutorial
Ishe Chinyoka
The Textsmith terminal has a builtin bookmarking feature. This way one is able to bookmark his or her frequently used commands with ease. For example,
On any line, type in a command you frequently use.
Then go to the beginning of the line with the just typed in command and give that command a name.
Add a colon after the name.
As the first character on that line, add a hash symbol.
If the command has arguments, place those arguments between angle brackets:
<argument-name>
Bookmarking an rsync command
In this post, we are going to bookmark the rsync command. rsync is a powerful tool to synchronise two directories, whether they are on the same machine or not.
It takes two arguments–the source and the destination–for it to work.
In this exercise, we are going to create a new bookmark called “copy” that uses the rsync command.
This means that the bookmark we are going to create must take two arguments to fill in the places for the source and the destination. So let us just call our argument names <source> and <destination>
The command structure we want to bookmark looks like this: rsync -aPv <source> <destination>
So you have to:
1. Just type the command like this on an empty line but do not press enter.
2. Next press `Ctrl-a` to go to the beginning of the line.
3. Now give this a name, "copy".
To give this a name, just add a hash symbol and the name of this bookmark. There must be no space in-between. Then add a colon to show that the command is done along with its name. So the line looks like this:
#copy: rsync -aPv <source> <destination>Now press Alt-m to bookmark this command.
Invoking the bookmark
Next time you want to use this, just type the bookmark name. Now don’t press the enter after typing the name. You will get an error from bash or zsh unless you already have a command called “copy”–of which it will be run.
Anyway, to run our “copy”, just type copy and remember it has two arguments: source and destination. So pass in those arguments.
For example, if I want to sync my ~/Documents directory to a backup media on /media/backup-docs, I would do this
copy ~/Documents /media/backup-docs/Then press Alt-ENTER
The command will be run.
The good thing is that textsmith will simply substitute the bookmark name for what that bookmark points to.
The command will have the original commands and the values you typed in for source and destination.
Why this substitution? The idea is that the command is going to be recorded in the shell history, and the bookmark name itself will not.
If you want to list all the bookmarks you have, just press Alt-Shift-b and
- Press the
ENTERkey to run any bookmark from there; or - Press
Ctrl-Enterto edit a command.
This way, some commands you may struggle to remember the correct positioning of not only arguments but even options are better dealt with by the textsmith as bookmarks.
The Textsmith can create bookmarks that are aware of the machine on which they are run. It will only run a command based on what machine it is on.
Conclusion
In the next installment, I am going to show the difference between how the Textsmith terminal differs from how Hande handles bookmarks. In fact, the two differ in the scope of their bookmarking and what they can capture.
Until then, happy forging in the terminal!