Skip to the content

The Textsmith manual

Bookmarks in other terminals

Bookmarks need not stay in The Textsmith. textsmith bm export writes them as ordinary bash and zsh functions:

textsmith bm export -o ~/.config/textsmith/bookmarks.sh

Then, in ~/.bashrc or ~/.zshrc on any machine or terminal:

[ -f ~/.config/textsmith/bookmarks.sh ] && . ~/.config/textsmith/bookmarks.sh

Each bookmark becomes a function of the same name. It takes the same arguments and says the same sentence when they are wrong:

site() {
  (( $# == 2 )) || { printf '%s\n' 'site takes 2 arguments: source, destination; you gave '"$#." >&2; return 2; }
  rsync -rltvP --delete "${1}" forge:/var/www/"${2}"
}

Defaults, <..>, counts and commands per machine all carry over. A piped bookmark becomes a function to pipe into: ls | count. Bookmarks without a name, and additions that are not commands on their own (#quiet: 2>/dev/null), are left out. Run the export again after changing your bookmarks.

A function hides any command of the same name, so a bookmark named after a builtin or a program on your PATH (install, say) is left out, and the export tells you. Rename the bookmark, or give every function a prefix with --prefix ts_ (ts_install, ts_site). --keep-clashes exports them anyway.