oviewer

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2020 License: MIT Imports: 21 Imported by: 0

README

Oviewer

Oviewer is a feature rich terminal pager.

feature

  • Better support for unicode and wide width.
  • Support for compressed files (gzip, bzip2, zstd, lz4, xz).
  • Header row can be fixed.
  • Dynamic wrap / nowrap switchable.

install

go get -u github.com/noborus/oviewer...

Usage

The command name of Oviewer is ov.

Oviewer supports open file name or standard input.

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

Usage:
  ov [flags]

Flags:
  -i, --case-sensitive       case-sensitive
      --config string        config file (default is $HOME/.oviewer.yaml)
      --debug                Debug mode
  -X, --exit-write           Output the current screen when exiting
  -H, --header int           number of header rows to fix
  -h, --help                 help for ov
  -F, --quit-if-one-screen   Quit if the output fits on one screen
  -x, --tab-width int        tab stop (default 8)
  -v, --version              display version information
  -w, --wrap                 wrap mode (default true)
psql

Set environment variable PSQL_PAGER(PostgreSQL 11 or later).

export PSQL_PAGER="ov -w=f -H2 -F"

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

\setenv PAGER 'ov -w=f -H2 -F'
mysql

Use the --pager option with the mysql client.

mysql --pager="ov -w=f -H3 -F"

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

[client]
pager=ov -w=f -H3 -F

Key bindings

  • q,Esc - quit
  • Q - output screen and quit
Move
  • HOME - go to begin of line

  • END - go to end of line

  • KEY_UP - backward by one line

  • KEY_DOWN, Enter - forward by one line

  • PgUP, Ctrl+b - backward by page

  • PgDn, Ctrl+v - forward by page

  • Ctrl+d - forward a half page

  • Ctrl+u - backward a half page

  • KEY_LEFT - scroll to left

  • KEY_RIGHT - scroll to right

  • Ctrl+KEY_LEFT - scroll to left page

  • Ctrl+KEY_RIGHT - scroll to right page

Mode
  • w - wrap/nowrap toggle
Input Mode
  • / - forward search mode
  • ? - previous search mode
  • H - number of header lines
  • g - number of go to line

Keys in search mode

  • Ctrl+i - case-sensitive/insensitive toggle
Key after search input mode
  • n - for next match
  • N - for next match in reverse direction

Documentation

Overview

Package oviewer provides a pager for terminals.

Index

Constants

This section is empty.

Variables

View Source
var Debug bool

Functions

func New

func New() *root

New returns the entire structure of oviewer.

Types

type Mode

type Mode int

type Model

type Model struct {
	// contains filtered or unexported fields
}

The Model structure contains the values for the logical screen.

func NewModel

func NewModel() *Model

NewModel returns Model.

func (*Model) ReadAll

func (m *Model) ReadAll(r io.Reader) error

ReadAll reads all from the reader to the buffer. It returns if beforeSize is accumulated in buffer before the end of read.

Directories

Path Synopsis
cmd
ov command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL