Skip to content

Commit

Permalink
Merge pull request #224 from noborus/help-jump-target
Browse files Browse the repository at this point in the history
Added jump-taget to help and README.md
  • Loading branch information
noborus authored Dec 10, 2022
2 parents ae857b4 + c3f01f2 commit e9012f9
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 16 deletions.
32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ov is a terminal pager.
* 3.15. [Mouse support](#Mousesupport)
* 3.16. [Multi Color Highlight](#MultiColorHighlight)
* 3.17. [Plain](#Plain)
* 3.18. [Jump Target](#JumpTarget)
* 4. [Command option](#Commandoption)
* 5. [Key bindings](#Keybindings)
* 6. [Customize](#Customize)
Expand Down Expand Up @@ -352,6 +353,18 @@ Supports undecorating ANSI escape sequences.
The option is `--plain` (or `-p`).
After startup, toggle the original decoration (default key `ctrl+e`).

### 3.18. <a name='JumpTarget'></a>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`).
It can be entered after startup (default key `j`).

## 4. <a name='Commandoption'></a>Command option

```console
Expand Down Expand Up @@ -382,6 +395,7 @@ Flags:
-h, --help help for ov
--help-key display key bind information
--incsearch incremental search (default true)
-j, --jump-target string jump-target
-n, --line-number line number mode
-p, --plain disable original decoration
-F, --quit-if-one-screen quit if the output fits on one screen
Expand All @@ -405,12 +419,12 @@ It can also be changed after startup.
[Q] * output screen and quit
[ctrl+q] * set output screen and quit
[ctrl+z] * suspend
[h], [ctrl+F1], [ctrl+alt+c] * display help screen
[ctrl+F2], [ctrl+alt+e] * display log screen
[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+alt+r] * enable/disable mouse
[ctrl+f3], [ctrl+alt+r] * enable/disable mouse

Moving

Expand Down Expand Up @@ -455,6 +469,7 @@ It can also be changed after startup.
[c] * column mode toggle
[C] * alternate rows of style toggle
[G] * line number toggle
[ctrl+e] * original decoration toggle

Change Display with Input

Expand All @@ -463,21 +478,22 @@ It can also be changed after startup.
[H] * number of header lines
[ctrl+s] * number of skip lines
[t] * TAB width
[.] * multi color highlight

Section

[alt+d] * section delimiter regular expression
[ctrl+F3], [alt+s] * section start position
[space] * next section
[^] * previous section
[space], [ctrl+down] * next section
[^], [ctrl+up] * previous section
[9] * last section
[F2] * follow section mode toggle

Close and reload

[ctrl+F9], [ctrl+alt+s] * close file
[F5], [ctrl+alt+l] * reload file
[F4], [ctrl+alt+w] * watch mode
[ctrl+alt+l], [F5] * reload file
[ctrl+alt+w], [F4] * watch mode
[ctrl+w] * set watch interval

Key binding when typing
Expand All @@ -502,6 +518,8 @@ You can customize the following items.
* StyleColumnHighlight
* StyleMarkLine
* StyleSectionLine
* StyleMultiColorHighlight
* StyleJumpTargetLine

Specifies the color name for the foreground and background [colors](https://pkg.go.dev/github.com/gdamore/tcell/v2#pkg-constants).
Specify bool values for Reverse, Bold, Blink, Dim, Italic, and Underline.
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/spf13/cobra v1.6.1
github.com/spf13/viper v1.14.0
github.com/ulikunitz/xz v0.5.10
golang.org/x/exp v0.0.0-20221207211629-99ab8fa1c11f
golang.org/x/exp v0.0.0-20221208152030-732eee02a75a
golang.org/x/sync v0.1.0
golang.org/x/term v0.3.0
)
Expand All @@ -30,7 +30,7 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jwalton/go-supportscolor v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
Expand Down Expand Up @@ -245,8 +245,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20221207211629-99ab8fa1c11f h1:90Jq/vvGVDsqj8QqCynjFw9MCerDguSMODLYII416Y8=
golang.org/x/exp v0.0.0-20221207211629-99ab8fa1c11f/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp v0.0.0-20221208152030-732eee02a75a h1:4iLhBPcpqFmylhnkbY3W0ONLUYYkDAW9xMFLfxgsvCw=
golang.org/x/exp v0.0.0-20221208152030-732eee02a75a/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand Down
14 changes: 14 additions & 0 deletions ov-less.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ StyleMarkLine:
Background: "darkgoldenrod"
StyleSectionLine:
Background: "green"
StyleMultiColorHighlight:
- Foreground: "red"
- Foreground: "aqua"
- Foreground: "yellow"
- Foreground: "fuchsia"
- Foreground: "lime"
- Foreground: "blue"
- Foreground: "grey"
StyleJumpTargetLine:
Underline: false

# Keybind
# Special key
Expand Down Expand Up @@ -184,6 +194,10 @@ KeyBind:
- "["
toggle_mouse:
- "ctrl+alt+r"
multi_color:
- "."
jump_target:
- "alt+j"

Mode:
psql:
Expand Down
14 changes: 14 additions & 0 deletions ov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ StyleMarkLine:
Background: "darkgoldenrod"
StyleSectionLine:
Background: "green"
StyleMultiColorHighlight:
- Foreground: "red"
- Foreground: "aqua"
- Foreground: "yellow"
- Foreground: "fuchsia"
- Foreground: "lime"
- Foreground: "blue"
- Foreground: "grey"
StyleJumpTargetLine:
Underline: true

# Keybind
# Special key
Expand Down Expand Up @@ -171,6 +181,10 @@ KeyBind:
toggle_mouse:
- "ctrl+f3"
- "ctrl+alt+r"
multi_color:
- "."
jump_target:
- "j"

Mode:
Psql:
Expand Down
1 change: 1 addition & 0 deletions oviewer/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func KeyBindString(k KeyBind) string {
k.writeKeyBind(&b, actionSkipLines, "number of skip lines")
k.writeKeyBind(&b, actionTabWidth, "TAB width")
k.writeKeyBind(&b, actionMultiColor, "multi color highlight")
k.writeKeyBind(&b, actionJumpTarget, "jump target")

fmt.Fprint(&b, gchalk.Bold("\n\tSection\n"))
fmt.Fprint(&b, "\n")
Expand Down
6 changes: 3 additions & 3 deletions oviewer/oviewer.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,6 @@ func NewConfig() Config {
StyleSectionLine: OVStyle{
Background: "green",
},
StyleJumpTargetLine: OVStyle{
Underline: true,
},
StyleMultiColorHighlight: []OVStyle{
{Foreground: "red"},
{Foreground: "aqua"},
Expand All @@ -382,6 +379,9 @@ func NewConfig() Config {
{Foreground: "blue"},
{Foreground: "grey"},
},
StyleJumpTargetLine: OVStyle{
Underline: true,
},
General: general{
TabWidth: 8,
MarkStyleWidth: 1,
Expand Down

0 comments on commit e9012f9

Please sign in to comment.