Code Monkey home page Code Monkey logo

ov's Introduction

ov - feature rich terminal pager

PkgGoDev Actions Status Go Report Card

ov is a terminal pager.

  • ov can be used instead of less, more, tail -f/-F and watch.
  • ov also has an effective function for tabular text.

ov-image.png

1. Feature

  • Supports files larger than memory (v0.30.0 or later).
  • Regular files can be opened quickly even if they are large (v0.30.0 or later).
  • Supports fixed header line display (both wrap/nowrap).
  • Supports column mode, which recognizes columns by delimiter.
  • Also, in column mode, there is a column-rainbow mode that colors each column.
  • Support columns with fixed widths instead of delimiters (v0.30.0 or later).
  • Supports section-by-section movement, splitting sections by delimiter.
  • Dynamic wrap/nowrap switchable.
  • Supports alternating row styling.
  • Shortcut keys are customizable.
  • The style of the effect is customizable.
  • Supports follow-mode (like tail -f).
  • Support follow mode by file name (like tail -F) (v0.30.0 or later).
  • Supports follow-section, which is displayed when the section is updated.
  • Supports following multiple files and switching when updated(follow-all).
  • Supports the execution of commands that toggle both stdout and stderr for display.
  • Supports watch mode, which reads files on a regular basis.
  • Support watch in exec mode (equivalent to watch command) (v0.30.0 or later).
  • Supports incremental search and regular expression search.
  • Supports multi-color to highlight multiple words individually.
  • Better support for Unicode and East Asian Width.
  • Supports compressed files (gzip, bzip2, zstd, lz4, xz).
  • Suitable for tabular text. psql, mysql, csv, etc...
  • Support filter function (&pattern equivalent of less) (v0.34.0 or later).

1.1. Not supported

  • Does not support syntax highlighting for file types (source code, markdown, etc.)

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. winget(windows)

winget install -e --id noborus.ov

2.6. pkg (FreeBSD)

pkg install ov

2.7. Arch Linux

You can install ov using an AUR helper.

Choose an AUR package:

2.8. nix (nixOS, Linux, or macOS)

ov is available as a nix package. You can install it with

nix profile install nixpkgs#ov

if you use flakes, or using nix-env otherwise:

nix-env -iA nixpkgs.ov

2.9. 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.10. go install

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

go install github.com/noborus/ov@latest

2.11. 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

2.12. Completion

You can generate completion scripts for bash, zsh, fish, and powershell.

Example:

2.12.1. bash

ov --completion bash > /etc/bash_completion.d/ov

2.12.2. zsh

ov --completion zsh > /usr/share/zsh/site-functions/_ov

For zinit users.

zinit load 'https://github.com/noborus/ov/blob/master/ov.plugin.zsh'

2.12.3. fish

ov --completion fish > ~/.config/fish/completions/ov.fish

2.12.4. powershell

ov --completion powershell completion powershell | Out-String | Invoke-Expression

3. Usage

(default key key) indicates the key that can be specified even after starting the same function as the command line option.

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

See the ov site for more use cases.

3.2. Config

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

ov will look for a configuration file in the following paths in descending order:

$XDG_CONFIG_HOME/ov/config.yaml
$HOME/.config/ov/config.yaml
$HOME/.ov.yaml

On Windows:

%USERPROFILE%/.config/ov/config.yaml
%USERPROFILE%/.ov.yaml

Create a config.yaml file in one of the above directories. If the file is in the user home directory, it should be named .ov.yaml.

Please refer to the sample ov.yaml configuration file.

Note

If you like less key bindings, copy ov-less.yaml and use it.

3.3. Header

The --header (-H) (default key H) option fixedly displays the specified number of lines.

ov --header 1 README.md

Related styling: StyleHeader.

3.3.1. Skip

When used with the --skip-lines (default key ctrl+s) option, it hides the number of lines specified by skip and then displays the header.

ov --skip-lines 1 --header 1 README.md

3.4. Column mode

Specify the delimiter with --column-delimiter(default key is d) and set it to --column-mode(default key is c) to highlight the column.

ov --column-delimiter "," --column-mode test.csv

Regular expressions can be used for the --column-delimiter. Enclose in '/' when using regular expressions.

ps aux | ov -H1 --column-delimiter "/\s+/" --column-rainbow --column-mode

Related styling: StyleColumnHighlight,StyleColumnRainbow.

3.5. Column rainbow mode

You can also color each column individually in column mode. Specify --column-rainbow(default key is ctrl+r) in addition to the --column-mode option.

Color customization is possible. Please specify 7 or more colors in config.yaml.

StyleColumnRainbow:
  - Foreground: "white"
  - Foreground: "aqua"
  - Foreground: "lightsalmon"
  - Foreground: "lime"
  - Foreground: "blue"
  - Foreground: "yellowgreen"
  - Foreground: "red"

Style specifications other than Foreground can also be specified.

StyleColumnRainbow:
    - Foreground: "white"
      Background: "red"
    - Foreground: "aqua"
      Underline: true
    - Foreground: "#ff7f00"
      Background: "blue"
      Bold: true
    - Foreground: "lime"
      Italic: true
    - Foreground: "blue"
      Dim: true
    - Foreground: "yellowgreen"
    - Foreground: "red"

Related styling: StyleColumnRainbow.

3.6. Column-width

For output like ps, using --column-width is a better way to separate columns than using spaces as delimiters.

You can specify the column width with --column-width (default key alt+o).

ps aux|ov -H1 --column-width --column-rainbow

ps-ov.png

This column-width feature is implemented using guesswidth.

3.7. Wrap/NoWrap

Supports switching between wrapping and not wrapping lines.

The option is --wrap, specify --wrap=false (default key w, W) if you do not want to wrap.

3.8. Alternate-Rows

Alternate row styles with the --alternate-rows(-C) (default key C) option The style can be set with Style customization.

ov --alternate-rows test.csv

Related styling: StyleAlternate.

3.9. Section

You specify --section-delimiter(default key alt+d), you can move up and down in section units. The start of the section can be adjusted with --section-start(default key ctrl+F3, alt+s).

section.png

The section-delimiter is written in a regular expression (for example: "^#"). (Line breaks are not included in matching lines).

For example, if you specify "^diff" for a diff that contains multiple files, you can move the diff for each file.

3.9.1. Section header

If you specify --section-header, the section delimiter line is displayed as a header.

ov --section-delimiter "^#" --section-header README.md

It is also useful as a pager for git.

The number of lines in section-header can be changed.

You can specify the number of lines using the --section-header-num option or key input(default key F7).

[pager]
	diff = "ov -F --section-delimiter '^diff' --section-header"
	log = "ov -F --section-delimiter '^commit' --section-header --section-header-num 3"

Related styling: StyleSectionLine.

3.10. Multiple files

ov can also open multiple files.

ov file1 file2

Multiple files are each opened as a document and can be navigated using the Next Document ] key (default), Previous Document [ key (default).

Related Styling: Customizing the bottom status line.

3.11. Follow mode

--follow(-f)(default key ctrl+f) prints appended data and moves 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

3.12. Follow name

You can specify the file name to follow with --follow-name(like tail -F). Monitor file names instead of file descriptors.

ov --follow-name /var/log/nginx/access.log

3.13. Follow all mode

--follow-all(-A)(default key ctrl+a) is the same as follow mode, it switches to the last updated file if there are multiple files.

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

3.14. Follow section mode

Use the --follow-section(default key F2) option to follow by section. Follow mode is line-by-line, while follow section mode is section-by-section. Follow section mode displays the bottom section. The following example is displayed from the header (#) at the bottom.

ov --section-delimiter "^#" --follow-section README.md

Note

Watch mode is a mode in which --follow-section and --section-delimiter "^\f" are automatically set.

3.15. Exec mode

Use the --exec (-e) option to run the command and display stdout/stderr separately. Arguments after (--) are interpreted as command arguments.

Shows the stderr screen as soon as an error occurs, when used with --follow-all.

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

In exec mode (other than Windows) the output is opened by opening a pty. Therefore, the command is likely to be printed in color.

ov --exec -- eza -l

3.16. Search

Search by forward search / key(default) or the backward search ? key(default). 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 config file
Incremental search (I) alt+i --incremental Incsearch
Regular expression search (R) alt+r --regexp-search RegexpSearch
Case-sensitive (Aa) alt+c -i, --case-sensitive CaseSensitive
Smart case-sensitive (S) alt+s --smart-case-sensitive SmartCaseSensitive

Specify true/false in config file.

CaseSensitive: false
RegexpSearch: false
Incsearch: true
SmartCaseSensitive: true

Related styling: StyleSearchHighlight

3.17. Pattern

The pattern option allows you to specify a search at startup.

ov --pattern install README.md

3.18. Filter

Filter input is possible using the & key(default). The filter input creates a new document only for the lines that match the filter.

Move next document ] and previous document [ key(default) allow you to move between the filter document and the original document.

The K(shift+k) key (default) closes all documents created by the filter.

You can also specify a filter using the command line option --filter.

ov --filter "install" README.md

The filter is a regular expression.

ov --filter "^#" README.md

Also, specify the non-matching line instead of the non-matching line.

If you press ! on & while inputting a filter, non-matching lines will be targeted.

The command line option for this can be specified with --non-match-filter.

ov --non-match-filter info /var/log/syslog

3.19. Caption

You can specify a caption instead of the file name in status line to display it.

ls -alF|ov --caption "ls -alF"

It can also be specified as an environment variable.

export OV_CAPTION="ls -alF"
ls -alF|ov

3.20. 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.

Related styling: StyleMarkLine.

3.21. Watch

ov has a watch mode that reads the file every N seconds and adds it to the end. When you reach EOF, add '\f' instead. Use the --watch(-T) option. Go further to the last section. The default is'section-delimiter', so the last loaded content is displayed.

for example.

ov --watch 1 /proc/meminfo

3.22. Mouse support

The ov makes the mouse support its control. This can be disabled with the option --disable-mouse(default key ctrl+F3, ctrl+alt+r).

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).

Also, if mouse support is enabled, horizontal scrolling is possible with shift+wheel.

3.23. Multi color highlight

This feature styles multiple words individually. .key(default) enters multi-word input mode. Enter multiple words (regular expressions) separated by spaces.

For example, error info warn debug will color errors red, info cyan, warn yellow, and debug magenta.

It can also be specified with the command line option --multi-color(-M)(default key .). For command line options, pass them separated by ,(comma).

For example:

ov --multi-color "ERROR,WARN,INFO,DEBUG,not,^.{24}" access.log

multi-color.png

Color customization is possible. Please specify 7 or more colors in config.yaml.

StyleMultiColorHighlight:
  - Foreground: "red"
    Reverse: true
  - Foreground: "aqua"
    Underline: true
  - Foreground: "yellow"
    Background: "blue"
  - Foreground: "fuchsia"
  - Foreground: "lime"
  - Foreground: "blue"
  - Foreground: "#c0c0c0"

Related styling: StyleMultiColorHighlight.

3.24. Plain

Supports disable decoration ANSI escape sequences. The option is --plain (or -p) (default key ctrl+e).

3.25. Jump target

You can specify the lines to be displayed in the search results. This function is similar to --jump-target of less. Positive numbers are displayed downwards by the number of lines from the top(1). Negative numbers are displayed up by the number of lines from the bottom(-1). . (dot) can be used to specify a percentage. .5 is the middle of the screen(.5). You can also specify a percentage, such as (50%).

This option can be specified with --jump-target(or -j) (default key j).

If section is specified as the --jump-target, the display will start from the beginning of the section as much as possible and the jump-target will be changed.

ov --section-delimiter "^#" --jump-target section README.md

Related styling: StyleJumpTarget.

3.26. View mode

You can also use a combination of modes using the --view-mode(default key p) option. In that case, you can set it in advance and specify the combined mode at once.

For example, if you write the following settings in ov.yaml, the csv mode will be set with --view-mode csv.

ov --view-mode csv test.csv
Mode:
  p:
    Header: 2
    AlternateRows: true
    ColumnMode: true
    LineNumMode: false
    WrapMode: true
    ColumnDelimiter: "|"
    ColumnRainbow: true
  m:
    Header: 3
    AlternateRows: true
    ColumnMode: true
    LineNumMode: false
    WrapMode: true
    ColumnDelimiter: "|"
  csv:
    Header: 1
    AlternateRows: true
    ColumnMode: true
    LineNumMode: false
    WrapMode: true
    ColumnDelimiter: ","
    ColumnRainbow: true

3.27. Output on exit

--exit-write -X(default key Q) option prints the current screen on exit. This looks like the display remains on the console after the ov is over.

By default, it outputs the amount of the displayed screen and exits.

ov -X README.md

You can change how much is written using --exit-write-before and --exit-write-after(default key ctrl+q). --exit-write-before

--exit-write-before specifies the number of lines before the current position(top of screen). --exit-write-before 3 will output from 3 lines before.

--exit-write-after specifies the number of lines after the current position (top of screen).

--exit-write-before 3 --exit-write-after 3 outputs 6 lines.

3.28. Save

If the file input is via a pipe, you can save it by pressing the save buffer (default S) key.

This will put you in input mode, so enter the file name. Only the buffer currently in memory is saved.

(Save)file:savefile.txt

If the file name already exists, select Overwrite, Append, or Cancel.

overwrite? (O)overwrite, (A)append, (N)cancel

4. How to reduce memory usage

Since v0.30.0 it no longer loads everything into memory. The first chunk from the beginning to the 10,000th line is loaded into memory and never freed. Therefore, files with less than 10,000 lines do not change behavior.

The --memory-limit option can be used to limit the chunks loaded into memory. Memory limits vary by file type.

Also, go may use a lot of memory until the memory is freed by GC. Also consider setting the environment variable GOMEMLIMIT.

export GOMEMLIMIT=100MiB

4.1. Regular file (seekable)

regular file memory

Normally large (10,000+ lines) files are loaded in chunks when needed. It also frees chunks that are no longer needed. If --memory-limit is not specified, it will be limited to 100.

ov --memory-limit-file 3 /var/log/syslog

Specify MemoryLimit in the configuration file.

MemoryLimitFile: 3

You can also use the --memory-limit-file option and the MemoryLimitFile setting for those who think regular files are good memory saving.

4.2. Other files, pipes(Non-seekable)

non-regular file memory

Non-seekable files and pipes cannot be read again, so they must exist in memory.

If you specify the upper limit of chunks with --memory-limit or MemoryLimit, it will read up to the upper limit first, but after that, when the displayed position advances, the old chunks will be released. Unlimited if --memory-limit is not specified.

cat /var/log/syslog | ov --memory-limit 10

It is recommended to put a limit in the config file as you may receive output larger than memory.

MemoryLimit: 1000

5. Command option

short long purpose
-C, --alternate-rows alternately change the line color
--caption string custom caption
-i, --case-sensitive case-sensitive in search
-d, --column-delimiter character column delimiter character (default ",")
-c, --column-mode column mode
--column-rainbow column mode to rainbow
--column-width column mode for width
--completion string generate completion script [bash|zsh|fish|powershell]
--config file config file (default is $XDG_CONFIG_HOME/ov/config.yaml)
--debug debug mode
--disable-column-cycle disable column cycling
--disable-mouse disable mouse support
-e, --exec command execution result instead of file
-X, --exit-write output the current screen when exiting
-a, --exit-write-after int number after the current lines when exiting
-b, --exit-write-before int number before the current lines when exiting
--filter string filter search pattern
-A, --follow-all follow multiple files and show the most recently updated one
-f, --follow-mode monitor file and display new content as it is written
--follow-name follow mode to monitor by file name
--follow-section section-by-section follow mode
-H, --header int number of header lines to be displayed constantly
-h, --help help for ov
--help-key display key bind information
--hscroll-width [int|int%|.int] width to scroll horizontally [int|int%|.int] (default "10%")
--incsearch[=true|false] incremental search (default true)
-j, --jump-target [int|int%|.int|'section'] jump target [int|int%|.int|'section']
-n, --line-number line number mode
--memory-limit int number of chunks to limit in memory (default -1)
--memory-limit-file int number of chunks to limit in memory for the file (default 100)
-M, --multi-color strings comma separated words(regexp) to color .e.g. "ERROR,WARNING"
--non-match-filter string filter non match search pattern
--pattern string search pattern
-p, --plain disable original decoration
-F, --quit-if-one-screen quit if the output fits on one screen
--regexp-search regular expression search
--section-delimiter regexp regexp for section delimiter .e.g. "^#"
--section-header enable section-delimiter line as Header
--section-header-num int number of header lines (default 1)
--section-start int section start position
--skip-extract skip extracting compressed files
--skip-lines int skip the number of lines
--smart-case-sensitive smart case-sensitive in search
-x, --tab-width int tab stop width (default 8)
-v, --version display version information
--view-mode string apply predefined settings for a specific mode
-T, --watch seconds watch mode interval(seconds)
-w, --wrap[=true|false] wrap mode (default true)

It can also be changed after startup.

6. Key bindings

key action
[Escape], [q] * quit
[ctrl+c] * cancel
[Q] * output screen and quit
[ctrl+q] * set output screen and quit
[ctrl+z] * suspend
[h], [ctrl+alt+c], [ctrl+f1] * 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+f3], [ctrl+alt+r] * enable/disable mouse
[S] * save buffer to file
Moving
[Enter], [Down], [ctrl+N] * forward by one line
[Up], [ctrl+p] * backward by one line
[Home] * go to top of document
[End] * go to end of document
[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
[ctrl+shift+left] * scroll left specified width
[ctrl+shift+right] * scroll right specified width
[shift+Home] * go to beginning of line
[shift+End] * go to end of line
[g] * go to line(input number or .n or n% allowed)
Move document
[]] * next document
[[] * previous document
[ctrl+k] * close current document
[K] * close all filtered documents
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
[&] * filter search mode
Change display
[w], [W] * wrap/nowrap toggle
[c] * column mode toggle
[alt+o] * column width toggle
[ctrl+r] * column rainbow toggle
[C] * alternate rows of style toggle
[G] * line number toggle
[ctrl+e] * original decoration toggle(plain)
Change Display with Input
[p], [P] * view mode selection
[d] * column delimiter string
[H] * number of header lines
[ctrl+s] * number of skip lines
[t] * TAB width
[.] * multi color highlight
[j] * jump target(.n or n% or section allowed)
Section
[alt+d] * section delimiter regular expression
[ctrl+F3], [alt+s] * section start position
[space] * next section
[^] * previous section
[9] * last section
[F2] * follow section mode toggle
[F7] * section header number
Close and reload
[ctrl+F9], [ctrl+alt+s] * close file
[ctrl+alt+l], [F5] * reload file
[ctrl+alt+w], [F4] * watch mode
[ctrl+w] * set watch interval
Key binding when typing
[alt+c] * case-sensitive toggle
[alt+s] * smart case-sensitive toggle
[alt+r] * regular expression search toggle
[alt+i] * incremental search toggle
[!] * non-match toggle
[Up] * previous candidate
[Down] * next candidate
[ctrl+c] * copy to clipboard.
[ctrl+v] * paste from clipboard

7. Customize

7.1. Style customization

You can customize the following items.

  • StyleAlternate
  • StyleHeader
  • StyleOverStrike
  • StyleOverLine
  • StyleLineNumber
  • StyleSearchHighlight
  • StyleColumnHighlight
  • StyleMarkLine
  • StyleSectionLine
  • StyleMultiColorHighlight
  • StyleColumnRainbow
  • StyleJumpTargetLine

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

[Example]

StyleAlternate:
  Background: "gray"
  Bold: true
  Underline: true
item name value example
Foreground "color name" or "rgb" "red"
Background "color name" or "rgb" "#2a2a2a"
Reverse true/false true
Bold true/false true
Blink true/false true
Dim true/false false
Italic true/false false
Underline true/false false

Specify StyleMultiColorHighlight and StyleColumnRainbow in an array.

StyleMultiColorHighlight
  - Foreground: "red"
    Reverse: true
  - Foreground: "aqua"
    Underline: true
StyleColumnRainbow:
  - Foreground: "white"
    Background: "black"
  - Foreground: "aqua"
    Background: "black"
    Underline: true
  - Background: "lightsalmon"

7.2. Customizing the bottom status line

You can customize the bottom status line.

[Example]

Prompt
  Normal:
    ShowFilename: false
    InvertColor: false
    ProcessOfCount: false
item name description default
ShowFilename Display file name true
InvertColor Display file name inverted and changed color true
ProcessOfCount Update the progress while counting the number of lines true

7.3. Key binding customization

You can customize key bindings.

[Example]

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

See ov.yaml for more information.

8. VS

The following software can be used instead. If you are not satisfied with ov, you should try it.

  • less
    • less is versatile, feature-rich, and the de facto standard for pagers.
  • most
    • most is a general-purpose pager with split-window capabilities.
  • pspg
    • pspg is a pager suitable for output of psql etc.
  • moar
    • moar is a pager with code highlighting.
  • slit
    • slit is a pager suitable for viewing logs.
  • lnav
    • lnav analyzes logs and can be used as a viewer.
  • peep
    • peep is a pager that can work in a small pane.

9. Work together

The following are not actually pagers and do not conflict. can work together.

  • bat
    • bat is an alternative to cat. It supports a lot of highlighting and automatically calls the pager.
  • delta
    • delta processes the diff for easy viewing and displays it. Call the pager automatically.

Please look at the documentation portal to configure them.

10. Contributing

We welcome contributions to this project! Here are some ways you can contribute:

  1. Submit bugs and feature requests in the issue tracker.
  2. Review and test open pull requests.
  3. Improve or translate the documentation.
  4. Write code to fix bugs or add new features.

Before contributing, please read our Code of Conduct. We expect all contributors to follow these guidelines to ensure a welcoming and friendly environment for everyone.

To start contributing:

  1. Fork the repository.
  2. Create a new branch for your changes.
  3. Make your changes in your branch.
  4. Submit a pull request with your changes.

We will review your pull request as soon as possible. Thank you for your contribution!

ov's People

Contributors

0mp avatar ccoveille avatar cmvanb avatar corneliusroemer avatar cybertailor avatar deepsourcebot avatar einenlum avatar farcaller avatar herbygillot avatar iloveitaly avatar julianxhokaxhiu avatar kianmeng avatar kseistrup avatar maw avatar mlitwiniuk avatar noborus avatar resolritter avatar sshine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ov's Issues

How to disable wrap mode is not clear from the help

The help says:

  -w, --wrap                       wrap mode (default true)

but I had trouble finding the way to disable wrap mode.

# NG
$ ov --wrap false sample.txt

# OK
$ ov --wrap=false sample.txt

If the help was something like this, it would be kinder:

  -w, --wrap=[true|false]                      wrap mode (default true)

Feature request: hide/show status line, colors for status line

Often the status line gives little to no information at all, being able to hide it as an option and show/hide it dynamically would make for a better UX, specially at night when the white status background is very bright.

User colors would also be appreciated.

[Enhancement] feature request in ov

Hello Expert,

One feature request if possible and if you could enable space key press to scroll the file as all other existing pager doing... i know you have key binding to achieve the task but it is good to have by default second if you could add ctrl + > and ctrl + < key bind to jump directly on top and bottom of page this is also available by default in all the pager programs rest all looks good so far ...

I tried the keybinding for page_up/page_down with space and other key combination but result is not what i am expecting . Second i also noticed ov line number is wasting unnecessary terminal space need to be optimised. Below screenshot you can see this space can be reduced when line number enabled.

image

Feature Request: Save buffer to file

I am using ov as the pager of psql, and sometimes I would like to save the result of the query to a file.
Is it possible to add "Save to file" like less's -O and s?

[REQ] Follow mode

If I do:

(while :; do echo random-$RANDOM; sleep 0.01; done;) | ov  

The bottom status line shows STDIN and stops at 100 lines and it doesn't matter what terminal size I use or whether I have interacted with the page. Using the sync-hotkey didn't do anything. This behavior is odd.

Is there a "follow mode" planned?

--
Anyway, very good pager! I like it very much!

Use $XDG_CONFIG_HOME instead of $HOME directory for configuration file

Hello,

I like your pager software! Very cool.

I'm replacing less with ov. I need to configure ov for similar keybindings to less, so I added the configuration file .ov.yaml. I noticed that the program expects it to be in $HOME directory.

I understand this is a common place for unix software to place files, but it is cleaner if software follows the XDG Base Directory Specification. The default path for configuration files is then indicated by $XDG_CONFIG_HOME, the default value is $HOME/.config/.

This way, users have control over where software configuration files are located, and the dotfiles won't clutter the home directory.

Will you consider switching the default path for the configuration file?

If you wish, I can open a PR for this.

best regards

ov changes cursor in vscode terminal

In vscode terminal with the setting

"terminal.integrated.cursorStyle": "line"

when invoking ov on a file (make sure that it is long enough so that it stays in pager mode) then quitting, the cursor changes from the expected line type to block

begin_left and end_right should change active column

Currently, begin_left and end_right don't change active column. That is, suppose the first column is active, press Shift-End and the last column is displayed, but the active column is still the first one, then press left and nothing happens (counter-intuitively!). I expected that the last -1 column would be active.
Is it possible to change this behavior or introduce new commands which scroll to beginning/end of line and set first/last column to be active?

Please support a leading count for keybindings

This Issue is the next level of #28.

Many users are used to be able to use a count for keybindings. While this may be only nice-to-have (but still very handy) in most cases, it becomes very apparent with the g keybinding.

It basically has the same functionality in ov as in less, but in ov it is quite cumbersome.

To jump to line 10 in less, one can type:

10g

In ov one has to type:

g10<enter>

Not much, as it is only 1 keystroke more, but since the order of the count and the commands keybinding is exchanged it is hard to use for people accustomed to less.

It gets even worse when trying to jump to the beginning of the file.

In less one can type:

g

by just omitting the count.

I ov it is still necessary to type:

1g<enter>

Therefore I think it would be a nice addition to support a count for commands as this can come in handy for most commands and makes ov much easier to use for previous less-users.

Incremental Search

I'm on the hunt for a new pager to replace less , mainly for man page paging. As it seams non of the pagers I found have incremental searching. Would it be too difficult to implement ?

Add examples using pager

pager is often called and used by other applications.
It is easy to start using if there is a usage example.

clipboard on Windows 11 with WSL not working as expected with mouse support enabled

I have a Windows 11 host using Windows Terminal 1.16 connected to a WSL instance.
I can not figure out why but the default mouse configuration and the clipboard is not working as expected. Nothing I select gets added to the clipboard. I disabled mouse support and then I can select text which goes to clipboard.
Is that expected behaviour on Windows?

cannot get QuitSmall to work

Hi Noboru,

I want to use the oviewer module for my application but I cannot get QuitSmall to work -- I set it to true but I notice two odd behaviors:

  1. The screen is cleared by oviewer.NewRoot() (before calling (*Root).Run() )
  2. (*Root).Run() does not quit when the "document" has a handful of lines.

Test program below.

Passing to ov a file with a handful lines, or running "echo test | ./ov -F" yields the behavior I need, but how to achieve that same behavior when my application is an external user of oviewer?

Thanks in advance!

Eloy Paris.-

==========

package main

import (
	"bytes"
	"fmt"
	"log"
	"time"

	"github.com/noborus/ov/oviewer"
)

func main() {
	var b bytes.Buffer

	for i := 0; i < 5; i++ {
		b.WriteString(fmt.Sprintf("%d\n", i))
	}

	fmt.Println("Sleeping 3 seconds before calling NewRoot()")
	time.Sleep(3 *time.Second)

	ov, err := oviewer.NewRoot(&b)
	if err != nil {
		log.Fatal(err)
	}
	// oviewer.NewRoot() clears the screen; why?

	ov.QuitSmall = true

	time.Sleep(3 *time.Second)

	if err := ov.Run(); err != nil {
		log.Fatal(err)
	}

	if ov.IsWriteOriginal {
		ov.WriteOriginal()
	}
}

Originally posted by @peloy in #163

Binding to Ctrl+h not working

I tried binding ctrl+h to a couple of functions, but in any case, it did not work; Nothing happened.

KeyBind:
    top:
        - "ctrl+h"

My terminal produces 0x08 on ctrl+h.

スクリーンショット 2023-07-11 16 32 06

$ ov --version
ov version 0.30.0 rev:ff0c648

Make ov as golang package

Hey,there.

I would like to use ov in another application. Until,now,ov exists as standalone application. Can it be provided as golang package so that it can be used in other applications too?

Change the project layout

Stop the main package in cmd/ov/.
Move the main package to just below the repository.

Should I change the repository name?

Set default parameters globally, based on extension

Is it possible to change the --section param based on the file extension? I'm using bat, I wonder if there's a way to send over some metadata or somehow combine the two?

When paging a .py file it would be great to have def|class pre-filled as the --section

logfmt colums?

Would it be possible to detect or set the input parsing to process logfmt style text and create the columns (using the keys as head) on the fly? Afaik the output gets re-rerendered so it could be possible to deal with new keys that suddenly increase the number of columns. If this would be possible one would also probably want to have a filter to include/exclude columns base on the key names.

[Feature Request] Option To Disable Default Keybinds

Would you consider adding an option to disable default keybinds? Users would then be required to manually specify the key that they want each action to be bound to. This will be helpful in disabling unused keybinds instead of having to manually specify a placeholder like ' ' for each action.

Please support more standard less keybindings

It would ease the use of ov if it would provide all the same keybindings as less. Currently only some of its keybindungs are supported. Currently unsupported are e.g. j and k for scrolling down and up or space and ctrl-f for pagewise scrolling.

Text after certain character disappears

Text after " ◯" disappears.

sample2.txt

$ cat sample2.txt
 column1 |  column2
---------+------------
 ◯ほげ   | 2023-06-04
 b       | 2023-06-05

$ ov --config /dev/null sample2.txt

スクリーンショット 2023-06-04 3 55 11

Deleted "◯" from the file, and "ほげ" was displayed correctly, so I guess "◯" was the culprit.
The terminal emulator is iTerm2 and this problem occurs only when Ambiguous characters are double-width is checked.
スクリーンショット 2023-06-04 4 04 49
When it is not checked, it is displayed as follows:
スクリーンショット 2023-06-04 4 04 33

Ov takes extra space while line number enabled

Hi Expert,

I have noticed OV is taking lot of terminal space when line number enabled. it would be good to surpasses the line number column width so when line number enable ov only take space as it required to save terminal width for other useful purpose. Thanks

Allow for smartcase search

Vim has the 'smartcase' option which works as follows:

Override the 'ignorecase' option if the search pattern contains upper case characters. Only used when the search pattern is typed and 'ignorecase' option is on.

I use that option in Vim, so I would like to have it in ov as well. It could be implemented as follows:

if config.SmartCaseSearch {
  caseSensitive = searchInput.HasUpperCase()
} else {
  caseSensitive = config.CaseSensitive
}

Don't read entire entire file into memory

One of the property of pagers like less is that they are memory bounded by default, so they don't read the entire file into memory and can easily be used on huge files (say 100s of GBs)

Looking at less source code, this doesn't seem trivial to implement.

But this would be a great win for ov!

Option of horizontal scroll amount

Currently left and right commands scroll one column by one, so it takes time to scroll very long lines. It would be so nice if this was configurable. less has the option for it:

   -# or --shift
          Specifies the default number of positions to scroll
          horizontally in the RIGHTARROW and LEFTARROW commands.  If
          the number specified is zero, it sets the default number
          of positions to one half of the screen width.
          Alternately, the number may be specified as a fraction of
          the width of the screen, starting with a decimal point: .5
          is half of the screen width, .3 is three tenths of the
          screen width, and so on.  If the number is specified as a
          fraction, the actual number of scroll positions is
          recalculated if the terminal window is resized.

Thanks for the tool. I've been using it for months and now I really like it!

[Feature Request] Mark Deletion And Visualization

I see that mark navigation and creation are already implemented so would it be possible to also add mark deletion and visualization (something like an icon in the sidebar)?

Also thanks for making ov, I have been looking for a less replacement for quite some time.

Support offsetting search result (show context)

In less, there is the --jump-target=n option which allows the position of the given search result to be offset. Its function is described in the less man page: "...If any form of the -j option is used... forward searches (invoked with "n" or "N") begin at the line immediately after the target line, and repeated backward searches begin at the target line... For example, if '-j4' is used, the target line is the fourth line on the screen, so forward searches begin at the fifth line on the screen."

This feature is really useful when searching through the content being displayed on screen. Many times when I search for a term, I want to see the context that came before it along as what comes after. Thus, if the search term is scrolled to the vertical center of the screen (rather than the top), the user can see the lines that come both before and after the term. This is just one use-case for the less flag mentioned above. I rely on this feature daily, and it is one of the only things keeping me from completely switching from less to ov.

Consider the following example searching for the term 'search' using less FILE_PATH
image

versus using less -j .5 FILE_PATH
image

[Feature Request] Mark Toggle Keybind

Would you consider simplifying the mark keybindings a bit by either adding a new mark keybind that allows users to toggle the setting of a mark, or changing the behavior of the current mark keybind to allow for toggling? Each press of the bind would be removing a mark if it already exists, or adding a mark if it does not already exist.

Also thanks for implementing #206, it is very helpful.

wrong column width

using command: ps aux|ov -H1 --column-width --column-rainbow

screenshot_2023-08-04_14-55-45

scrolling right

screenshot_2023-08-04_14-56-41

OV pager has small latency

Hi Expert,

I have syntax highlighter enable for my terminal app by using Chromaterm tool and i have noticed while reading log and syntax highlighter enable ov is having some latency so syntax highlight is taking some delay to trigger where as if i use less/moar/bat pager i do not have this behaviour.

Please add support for rereading the current file when jumping to the end

In less when jumping to the end of the file via END or G the file is also reread. That is very handy when viewing logfiles that grow while viewing them.

For example,

  • open a logfile
  • press G or END to jump to the end of the file
  • press G or END again

The second invocation (and in fact also the first invocation) would also display lines that were added to the file after step 2 (the first jump to the files end).

Help is inconsistent regarding actual behaviour of [Home], [End] keys

Hi, cool project – tried it yesterday and instantly liked it!
The help has this entry:

[Home] * go to begin of line
[End]    * go to end of line

but when I press [Home] or [End], it moves the cursor to beginning/end of the current file, which also seems to be the default in less.
Is the documentation wrong or the implementation?
Is there another way to move the curser to beginning/end of line?

Hangs in Git Bash (MINGW46) on Windows 10

The pager hangs and does nothing
e.g.

package main

import (
	"bytes"

	"github.com/noborus/ov/oviewer"
)

func main() {

	doc, err := oviewer.NewDocument()
	if err != nil {
		panic(err)
	}

	if err := doc.ReadAll(bytes.NewBufferString("hiho")); err != nil {
		panic(err)
	}

	ov, err := oviewer.NewOviewer(doc)
	if err != nil {
		panic(err)
	}
	if err := ov.Run(); err != nil {
		panic(err)
	}
}

```

Last column is not fully displayed

Problem

The last column is not fully displayed.
See that the value of the second column is truncated to the length of the first column.

スクリーンショット 2023-06-03 21 49 31

To reproduce

sample.txt

$ ov --config ~/.config/ov/psql.yaml --view-mode psql sample.txt
General:
  TabWidth: 4

Mode:
  psql:
    Header: 2
    AlternateRows: false
    ColumnMode: true
    LineNumMode: false
    WrapMode: false
    ColumnDelimiter: "|"

Environment

  • ov version 0.30.0 rev:ff0c648 from homebrew
  • macOS

It'd be useful to support regex as a column separator

I'm thinking for some option to make px aux|ov -c work in an easy way and honestly I'd prefer some smartness on the ov's side (e.g. to detect basic columns like awk does). Ideally -c alone would match against \s+ as a column separator, but otherwise it'd be useful if a regexp could be a separator at all, as vanilla ps idents with several spaces.

Yes, I know it can be fixed on ps side, but I think it's be a quality-of-life improvement done on the ov side.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.