Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ability to customize Visual highlight #45

Merged
merged 28 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e7c450a
feat: add ability to customize Visual highlight
mikesmithgh Nov 4, 2023
572858f
chore(build): auto-generate vimdoc
github-actions[bot] Nov 4, 2023
d713ded
docs: README and vimdoc improvements
mikesmithgh Nov 4, 2023
dc5358f
chore(build): auto-generate vimdoc
github-actions[bot] Nov 4, 2023
032abc3
Update README.md
mikesmithgh Nov 4, 2023
554bb67
chore(build): auto-generate vimdoc
github-actions[bot] Nov 4, 2023
e49dd2d
chore: readme and vimdocs
mikesmithgh Nov 4, 2023
7794668
chore(build): auto-generate vimdoc
github-actions[bot] Nov 4, 2023
0fbb02d
chore: modify sed preformat panvimdoc
mikesmithgh Nov 4, 2023
15aec06
chore(build): auto-generate vimdoc
github-actions[bot] Nov 4, 2023
3d5da40
chore: formatting
mikesmithgh Nov 4, 2023
4880040
chore(build): auto-generate vimdoc
github-actions[bot] Nov 4, 2023
aeae662
chore: vimdoc improvements
mikesmithgh Nov 5, 2023
aec4fc4
chore(build): auto-generate vimdoc
github-actions[bot] Nov 5, 2023
67626f0
chore: fix list
mikesmithgh Nov 5, 2023
ca9709a
Merge remote-tracking branch 'refs/remotes/origin/feat-visual-hl' int…
mikesmithgh Nov 5, 2023
20f3f52
chore(build): auto-generate vimdoc
github-actions[bot] Nov 5, 2023
f52e1be
chore: vimdoc fix
mikesmithgh Nov 5, 2023
e6e5c55
chore(build): auto-generate vimdoc
github-actions[bot] Nov 5, 2023
d2ccbfe
chore: typo
mikesmithgh Nov 5, 2023
ca55fdd
Merge remote-tracking branch 'refs/remotes/origin/feat-visual-hl' int…
mikesmithgh Nov 5, 2023
423ae48
chore: use markdown link
mikesmithgh Nov 5, 2023
919dae0
chore(build): auto-generate vimdoc
github-actions[bot] Nov 5, 2023
0ec6c24
chore: remove oopsie
mikesmithgh Nov 5, 2023
264ae25
chore: update comment
mikesmithgh Nov 5, 2023
bb2fd63
Update README.md
mikesmithgh Nov 6, 2023
0dca439
chore(build): auto-generate vimdoc
github-actions[bot] Nov 6, 2023
2bee1f4
chore: fix typo
mikesmithgh Nov 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: stylua
name: codespell
on:
push:
branches:
Expand Down
24 changes: 18 additions & 6 deletions .github/workflows/vimdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,37 @@ jobs:

- name: preformat README.md
run: |
mkdir tmp_preformat_readme
cp README.md tmp_preformat_readme/README.md
sed -E -e 's/\[!(NOTE|WARNING|IMPORTANT)\]/`\1`/Ig' -e 's/<summary>(.+)<\/summary>/- \1\r/g' \
-e 's/<a.*href.*"(.+)".*>(.+)<\/a>/[\2](\1)/g' < README.md > tmp_preformat_readme/README.md
mkdir -p tmp_vimdoc_workdir
cp README.md tmp_vimdoc_workdir/README.md
sed -E -e's/\[!(NOTE|WARNING|IMPORTANT)\].*/[!\1]\n>/Ig' -e 's/.*<summary>(.+)<\/summary>/- VIMDOC_SUMMARY_HEADER `\1`\n/g' \
-e 's/<a.*href.*"(.+)".*>(.+)<\/a>/\2 <\1>/g' <README.md >tmp_vimdoc_workdir/README.md

- name: panvimdoc
uses: kdheepak/panvimdoc@main
with:
vimdoc: kitty-scrollback.nvim
pandoc: "tmp_preformat_readme/README.md"
pandoc: "tmp_vimdoc_workdir/README.md"
version: "NVIM v0.10+"
toc: true
demojify: true
dedupsubheadings: false
treesitter: true

- name: postformat kitty-scrollback.nvim.txt
run: |
cp doc/kitty-scrollback.nvim.txt tmp_vimdoc_workdir/kitty-scrollback.nvim.txt
sed -E \
-e 's/\[!(IMPORTANT)\]/|‼| |\1|/Ig' \
-e 's/\[!(NOTE)\]/`ℹ` `\1` /Ig' \
-e 's/\[!(WARNING)\]/*⚠* *\1* /Ig' \
-e 's/^- VIMDOC_SUMMARY_HEADER(.*)/\n`-`\1/g' \
-e 's/^[[:space:]]+(>.*)/\n\1/g' \
-e 's/^[[:space:]]+(<.*)/\1/g' \
<tmp_vimdoc_workdir/kitty-scrollback.nvim.txt >doc/kitty-scrollback.nvim.txt

- name: cleanup preformat README.md
run: |
rm -rf tmp_preformat_readme
rm -rf tmp_vimdoc_workdir

- uses: stefanzweifel/git-auto-commit-action@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

*.orig
.worktrees/
.DS_Store
tmp_vimdoc_workdir/
125 changes: 67 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Navigate your Kitty scrollback buffer to quickly search, copy, and execute comma

<a href="https://github.com/mikesmithgh/kitty-scrollback.nvim/wiki/kitty_scrollback_nvim">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/mikesmithgh/kitty-scrollback.nvim/assets/10135646/6dd229dd-0206-4d50-b627-f5f0f5fe8cd1">
<source media="(prefers-color-scheme: light)" srcset="https://github.com/mikesmithgh/kitty-scrollback.nvim/assets/10135646/6dd229dd-0206-4d50-b627-f5f0f5fe8cd1">
<img alt="kitty-scrollback.nvim demo" src="https://github.com/mikesmithgh/kitty-scrollback.nvim/assets/10135646/6dd229dd-0206-4d50-b627-f5f0f5fe8cd1">
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/mikesmithgh/kitty-scrollback.nvim/assets/10135646/3513aada-c19c-4e4a-bd9e-91b9907a2c8d">
<source media="(prefers-color-scheme: light)" srcset="https://github.com/mikesmithgh/kitty-scrollback.nvim/assets/10135646/3513aada-c19c-4e4a-bd9e-91b9907a2c8d">
<img alt="kitty-scrollback.nvim demo" src="https://github.com/mikesmithgh/kitty-scrollback.nvim/assets/10135646/3513aada-c19c-4e4a-bd9e-91b9907a2c8d">
</picture>
<div align="center"><sup>(click for video)<sup></div>
</a>
Expand All @@ -33,12 +33,17 @@ Navigate your Kitty scrollback buffer to quickly search, copy, and execute comma
<details>

<summary>Migration Steps</summary>


<!-- panvimdoc-ignore-start -->

<img src="media/sad_kitty_thumbs_up.png" alt="sad-kitty-thumps-up" style="width: 20%" align="right" />

<!-- panvimdoc-ignore-end -->

- If you are using the [lazy.nvim](https://github.com/folke/lazy.nvim) or [packer.nvim](https://github.com/wbthomason/packer.nvim) package manager, then
add the custom `User` event `KittyScrollbackLaunch` as a trigger for lazy loading.
See [Installation](#-installation) for additional details.

- If you are using the <a href="https://github.com/folke/lazy.nvim">lazy.nvim</a> or <a href="https://github.com/wbthomason/packer.nvim">packer.nvim</a> package manager, then
add the custom `User` event `KittyScrollbackLaunch` as a trigger for lazy loading. See [Installation](#-installation) for additional details.

```lua
event = { 'User KittyScrollbackLaunch' }
```
Expand Down Expand Up @@ -67,62 +72,62 @@ Navigate your Kitty scrollback buffer to quickly search, copy, and execute comma
```
Update your Kitten to use the name of the configuration defined in the setup function. In this example,
`--config-file yourconfigfile.lua` changes to `--config yourconfig`
<details>
<summary>Real example</summary>

The configuration to view the last command output now references a builtin configuration instead of a file. The
new configuration can be viewed by running `:KittyScrollbackGenerateKittens`.

- Old configuration
The Kitten defined in `kitty.conf` references the configuration file `get_text_last_cmd_output.lua`

```kitty
# Browse output of the last shell command in nvim
map kitty_mod+g kitty_scrollback_nvim --config-file get_text_last_cmd_output.lua
```

```lua
-- get_text_last_cmd_output.lua
local M = {}
M.config = function()
return {
kitty_get_text = {
extent = 'last_visited_cmd_output',
ansi = true,
},
}
end

return M
```

- New configuration
The Kitten defined in `kitty.conf` references the builtin configuration name `ksb_builtin_last_cmd_output`

```kitty
# Browse output of the last shell command in nvim
map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
```

```lua
require('kitty-scrollback').setup({
ksb_builtin_last_cmd_output = function()
return {
kitty_get_text = {
extent = 'last_visited_cmd_output',
ansi = true,
},
}
end
})
```
</details>

<details>

<summary>Real example</summary>

- > [!NOTE]\
> The configuration to view the last command output now references a builtin configuration instead of a file. The
> new configuration can be viewed by running `:KittyScrollbackGenerateKittens`.

- Old configuration
- The Kitten defined in `kitty.conf` references the configuration file `get_text_last_cmd_output.lua`

```kitty
# Browse output of the last shell command in nvim
map kitty_mod+g kitty_scrollback_nvim --config-file get_text_last_cmd_output.lua
```

```lua
-- get_text_last_cmd_output.lua
local M = {}
M.config = function()
return {
kitty_get_text = {
extent = 'last_visited_cmd_output',
ansi = true,
},
}
end

return M
```

- New configuration
- The Kitten defined in `kitty.conf` references the builtin configuration name `ksb_builtin_last_cmd_output`

```kitty
# Browse output of the last shell command in nvim
map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
```

```lua
require('kitty-scrollback').setup({
ksb_builtin_last_cmd_output = function()
return {
kitty_get_text = {
extent = 'last_visited_cmd_output',
ansi = true,
},
}
end
})
```

</details>


</details>

## ✨ Features
- 😻 Navigate Kitty's scrollback buffer with Neovim
Expand Down Expand Up @@ -381,18 +386,22 @@ Arguments that can be passed to the `kitty_scrollback_nvim` Kitten defined in [k
| kitty_get_text.clear_selection | `boolean` | If true, clear the selection in the matched window, if any. |
| kitty_get_text.extent | `string` | What text to get. The default of screen means all text currently on the screen. all means all the `screen+scrollback` and selection means the currently selected text. `first_cmd_output_on_screen` means the output of the first command that was run in the window on screen. `last_cmd_output` means the output of the last command that was run in the window. `last_visited_cmd_output` means the first command output below the last scrolled position via scroll_to_prompt. `last_non_empty_output` is the output from the last command run in the window that had some non empty output. The last four require `shell_integration` to be enabled. Choices: `screen`, `all`, `first_cmd_output_on_screen`, `last_cmd_output`, `last_non_empty_output`, `last_visited_cmd_output`, `selection` |
| checkhealth | `boolean?` | if true execute :checkhealth kitty-scrollback and skip setup |
| visual_selection_highlight_mode | `string?` | Sets the mode for coloring the Visual highlight group in the scrollback buffer window. `darken` uses a darkened version of the Normal highlight group to improve readability. `kitty` uses the colors defined for `selection_foreground` and `selection_background` in your Kitty configuration. `nvim` uses the default colors defined in the `Visual` highlight group. `reverse` reverses the foreground and background colors of the visual selection. |

### Nerd Fonts

By default, `kitty-scrollback.nvim` uses [Nerd Fonts](https://www.nerdfonts.com) in the status window. If you would like to
use ASCII instead, set the option `status_window.style_simple` to `true`.

<!-- panvimdoc-ignore-start -->

- Status window with Nerd Fonts <code>opts.status_window.style_simple = false</code>
![style_simple_false](https://github.com/mikesmithgh/kitty-scrollback.nvim/assets/10135646/662bf132-0b39-4028-b69f-eb85fbb69b60)

- Status window with ASCII text <code>opts.status_window.style_simple = true</code>
![style_simple_true](https://github.com/mikesmithgh/kitty-scrollback.nvim/assets/10135646/c19a1869-e4e4-40fd-b619-fed771d0153f)

<!-- panvimdoc-ignore-end -->

## 🫡 Commands and Lua API
The API is available via the `kitty-scrollback.api` module. e.g., `require('kitty-scrollback.api')`
Expand Down
Loading