Send Feedback
Skip to content

Embedded Line Editor (kxline)

This page describes kxline, the embedded line editor used by KDB-X when you interact with the q terminal. It explains how kxline behaves in an interactive session, how to control it using environment variables, and which line-editing and history features it provides.

Overview

kxline is the embedded line editor used by KDB-X for interactive q sessions. It provides basic line editing and session history. This removes the need to install and use external tools such as rlwrap for most terminal-based workflows.

Supported features

Line editing

  • Backspace (also ^H) and Delete (also ^D)
  • Cursor movement with Left / Right and Home / End (also ^A / ^E)
  • Move by word using Ctrl+Left / Ctrl+Right (also Alt+B / Alt+F)
  • Delete previous word (^W)
  • Delete to beginning or end of the line (^U / ^K)

Session history

  • Traverse history using Up / Down
  • Search history with ^R
  • Type to search
  • Use Backspace to erase
  • Cancel with ^G
  • Read the history file ~/.q_history on startup and append to it on exit

Configuration

  • kxline runs by default on Linux and macOS when q detects an interactive terminal (TTY).
  • To disable kxline, set KX_LINE=0 before starting q.
  • To force q to run interactively regardless of TTY detection, set KX_TTY=1.

Example, forcing interactive mode in a pipe:

cat | KX_TTY=1 q

Next steps