Code Monkey home page Code Monkey logo

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 mikelolasagasti avatar minhtrancccp 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  avatar  avatar

ov's Issues

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

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?

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

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

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.

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

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?

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!

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

[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!

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?

[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

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

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

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.

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!

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

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?

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?

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.

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

```

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

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.

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

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

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 ?

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
}

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.

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.

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

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?

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)

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

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.

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.