Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ov - feature rich terminal pager

PkgGoDev Actions Status Go Report Card

ov is a terminal pager.

  • Can be used instead of less or more. It can also be used instead of tail -f.
  • ov also has an effective function for tabular text.

ov1.png

1. feature

  • Better support for Unicode and East Asian Width.
  • Support for compressed files (gzip, bzip2, zstd, lz4, xz).
  • Columns support column mode that can be selected by delimiter.
  • The header row can always be displayed.
  • Dynamic wrap/nowrap switchable.
  • Supports alternating row style changes.
  • Shortcut keys are customizable.
  • The style of the effect is customizable.
  • Supports follow-mode (like tail -f).
  • Supports following multiple files and switching when updated.
  • Supports the execution of commands that toggle both stdout and stder for display.
  • Supports incremental search and regular expression search.

2. install

2.1. deb package

You can download the package from releases.

curl -L -O https://github.com/noborus/ov/releases/download/vx.x.x/ov_x.x.x-1_amd64.deb
sudo dpkg -i ov_x.x.x-1_amd64.deb

2.2. rpm package

You can download the package from releases.

sudo rpm -ivh https://github.com/noborus/ov/releases/download/vx.x.x/ov_x.x.x-1_amd64.rpm

2.3. MacPorts (macOS)

sudo port install ov

2.4. Homebrew(macOS or Linux)

brew install noborus/tap/ov

2.5. pkg (FreeBSD)

pkg install ov

2.6. binary

You can download the binary from releases.

curl -L -O https://github.com/noborus/ov/releases/download/vx.x.x/ov_x.x.x_linux_amd64.zip
unzip ov_x.x.x_linux_amd64.zip
sudo install ov /usr/local/bin

2.7. go install

It will be installed in $GOPATH/bin by the following command.

go install github.com/noborus/ov@latest

2.8. go get(details or developer version)

First of all, download only with the following command without installing it.

go get -d github.com/noborus/ov
cd $GOPATH/src/github.com/noborus/ov

Next, to install to $GOPATH/bin, run the make install command.

make install

Or, install it in a PATH location for other users to use (For example, in /usr/local/bin).

make
sudo install ov /usr/local/bin

3. Usage

3.1. basic usage

ov supports open file name or standard input.

ov filename
cat filename|ov

Used by other commands by setting the environment variable PAGER.

export PAGER=ov

3.2. follow mode

Output appended data and move it to the bottom line (like tail -f).

ov --follow-mode /var/log/syslog
(while :; do echo random-$RANDOM; sleep 0.1; done;)|./ov  --follow-mode

ov-tail.gif

3.3. follow all mode

Same as follow-mode, and switches to the last updated file when there are multiple files.

ov --follow-all /var/log/nginx/access.log /var/log/nginx/error.log

3.4. exec mode

Execute the command to display stdout / stderr. Arguments after (--) are interpreted as command arguments.

ov --follow-all --exec -- make

ov-exec.gif

3.5. Search

Search by forward search / key(default) or the backward search ? key(defualt). Search can be toggled between incremental search, regular expression search, and case sensitivity. Displayed when the following are enabled in the search input prompt:

Function display (Default)key command option
Incremental search (I) alt+i --incremental
Regular expression search (R) alt+r --regexp-search
Case sensitive (Aa) alt+c -i, --case-sensitive

3.6. Mark

Mark the display position with the m key(default). The mark is decorated with StyleMarkLine and MarkStyleWidth.

Marks can be erased individually with the M key(default). It is also possible to delete all marks with the ctrl + delete key(default).

Use the >next and <previous (default) key to move to the marked position.

3.7. Mouse support

The ov makes the mouse support its control. This can be disabled with the option --disable-mouse.

If mouse support is enabled, tabs and line breaks will be interpreted correctly when copying.

Copying to the clipboard uses atotto/clipboard. For this reason, the 'xclip' or 'xsel' command is required in Linux/Unix environments.

Selecting the range with the mouse and then left-clicking will copy it to the clipboard.

Pasting in ov is done with the middle button. In other applications, it is pasted from the clipboard (often by pressing the right-click).

4. Called from other commands

4.1. psql

ov can be used as a pager for psql output.

Set environment variable PSQL_PAGER(PostgreSQL 11 or later).

export PSQL_PAGER='ov -w=f -H2 -F -C -d "|"'

You can also write in ~/.psqlrc in previous versions.

\setenv PAGER 'ov -w=f -H2 -F -C -d "|"'

The header(-H1) may be 1, because the second line of the header is a separator line. In that case, it is a good idea to set the header style of ov.yaml.

StyleHeader:
  Background: "darkcyan"

ov-psql.png

Select a column in column mode to quickly find long rows. The columns are clear even in wrapping.

ovcolumn.gif

Note that the column selection style is reverse by default. Therefore, specify a color for Foreground and reverse it.

StyleColumnHighlight:
  Foreground: "lightcyan"
  Reverse: true

4.1.1. pgcli

ov can be set as a pager for pgcli.

~/.config/pgcli/config

pager = 'ov -C -d "|" --skip-lines 1 -H1'

4.2. mysql

ov can be used as a pager for mysql or MySQL Shell.

Use the --pager option with the mysql client.

mysql --pager='ov -w=f -H3 -F -C -d "|"'

You can also write in ~/.my.cnf.

[client]
pager=ov -w=f -H3 -F -C -d "|"

ov-mysql.png

The header line for mysql is 3, but it's surrounded by a separator line. You can increase the display area by setting the skip line to 1 and the header to 1.

ov -w=f --skip-lines 1 -H1 -F -C -d "|"'

ov-mysql.gif

For mysqlsh, use the --pager option or set it while mysqlsh is running. For example, in js mode, it can be made persistent by the following command.

shell.options.setPersist("pager","ov -H1 --skip-lines 1 -C -w=false -d'|' -F")

SQL mode and Python mode.

\option --persist pager "ov -w=f -H1 --skip-lines 1 -F -C -d '|'"

4.2.1. mycli

ov can be set as a pager for mycli.

mycli reads the client section of ~/.my.cnf in mysql. Please refer to https://www.mycli.net/config.

[client]
pager="ov -C --skip-lines 1 --header 1 -d'|'"

4.3. git

ov can also be used as a git pager.

Set the pager in ~/.gitconfig.

[core]
	pager = ov -F

It can be used to display logs and diffs and can be searched for incremental search.

ov-git.png

4.4. man

ov can also be used as a man pager.

MANPAGER=ov

In the man page, you can set the color by the StyleOverStrike and StyleOverLine styles.

ov-man.png

StyleOverStrike:
  Foreground: "aqua"
  Bold: true
StyleOverLine:
  Foreground: "red"
  Underline: true

4.5. procs

procs supports pager. You can specify the pager in the configuration file.

It is convenient to set header(-H) to 1 or 2.

[pager]
command = "ov -H=1 -w=false -d=│"

4.6. bat

bat supports pager.

You can use it by setting the environment variable PAGER or BAT_PAGER.

export BAT_PAGER="ov -F"

4.7. csv

ov can also be used as a csv viewer.

ov -H1 -C -d',' -c MOCK_DATA.csv

ov-csv.png

5. command option

$ ov --help
ov is a feature rich pager(such as more/less).
It supports various compressed files(gzip, bzip2, zstd, lz4, and xz).

Usage:
  ov [flags]

Flags:
  -C, --alternate-rows            alternately change the line color
  -i, --case-sensitive            case-sensitive in search
  -d, --column-delimiter string   column delimiter (default ",")
  -c, --column-mode               column mode
      --completion                generate completion script [bash|zsh|fish|powershell]
      --config string             config file (default is $HOME/.ov.yaml)
      --debug                     debug mode
      --disable-mouse             disable mouse support
  -e, --exec                      exec command
  -X, --exit-write                output the current screen when exiting
  -A, --follow-all                follow all
  -f, --follow-mode               follow mode
  -H, --header int                number of header rows to fix
  -h, --help                      help for ov
      --help-key                  display key bind information
      --incsearch                 incremental search (default true)
  -n, --line-number               line number mode
  -F, --quit-if-one-screen        quit if the output fits on one screen
      --regexp-search             regular expression search
      --skip-lines int            skip the number of lines
  -x, --tab-width int             tab stop width (default 8)
  -v, --version                   display version information
  -w, --wrap                      wrap mode (default true)

It can also be changed after startup.

6. Key bindings

 [Escape], [q]                * quit
 [ctrl+c]                     * cancel
 [Q]                          * output screen and quit
 [h], [ctrl+f1], [ctrl+alt+c] * display help screen
 [ctrl+f2], [ctrl+alt+e]      * display log screen
 [ctrl+l]                     * screen sync
 [ctrl+f]                     * follow mode toggle
 [ctrl+a]                     * follow all mode toggle
 [ctrl+alt+r]                 * enable/disable mouse

	Moving

 [Enter], [Down], [ctrl+N]    * forward by one line
 [Up], [ctrl+p]               * backward by one line
 [Home]                       * go to begin of line
 [End]                        * go to end of line
 [PageDown], [ctrl+v]         * forward by page
 [PageUp], [ctrl+b]           * backward by page
 [ctrl+d]                     * forward a half page
 [ctrl+u]                     * backward a half page
 [left]                       * scroll to left
 [right]                      * scroll to right
 [ctrl+left]                  * scroll left half screen
 [ctrl+right]                 * scroll right half screen
 [g]                          * number of go to line

	Move document

 []]                          * next document
 [[]                          * previous document
 [ctrl+k]                     * close current document

	Mark position

 [m]                          * mark current position
 [M]                          * remove mark current position
 [ctrl+delete]                * remove all mark
 [>]                          * move to next marked position
 [<]                          * move to previous marked position

	Search

 [/]                          * forward search mode
 [?]                          * backward search mode
 [n]                          * repeat forward search
 [N]                          * repeat backward search

	Change display

 [w], [W]                     * wrap/nowrap toggle
 [c]                          * column mode toggle
 [C]                          * color to alternate rows toggle
 [G]                          * line number toggle

	Change Display with Input

 [p], [P]                     * view mode selection
 [d]                          * delimiter string
 [H]                          * number of header lines
 [ctrl+s]                     * number of skip lines
 [t]                          * TAB width

	Key binding when typing

 [alt+c]                      * case-sensitive toggle
 [alt+r]                      * regular expression search toggle
 [alt+i]                      * incremental search toggle

7. config

You can set style and key bindings in the setting file.

Please refer to the sample ov.yaml configuration file.

8. Customize

8.1. Style customization

You can customize the following items.

  • StyleAlternate
  • StyleHeader
  • StyleOverStrike
  • StyleOverLine
  • StyleLineNumber
  • StyleSearchHighlight
  • StyleColumnHighlight
  • StyleMarkLine

Specifies the color name for the foreground and background colors. Specify bool values for Bold, Blink, Shaded, Italic, and Underline.

[Example]

StyleAlternate:
  Background: "gray"
  Bold: true
  Underline: true

8.2. Key binding customization

You can customize key bindings.

[Example]

    down:
        - "Enter"
        - "Down"
        - "ctrl+N"
    up:
        - "Up"
        - "ctrl+p"

See ov.yaml for more information..