History

Introduction

Octo uses the readline library to provide editing, history and searching. This document provides a few pointers on how to use readline with Octo, but the user is best served by reading the readline documentation for finer points.

History File

Octo reads history when started; and saves it when shutting down. The history file is by default in ~/.octo_history, but can be overridden to a different location by using the Octo Configuration file octo_history setting. The reference config file in $ydb_dist/plugin/octo/octo.conf stores the history in ~/.octo_history, which is the same as the default if a config file does not exist.

History Length

History length by default is 500. It can be overridden using the octo_history_max_length setting in the Octo Configuration file. The reference config file in $ydb_dist/plugin/octo/octo.conf sets this to 500, which is the same as the default if a config file does not exist.

This history length applies only when octo saves the history back to the file at process exit time; irrespective of this length, Octo will still read as much history as available in the history file pointed to by the octo_history config setting. And also irrespective of this length, while Octo is running, there is no history trimming being performed, so you can have more history while running Octo than the limit specified here. This can be changed by setting history-size in the INPUTRC file. history-size has two effects: 1. Stifles runtime history so that you only see however many entries it specifies; and 2. only that number of entries is saved to the history file when exiting Octo. We think using history-size is confusing for end users and is best avoided.

When saving is done at exit time, history will be trimmed to octo_history_max_length.

If you set octo_history_max_length to zero, it disables saving history. If you set octo_history_max_length to less than zero, it will be clamped down to zero.

The INPUTRC file

Octo can use a Readline Init file. Octo's Readline application name for use in $if blocks is "Octo". For example:

$if Octo
set editing-mode vi
$endif

Usual History Operations

The the usual operations to perform with history are as follows:

  • Use the up arrow and down arrow to navigate up and down your history list.

  • Use CTRL-R shortcut to reverse search history.

  • Use \s<enter> to view your history.