Skip to content

Instantly share code, notes, and snippets.

@cuth
Last active November 8, 2021 07:08
Show Gist options
  • Save cuth/a0a68174d2adf64ed1c72f335de738db to your computer and use it in GitHub Desktop.
Save cuth/a0a68174d2adf64ed1c72f335de738db to your computer and use it in GitHub Desktop.
Load websites, search Google or open local files; all within HyperTerm

HyperTerm aliases

HyperTerm is a terminal that is built with Electron. Electron is like building apps with a baked-in browser (Chromium). So what makes HyperTerm easily unique from other terminals is the ability to load websites right inside the terminal window.

To open a website in Hyperterm, just type the URL in the command line:

$ http://firstaidgit.io/

If it is a site you use frequently, bookmark it as an alias:

alias firstaidgit='http://firstaidgit.io/ '

Or use a function alias to search:

# bash
google() {
  https://www.google.com/#q=${1// /+}
}

# zsh
google() {
  echo zsh: command not found: https://www.google.com\/#q=${1// /+}
}
$ google hyperterm\ plugins

But browsers can open more than webpages; they can handle quite a few file formats and draw them straight from your file system. Use the file protocol to directly open a file inside Hyperterm:

$ file:///Users/name/photos/trees.jpg

Of course, that would be obnoxious to type so use the function alias below:

# bash
file() {
  if [[ $1 == /* ]]; then
    file://${1// /%20}
  else
    file://$(pwd)/${1// /%20}
  fi
}

# zsh
file() {
  if [[ $1 == /* ]]; then
    echo zsh: command not found: file://${1// /%20}
  else
    echo zsh: command not found: file://$(pwd)/${1// /%20}
  fi
}
$ file trees.jpg

Open svg, gif, mp3 without leaving the terminal. This has been possible since Hyperterm 0.7.

But beware! The default background of the webview in Hyperterm 0.7 is black, so any text file will look blank and you may think the terminal has crashed. Just focus the tab bar and hit ctrl+c. Text files are better with your typical terminal apps anyway.

@brndto
Copy link

brndto commented Apr 23, 2018

Looks like you're talking about www.hyper.is instead of www.hyperterm.org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment