Skip to content

Terminal ​

Terminal logo

The terminal in Kloud Workspace runs zsh with oh-my-zsh plugins, a starship prompt, fzf history search, and clipboard commands that reach your browser.

ZSH and Plugins ​

The shell is zsh, enhanced by the oh-my-zsh framework. A fixed set of oh-my-zsh plugins is enabled by default: 1password, auto-venv, docker, encode64, fzf-history, git, golang, helm, kubectl, npm, python, pip, ssh-agent and zsh-autosuggestions.

To modify the default set of plugins, set these variables:

  • WS_ZSH_PLUGINS: Enables built-in oh-my-zsh plugins.
  • WS_ZSH_ADDITIONAL_PLUGINS: Loads additional oh-my-zsh plugins.
sh
docker run \
  -e WS_ZSH_PLUGINS="kubectl npm python pip" \
  ghcr.io/kloudkit/workspace:v0.6.0
sh
docker run \
  -e WS_ZSH_ADDITIONAL_PLUGINS="laravel" \
  ghcr.io/kloudkit/workspace:v0.6.0

⚠️ WARNING

WS_ZSH_PLUGINS replaces the whole default set, including fzf-history (the Ctrl+R search below) and zsh-autosuggestions. List every plugin you want to keep, or use WS_ZSH_ADDITIONAL_PLUGINS instead. A name that is not an oh-my-zsh plugin is skipped without an error.

Prompt ​

The terminal prompt is powered by starship and matches the workspace's color theme. Modules are shown based on the specific context of the prompt. For instance, the Python module appears in a Python project, or while a virtual environment is active.

Prompt

To hide a prompt module, set its variable to either 1 or true:

  • WS_TERMINAL_PROMPT_HIDE_DOCKER_CONTEXT: Hides Docker context info in the prompt.
  • WS_TERMINAL_PROMPT_HIDE_HOSTNAME: Hides the container hostname in the prompt.
  • WS_TERMINAL_PROMPT_HIDE_KUBERNETES_CONTEXT: Hides current Kubernetes context in the prompt.
  • WS_TERMINAL_PROMPT_HIDE_NODEJS_VERSION: Hides active Node.js version in the prompt.
  • WS_TERMINAL_PROMPT_HIDE_PYTHON_VERSION: Hides active Python version in the prompt.
  • WS_TERMINAL_PROMPT_HIDE_USER: Hides the current user in the prompt.

For example, to hide the Docker and Python modules, add the following lines to your deployment:

sh
docker run \
  -e WS_TERMINAL_PROMPT_HIDE_DOCKER_CONTEXT=1 \
  -e WS_TERMINAL_PROMPT_HIDE_PYTHON_VERSION=1 \
  ghcr.io/kloudkit/workspace:v0.6.0

Press Ctrl+R to search your shell history with fzf (exact substring matches by default).

By default, duplicate entries are removed and event numbers are hidden. The following environment variables customize the behavior:

  • WS_ZSH_FZF_HISTORY_BIND: Key binding that triggers fzf history search.
  • WS_ZSH_FZF_HISTORY_ARGS: Default arguments passed to fzf for history search.
  • WS_ZSH_FZF_HISTORY_EXTRA_ARGS: Additional arguments appended to the default fzf arguments.
  • WS_ZSH_FZF_HISTORY_REMOVE_DUPLICATES: Removes duplicate entries from history search results.
  • WS_ZSH_FZF_HISTORY_DATES_IN_SEARCH: Includes ISO 8601 date timestamps in search results.
  • WS_ZSH_FZF_HISTORY_EVENT_NUMBERS: Shows event numbers in history search results.
  • WS_ZSH_FZF_HISTORY_END_OF_LINE: Moves cursor to end-of-line after selecting a history entry.
  • WS_ZSH_FZF_HISTORY_QUERY_PREFIX: Prefix prepended to the fzf query when the buffer is non-empty.

Clipboard ​

The workspace provides clipboard commands that connect the terminal to your browser's clipboard.

Available Commands ​

  • pbcopy
  • pbpaste
  • xclip
  • xsel
  • ws-cli clip copy
  • ws-cli clip paste
sh
# Copy to clipboard
echo "Hello World" | pbcopy
cat file.txt | xclip -sel c
echo "data" | xsel -b

# Paste from clipboard
pbpaste
xclip -o -sel c
xsel -b -o

# Use in pipelines
pbpaste | grep "pattern"
xclip -o | jq .

ℹ️ INFO

All clipboard commands communicate with the editor running in your browser, which connects the terminal to your native clipboard.

All X11 selections (primary, secondary, clipboard) map to the same browser clipboard.

Colorful Output ​

Many CLI tools color their output by default, in the workspace's color theme, for easier reading.

Ls animation

Ip animation

Tree animation

Cat animation

Clickable File Paths

Paths printed as file:// URIs are clickable and open the file in the editor. Because the workspace runs remotely, they resolve against the remote filesystem, so they work in the browser instead of pointing at your local machine.

Released under the MIT License