From dfbc16ce3e8e0bff4149b7d6d8e6e70fe2b6c511 Mon Sep 17 00:00:00 2001 From: Mike <10135646+mikesmithgh@users.noreply.github.com> Date: Tue, 12 Dec 2023 15:09:45 -0500 Subject: [PATCH] feat!: add support for new neovim default colorscheme (#103) BREAKING CHANGE: Existing highlight groups were renamed. If you were overriding any kitty-scrollback.nvim highlight groups, please update the names referencing the table below. | Previous highlight name | New highlight name | | -------------------------- | --------------------------------------- | | KittyScrollbackNvimNormal | KittyScrollbackNvimStatusWinNormal | | KittyScrollbackNvimHeart | KittyScrollbackNvimStatusWinHeartIcon | | KittyScrollbackNvimSpinner | KittyScrollbackNvimStatusWinSpinnerIcon | | KittyScrollbackNvimReady | KittyScrollbackNvimStatusWinReadyIcon | | KittyScrollbackNvimKitty | KittyScrollbackNvimStatusWinKittyIcon | | KittyScrollbackNvimVim | KittyScrollbackNvimStatusWinNvimIcon | --- CHANGELOG.md | 7 + README.md | 185 +++++----------- doc/kitty-scrollback.nvim.txt | 267 +++++++++-------------- doc/kitty-scrollback.nvim_spec.txt | 1 + lua/kitty-scrollback/configs/example.lua | 12 +- lua/kitty-scrollback/highlights.lua | 124 +++++++---- lua/kitty-scrollback/launch.lua | 16 +- lua/kitty-scrollback/windows.lua | 26 ++- python/kitty_scrollback_nvim.py | 3 +- python/loading.py | 15 +- 10 files changed, 291 insertions(+), 365 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a393e016..3273eecc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [2.4.4](https://github.com/mikesmithgh/kitty-scrollback.nvim/compare/v2.4.3...v2.4.4) (2023-12-12) + + +### Bug Fixes + +* explicitly set colorscheme to vim ([#106](https://github.com/mikesmithgh/kitty-scrollback.nvim/issues/106)) ([6e2bd60](https://github.com/mikesmithgh/kitty-scrollback.nvim/commit/6e2bd60d14fdfb9839a7ac6e352c880f463cc9ba)), closes [#93](https://github.com/mikesmithgh/kitty-scrollback.nvim/issues/93) + ## [2.4.3](https://github.com/mikesmithgh/kitty-scrollback.nvim/compare/v2.4.2...v2.4.3) (2023-12-11) diff --git a/README.md b/README.md index ed6498a8..61fabe7d 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,9 @@ Navigate your Kitty scrollback buffer to quickly search, copy, and execute comma -## 🚀 Migrating to v2.0.0 +## 🚀 Migrating to v3.0.0 > [!IMPORTANT]\ -> v2.0.0 has breaking changes and requires steps to properly migrate from v1.X.X. +> v3.0.0 has breaking changes and requires steps to properly migrate from v2.X.X. > > You can ignore this section if you have not previously installed any version of kitty-scrollback.nvim @@ -52,92 +52,18 @@ Navigate your Kitty scrollback buffer to quickly search, copy, and execute comma - - 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. - - ```lua - event = { 'User KittyScrollbackLaunch' } - ``` - - - Regenerate default Kitten mappings and add to `kitty.conf` - - ```sh - nvim --headless +'KittyScrollbackGenerateKittens' +'set nonumber' +'set norelativenumber' +'%print' +'quit!' 2>&1 - ``` - - Remove previous kitty-scrollback.nvim Kitten mappings in `kitty.conf` - - - The default mapping keys changed from `ctrl+shift` to `kitty_mod`. The default values for `kitty_mod` in Kitty is `ctrl+shift`. - - If you are using the default value for `kitty_mod` of `ctrl+shift`, then no change is needed. - - If you are using a different value for `kitty_mod`, then you should correct any potential mapping conflicts that may occur - now that `kitty-scrollback.nvim` is using `kitty_mod`. - - - Migrate any customized configurations to the new format - - When you define your kitty-scrollback.nvim Kitten configuration, do not use `--config-file` `yourconfigfile.lua`. Instead, - move the contents of `yourconfigfile.lua` to an entry in the configuration passed to the kitty-scrollback.nvim setup function. - ```lua - require('kitty-scrollback').setup({ - yourconfig = function() - ... - end, - }) - ``` - 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` + ## Highlight Groups -
- - Real example - - - > [!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 - }) - ``` + - Existing highlight groups were renamed. If you were overriding any kitty-scrollback.nvim highlight groups, please update the names referencing the table below. -
+ | Previous highlight name | New highlight name | + | -------------------------- | --------------------------------------- | + | KittyScrollbackNvimNormal | KittyScrollbackNvimStatusWinNormal | + | KittyScrollbackNvimHeart | KittyScrollbackNvimStatusWinHeartIcon | + | KittyScrollbackNvimSpinner | KittyScrollbackNvimStatusWinSpinnerIcon | + | KittyScrollbackNvimReady | KittyScrollbackNvimStatusWinReadyIcon | + | KittyScrollbackNvimKitty | KittyScrollbackNvimStatusWinKittyIcon | + | KittyScrollbackNvimVim | KittyScrollbackNvimStatusWinNvimIcon | @@ -361,49 +287,50 @@ Arguments that can be passed to the `kitty_scrollback_nvim` Kitten defined in [k ### `kitty-scrollback.nvim` configuration file -| Options | Type | Description | -| :--------------------------------------------------------------- | :------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| callbacks | `KsbCallbacks?` | fire and forget callback functions | -| callbacks.after_setup | `fun(kitty_data: KsbKittyData, opts: KsbOpts)?` | callback executed after initializing kitty-scrollback.nvim | -| callbacks.after_launch | `fun(kitty_data: KsbKittyData, opts: KsbOpts)?` | callback executed after launch started to process the scrollback buffer | -| callbacks.after_ready | `fun(kitty_data: KsbKittyData, opts: KsbOpts)?` | callback executed after scrollback buffer is loaded and cursor is positioned | -| keymaps_enabled | `boolean?` | if true, enabled all default keymaps | -| restore_options | `boolean?` | if true, restore options that were modified while processing the scrollback buffer | -| highlight_overrides | `KsbHighlights?` | kitty-scrollback.nvim highlight overrides | -| highlight_overrides
.KittyScrollbackNvimNormal | `table?` | status window Normal highlight group | -| highlight_overrides
.KittyScrollbackNvimHeart | `table?` | status window heart icon highlight group | -| highlight_overrides
.KittyScrollbackNvimSpinner | `table?` | status window spinner icon highlight group | -| highlight_overrides
.KittyScrollbackNvimReady | `table?` | status window ready icon highlight group | -| highlight_overrides
.KittyScrollbackNvimKitty | `table?` | status window kitty icon highlight group | -| highlight_overrides
.KittyScrollbackNvimVim | `table?` | status window vim icon highlight group | -| highlight_overrides
.KittyScrollbackNvimPasteWinNormal | `table?` | paste window Normal highlight group | -| highlight_overrides
.KittyScrollbackNvimPasteWinFloatBorder | `table?` | paste window FloatBorder highlight group | -| highlight_overrides
.KittyScrollbackNvimPasteWinFloatTitle | `table?` | paste window FloatTitle highlight group | -| highlight_overrides
.KittyScrollbackNvimVisual | `table?` | scrollback buffer window visual selection highlight group | -| status_window | `KsbStatusWindowOpts?` | options for status window indicating that kitty-scrollback.nvim is ready | -| status_window.enabled | `boolean` | If true, show status window in upper right corner of the screen | -| status_window.style_simple | `boolean` | If true, use plaintext instead of nerd font icons | -| status_window.autoclose | `boolean` | If true, close the status window after kitty-scrollback.nvim is ready | -| status_window.show_timer | `boolean` | If true, show a timer in the status window while kitty-scrollback.nvim is loading | -| status_window.icons | `KsbStatusWindowIcons?` | Icons displayed in the status window | -| status_window.icons.kitty | `string` | kitty status window icon | -| status_window.icons.heart | `string` | heart string heart status window icon | -| status_window.icons.nvim | `string` | nvim status window icon | -| paste_window | `KsbPasteWindowOpts?` | options for paste window that sends commands to Kitty | -| paste_window.highlight_as_normal_win | `fun(): boolean?` | If function returns true, use Normal highlight group. If false, use NormalFloat | -| paste_window.filetype | `string?` | The filetype of the paste window | -| paste_window.hide_footer | `boolean?` | If true, hide mappings in the footer when the paste window is initially opened | -| paste_window.winblend | `integer?` | The winblend setting of the window, see :help winblend | -| paste_window.winopts_overrides | `fun(paste_winopts: KsbWinOpts): table?` | Paste float window overrides, see nvim_open_win() for configuration | -| paste_window.footer_winopts_overrides | `fun(footer_winopts: KsbWinOpts, paste_winopts: KsbWinOpts): table?` | Paste footer window overrides, see nvim_open_win() for configuration | -| paste_window.yank_register | `string?` | register used during yanks to paste window, see `:h registers` | -| paste_window.yank_register_enabled | `boolean?` | If true, the `yank_register` copies content to the paste window. If false, disable yank to paste window | -| kitty_get_text | `KsbKittyGetText?` | options passed to get-text when reading scrollback buffer, see `kitty @ get-text --help` | -| kitty_get_text.ansi | `boolean` | If true, the text will include the ANSI formatting escape codes for colors, bold, italic, etc. | -| 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. | +| Options | Type | Description | +| :---------------------------------------------------------------- | :------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| callbacks | `KsbCallbacks?` | fire and forget callback functions | +| callbacks.after_setup | `fun(kitty_data: KsbKittyData, opts: KsbOpts)?` | callback executed after initializing kitty-scrollback.nvim | +| callbacks.after_launch | `fun(kitty_data: KsbKittyData, opts: KsbOpts)?` | callback executed after launch started to process the scrollback buffer | +| callbacks.after_ready | `fun(kitty_data: KsbKittyData, opts: KsbOpts)?` | callback executed after scrollback buffer is loaded and cursor is positioned | +| keymaps_enabled | `boolean?` | if true, enabled all default keymaps | +| restore_options | `boolean?` | if true, restore options that were modified while processing the scrollback buffer | +| highlight_overrides | `KsbHighlights?` | kitty-scrollback.nvim highlight overrides | +| highlight_overrides
.KittyScrollbackNvimStatusWinNormal | `table?` | status window Normal highlight group | +| highlight_overrides
.KittyScrollbackNvimStatusWinHeartIcon | `table?` | status window heart icon highlight group | +| highlight_overrides
.KittyScrollbackNvimStatusWinSpinnerIcon | `table?` | status window spinner icon highlight group | +| highlight_overrides
.KittyScrollbackNvimStatusWinReadyIcon | `table?` | status window ready icon highlight group | +| highlight_overrides
.KittyScrollbackNvimStatusWinKittyIcon | `table?` | status window kitty icon highlight group | +| highlight_overrides
.KittyScrollbackNvimStatusWinNvimIcon | `table?` | status window vim icon highlight group | +| highlight_overrides
.KittyScrollbackNvimPasteWinNormal | `table?` | paste window Normal highlight group | +| highlight_overrides
.KittyScrollbackNvimPasteWinFloatBorder | `table?` | paste window FloatBorder highlight group | +| highlight_overrides
.KittyScrollbackNvimPasteWinFloatTitle | `table?` | paste window FloatTitle highlight group | +| highlight_overrides
.KittyScrollbackNvimVisual | `table?` | scrollback buffer window Visual selection highlight group | +| highlight_overrides
.KittyScrollbackNvimNormal | `table?` | scrollback buffer window Normal highlight group | +| status_window | `KsbStatusWindowOpts?` | options for status window indicating that kitty-scrollback.nvim is ready | +| status_window.enabled | `boolean` | If true, show status window in upper right corner of the screen | +| status_window.style_simple | `boolean` | If true, use plaintext instead of nerd font icons | +| status_window.autoclose | `boolean` | If true, close the status window after kitty-scrollback.nvim is ready | +| status_window.show_timer | `boolean` | If true, show a timer in the status window while kitty-scrollback.nvim is loading | +| status_window.icons | `KsbStatusWindowIcons?` | Icons displayed in the status window | +| status_window.icons.kitty | `string` | kitty status window icon | +| status_window.icons.heart | `string` | heart string heart status window icon | +| status_window.icons.nvim | `string` | nvim status window icon | +| paste_window | `KsbPasteWindowOpts?` | options for paste window that sends commands to Kitty | +| paste_window.highlight_as_normal_win | `fun(): boolean?` | If function returns true, use Normal highlight group. If false, use NormalFloat | +| paste_window.filetype | `string?` | The filetype of the paste window | +| paste_window.hide_footer | `boolean?` | If true, hide mappings in the footer when the paste window is initially opened | +| paste_window.winblend | `integer?` | The winblend setting of the window, see :help winblend | +| paste_window.winopts_overrides | `fun(paste_winopts: KsbWinOpts): table?` | Paste float window overrides, see nvim_open_win() for configuration | +| paste_window.footer_winopts_overrides | `fun(footer_winopts: KsbWinOpts, paste_winopts: KsbWinOpts): table?` | Paste footer window overrides, see nvim_open_win() for configuration | +| paste_window.yank_register | `string?` | register used during yanks to paste window, see `:h registers` | +| paste_window.yank_register_enabled | `boolean?` | If true, the `yank_register` copies content to the paste window. If false, disable yank to paste window | +| kitty_get_text | `KsbKittyGetText?` | options passed to get-text when reading scrollback buffer, see `kitty @ get-text --help` | +| kitty_get_text.ansi | `boolean` | If true, the text will include the ANSI formatting escape codes for colors, bold, italic, etc. | +| 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 diff --git a/doc/kitty-scrollback.nvim.txt b/doc/kitty-scrollback.nvim.txt index eeccd35a..01359009 100644 --- a/doc/kitty-scrollback.nvim.txt +++ b/doc/kitty-scrollback.nvim.txt @@ -4,7 +4,8 @@ Table of Contents *kitty-scrollback.nvim-table-of-contents* 1. kitty-scrollback.nvim |kitty-scrollback.nvim-kitty-scrollback.nvim| - - Migrating to v2.0.0 |kitty-scrollback.nvim-migrating-to-v2.0.0| + - Migrating to v3.0.0 |kitty-scrollback.nvim-migrating-to-v3.0.0| + - Highlight Groups |kitty-scrollback.nvim-highlight-groups| - Features |kitty-scrollback.nvim-features| - Example use cases |kitty-scrollback.nvim-example-use-cases| - Prerequisites |kitty-scrollback.nvim-prerequisites| @@ -26,99 +27,27 @@ Navigate your Kitty scrollback buffer to quickly search, copy, and execute commands in Neovim. -MIGRATING TO V2.0.0 *kitty-scrollback.nvim-migrating-to-v2.0.0* +MIGRATING TO V3.0.0 *kitty-scrollback.nvim-migrating-to-v3.0.0* |‼| |IMPORTANT| - v2.0.0 has breaking changes and requires steps to properly migrate from v1.X.X. + v3.0.0 has breaking changes and requires steps to properly migrate from v2.X.X. You can ignore this section if you have not previously installed any version of kitty-scrollback.nvim `-` `Migration Steps` - - If you are using the lazy.nvim or - packer.nvim package manager, then - add the custom `User` event `KittyScrollbackLaunch` as a trigger for lazy - loading. See |kitty-scrollback.nvim-installation| for additional details. - ->lua - event = { 'User KittyScrollbackLaunch' } -< - - Regenerate default Kitten mappings and add to `kitty.conf` - ->sh - nvim --headless +'KittyScrollbackGenerateKittens' +'set nonumber' +'set norelativenumber' +'%print' +'quit!' 2>&1 -< - - Remove previous kitty-scrollback.nvim Kitten mappings in `kitty.conf` - - The default mapping keys changed from `ctrl+shift` to `kitty_mod`. The default - values for `kitty_mod` in Kitty is `ctrl+shift`. - - If you are using the default value for `kitty_mod` of `ctrl+shift`, then no change is needed. - - If you are using a different value for `kitty_mod`, then you should correct any potential mapping conflicts that may occur - now that `kitty-scrollback.nvim` is using `kitty_mod`. - - Migrate any customized configurations to the new format - - When you define your kitty-scrollback.nvim Kitten configuration, do not use - `--config-file` `yourconfigfile.lua`. Instead, move the contents of - `yourconfigfile.lua` to an entry in the configuration passed to the - kitty-scrollback.nvim setup function. - ->lua - require('kitty-scrollback').setup({ - yourconfig = function() - ... - end, - }) -< - 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` - - -`-` `Real example` - - `ℹ` `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 - }) -< + HIGHLIGHT GROUPS *kitty-scrollback.nvim-highlight-groups* + - Existing highlight groups were renamed. If you were overriding any + kitty-scrollback.nvim highlight groups, please update the names referencing the + table below. + Previous highlight name New highlight name + ---------------------------- ----------------------------------------- + KittyScrollbackNvimNormal KittyScrollbackNvimStatusWinNormal + KittyScrollbackNvimHeart KittyScrollbackNvimStatusWinHeartIcon + KittyScrollbackNvimSpinner KittyScrollbackNvimStatusWinSpinnerIcon + KittyScrollbackNvimReady KittyScrollbackNvimStatusWinReadyIcon + KittyScrollbackNvimKitty KittyScrollbackNvimStatusWinKittyIcon + KittyScrollbackNvimVim KittyScrollbackNvimStatusWinNvimIcon FEATURES *kitty-scrollback.nvim-features* @@ -347,127 +276,129 @@ kitty.conf . KITTY-SCROLLBACK.NVIM CONFIGURATION FILE ~ - --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Options Type Description - ------------------------------------------------------------ -------------------------------------------------------------------------------- ----------------------------------------------------------- - callbacks KsbCallbacks? fire and forget callback functions + ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Options Type Description + ------------------------------------------------------------- -------------------------------------------------------------------------------- ----------------------------------------------------------- + callbacks KsbCallbacks? fire and forget callback functions + + callbacks.after_setup fun(kitty_data: KsbKittyData, opts: KsbOpts)? callback executed after initializing kitty-scrollback.nvim - callbacks.after_setup fun(kitty_data: KsbKittyData, opts: KsbOpts)? callback executed after initializing kitty-scrollback.nvim + callbacks.after_launch fun(kitty_data: KsbKittyData, opts: KsbOpts)? callback executed after launch started to process the + scrollback buffer - callbacks.after_launch fun(kitty_data: KsbKittyData, opts: KsbOpts)? callback executed after launch started to process the - scrollback buffer + callbacks.after_ready fun(kitty_data: KsbKittyData, opts: KsbOpts)? callback executed after scrollback buffer is loaded and + cursor is positioned - callbacks.after_ready fun(kitty_data: KsbKittyData, opts: KsbOpts)? callback executed after scrollback buffer is loaded and - cursor is positioned + keymaps_enabled boolean? if true, enabled all default keymaps - keymaps_enabled boolean? if true, enabled all default keymaps + restore_options boolean? if true, restore options that were modified while + processing the scrollback buffer - restore_options boolean? if true, restore options that were modified while - processing the scrollback buffer + highlight_overrides KsbHighlights? kitty-scrollback.nvim highlight overrides - highlight_overrides KsbHighlights? kitty-scrollback.nvim highlight overrides + highlight_overrides.KittyScrollbackNvimStatusWinNormal table? status window Normal highlight group - highlight_overrides.KittyScrollbackNvimNormal table? status window Normal highlight group + highlight_overrides.KittyScrollbackNvimStatusWinHeartIcon table? status window heart icon highlight group - highlight_overrides.KittyScrollbackNvimHeart table? status window heart icon highlight group + highlight_overrides.KittyScrollbackNvimStatusWinSpinnerIcon table? status window spinner icon highlight group - highlight_overrides.KittyScrollbackNvimSpinner table? status window spinner icon highlight group + highlight_overrides.KittyScrollbackNvimStatusWinReadyIcon table? status window ready icon highlight group - highlight_overrides.KittyScrollbackNvimReady table? status window ready icon highlight group + highlight_overrides.KittyScrollbackNvimStatusWinKittyIcon table? status window kitty icon highlight group - highlight_overrides.KittyScrollbackNvimKitty table? status window kitty icon highlight group + highlight_overrides.KittyScrollbackNvimStatusWinNvimIcon table? status window vim icon highlight group - highlight_overrides.KittyScrollbackNvimVim table? status window vim icon highlight group + highlight_overrides.KittyScrollbackNvimPasteWinNormal table? paste window Normal highlight group - highlight_overrides.KittyScrollbackNvimPasteWinNormal table? paste window Normal highlight group + highlight_overrides.KittyScrollbackNvimPasteWinFloatBorder table? paste window FloatBorder highlight group - highlight_overrides.KittyScrollbackNvimPasteWinFloatBorder table? paste window FloatBorder highlight group + highlight_overrides.KittyScrollbackNvimPasteWinFloatTitle table? paste window FloatTitle highlight group - highlight_overrides.KittyScrollbackNvimPasteWinFloatTitle table? paste window FloatTitle highlight group + highlight_overrides.KittyScrollbackNvimVisual table? scrollback buffer window Visual selection highlight group - highlight_overrides.KittyScrollbackNvimVisual table? scrollback buffer window visual selection highlight group + highlight_overrides.KittyScrollbackNvimNormal table? scrollback buffer window Normal highlight group - status_window KsbStatusWindowOpts? options for status window indicating that - kitty-scrollback.nvim is ready + status_window KsbStatusWindowOpts? options for status window indicating that + kitty-scrollback.nvim is ready - status_window.enabled boolean If true, show status window in upper right corner of the - screen + status_window.enabled boolean If true, show status window in upper right corner of the + screen - status_window.style_simple boolean If true, use plaintext instead of nerd font icons + status_window.style_simple boolean If true, use plaintext instead of nerd font icons - status_window.autoclose boolean If true, close the status window after - kitty-scrollback.nvim is ready + status_window.autoclose boolean If true, close the status window after + kitty-scrollback.nvim is ready - status_window.show_timer boolean If true, show a timer in the status window while - kitty-scrollback.nvim is loading + status_window.show_timer boolean If true, show a timer in the status window while + kitty-scrollback.nvim is loading - status_window.icons KsbStatusWindowIcons? Icons displayed in the status window + status_window.icons KsbStatusWindowIcons? Icons displayed in the status window - status_window.icons.kitty string kitty status window icon + status_window.icons.kitty string kitty status window icon - status_window.icons.heart string heart string heart status window icon + status_window.icons.heart string heart string heart status window icon - status_window.icons.nvim string nvim status window icon + status_window.icons.nvim string nvim status window icon - paste_window KsbPasteWindowOpts? options for paste window that sends commands to Kitty + paste_window KsbPasteWindowOpts? options for paste window that sends commands to Kitty - paste_window.highlight_as_normal_win fun(): boolean? If function returns true, use Normal highlight group. If - false, use NormalFloat + paste_window.highlight_as_normal_win fun(): boolean? If function returns true, use Normal highlight group. If + false, use NormalFloat - paste_window.filetype string? The filetype of the paste window + paste_window.filetype string? The filetype of the paste window - paste_window.hide_footer boolean? If true, hide mappings in the footer when the paste window - is initially opened + paste_window.hide_footer boolean? If true, hide mappings in the footer when the paste window + is initially opened - paste_window.winblend integer? The winblend setting of the window, see :help winblend + paste_window.winblend integer? The winblend setting of the window, see :help winblend - paste_window.winopts_overrides fun(paste_winopts: KsbWinOpts): table? Paste float window overrides, see nvim_open_win() for - configuration + paste_window.winopts_overrides fun(paste_winopts: KsbWinOpts): table? Paste float window overrides, see nvim_open_win() for + configuration - paste_window.footer_winopts_overrides fun(footer_winopts: KsbWinOpts, paste_winopts: KsbWinOpts): table? Paste footer window overrides, see nvim_open_win() for - configuration + paste_window.footer_winopts_overrides fun(footer_winopts: KsbWinOpts, paste_winopts: KsbWinOpts): table? Paste footer window overrides, see nvim_open_win() for + configuration - paste_window.yank_register string? register used during yanks to paste window, see - :h registers + paste_window.yank_register string? register used during yanks to paste window, see + :h registers - paste_window.yank_register_enabled boolean? If true, the yank_register copies content to the paste - window. If false, disable yank to paste window + paste_window.yank_register_enabled boolean? If true, the yank_register copies content to the paste + window. If false, disable yank to paste window - kitty_get_text KsbKittyGetText? options passed to get-text when reading scrollback buffer, - see kitty @ get-text --help + kitty_get_text KsbKittyGetText? options passed to get-text when reading scrollback buffer, + see kitty @ get-text --help - kitty_get_text.ansi boolean If true, the text will include the ANSI formatting escape - codes for colors, bold, italic, etc. + kitty_get_text.ansi boolean If true, the text will include the ANSI formatting escape + codes for colors, bold, italic, etc. - kitty_get_text.clear_selection boolean If true, clear the selection in the matched window, if any. + 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 + 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 + 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. - --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 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 ~ diff --git a/doc/kitty-scrollback.nvim_spec.txt b/doc/kitty-scrollback.nvim_spec.txt index 0a931bad..762e37d6 100644 --- a/doc/kitty-scrollback.nvim_spec.txt +++ b/doc/kitty-scrollback.nvim_spec.txt @@ -35,6 +35,7 @@ KsbPrivate *kitty-scrollback.launch.KsbPrivate* Fields: ~ {orig_columns} (number) + {orig_normal_hl} (table|nil) {bufid} (number|nil) {paste_bufid} (number|nil) {kitty_loading_winid} (number|nil) diff --git a/lua/kitty-scrollback/configs/example.lua b/lua/kitty-scrollback/configs/example.lua index daee9349..120846a5 100644 --- a/lua/kitty-scrollback/configs/example.lua +++ b/lua/kitty-scrollback/configs/example.lua @@ -148,27 +148,27 @@ return { end return { highlight_overrides = { - KittyScrollbackNvimNormal = { + KittyScrollbackNvimStatusWinNormal = { fg = '#ee82ee', bg = '#ee82ee', }, - KittyScrollbackNvimHeart = { + KittyScrollbackNvimStatusWinHeartIcon = { fg = '#ff0000', bg = '#4b0082', }, - KittyScrollbackNvimSpinner = { + KittyScrollbackNvimStatusWinSpinnerIcon = { fg = '#000099', bg = '#4b0082', }, - KittyScrollbackNvimReady = { + KittyScrollbackNvimStatusWinReadyIcon = { fg = '#4b0082', bg = '#ffa500', }, - KittyScrollbackNvimKitty = { + KittyScrollbackNvimStatusWinKittyIcon = { fg = '#ffa500', bg = '#000099', }, - KittyScrollbackNvimVim = { + KittyScrollbackNvimStatusWinNvimIcon = { fg = '#008000', bg = '#000099', }, diff --git a/lua/kitty-scrollback/highlights.lua b/lua/kitty-scrollback/highlights.lua index 4692f4f5..aae68dc6 100644 --- a/lua/kitty-scrollback/highlights.lua +++ b/lua/kitty-scrollback/highlights.lua @@ -11,40 +11,72 @@ local opts ---see `:help nvim_set_hl()` for highlight group definition format ---@class KsbHighlights ----@field KittyScrollbackNvimNormal table|nil status window Normal highlight group ----@field KittyScrollbackNvimHeart table|nil status window heart icon highlight group ----@field KittyScrollbackNvimSpinner table|nil status window spinner icon highlight group ----@field KittyScrollbackNvimReady table|nil status window ready icon highlight group ----@field KittyScrollbackNvimKitty table|nil status window kitty icon highlight group ----@field KittyScrollbackNvimVim table|nil status window vim icon highlight group +---@field KittyScrollbackNvimStatusWinNormal table|nil status window Normal highlight group +---@field KittyScrollbackNvimStatusWinHeartIcon table|nil status window heart icon highlight group +---@field KittyScrollbackNvimStatusWinSpinnerIcon table|nil status window spinner icon highlight group +---@field KittyScrollbackNvimStatusWinReadyIcon table|nil status window ready icon highlight group +---@field KittyScrollbackNvimStatusWinKittyIcon table|nil status window kitty icon highlight group +---@field KittyScrollbackNvimStatusWinNvimIcon table|nil status window vim icon highlight group ---@field KittyScrollbackNvimPasteWinNormal table|nil paste window Normal highlight group ---@field KittyScrollbackNvimPasteWinFloatBorder table|nil paste window FloatBorder highlight group ---@field KittyScrollbackNvimPasteWinFloatTitle table|nil paste window FloatTitle highlight group ---@field KittyScrollbackNvimVisual table|nil scrollback buffer window visual selection highlight group +---@field KittyScrollbackNvimNormal table|nil scrollback buffer window normal highlight group ----@see nvim_set_hl +-- local function has_vim_colorscheme() +-- return vim.fn.getcompletion('vim$', 'color')[1] ~= nil +-- end + +M.has_default_or_vim_colorscheme = function() + return vim.g.colors_name == nil or vim.g.colors_name == 'default' or vim.g.colors_name == 'vim' +end + +local function fg_or_fallback(hl_def) + local fg = type(hl_def.fg) == 'number' and string.format('#%06x', hl_def.fg) or hl_def.fg + return hl_def.fg and fg or (vim.o.background == 'dark' and '#ffffff' or '#000000') +end + +local function bg_or_fallback(hl_def) + local bg = type(hl_def.bg) == 'number' and string.format('#%06x', hl_def.bg) or hl_def.bg + return hl_def.bg and bg or (vim.o.background == 'dark' and '#000000' or '#ffffff') +end + +local function normal_color() + local hl_def = vim.api.nvim_get_hl(0, { name = 'Normal', link = false }) + hl_def = next(hl_def) and hl_def or {} -- can return vim.empty_dict() so convert to lua table + local normal_fg_color = M.has_default_or_vim_colorscheme() and p.kitty_colors.foreground + or fg_or_fallback(hl_def) + local normal_bg_color = M.has_default_or_vim_colorscheme() and p.kitty_colors.background + or bg_or_fallback(hl_def) + return { + fg = normal_fg_color, + bg = normal_bg_color, + } +end + +local function pastewin_color() + local hl_as_normal = opts.paste_window.highlight_as_normal_win + or M.has_default_or_vim_colorscheme() + local hl_name = hl_as_normal and 'Normal' or 'NormalFloat' + local hl_def = vim.api.nvim_get_hl(0, { name = hl_name, link = false }) + local pastewin_hl = next(hl_def) and hl_def or {} -- can return vim.empty_dict() so convert to lua table + if hl_as_normal then + pastewin_hl = normal_color() + end + return pastewin_hl +end ---@return KsbHighlights local function highlight_definitions() if not p.kitty_colors or not next(p.kitty_colors) then return {} end - local hl_as_normal_fn = opts.paste_window.highlight_as_normal_win - or function() - return vim.g.colors_name == nil - or vim.g.colors_name == 'default' - or vim.g.colors_name == 'vim' - end - local hl_name = hl_as_normal_fn() and 'Normal' or 'NormalFloat' - local hl_def = vim.api.nvim_get_hl(0, { name = hl_name, link = false }) - hl_def = next(hl_def) and hl_def or {} -- can return vim.empty_dict() so convert to lua table - local normal_bg_color = hl_def.bg and string.format('#%06x', hl_def.bg) - or p.kitty_colors.background local floatborder_fg_color = ksb_util.darken(p.kitty_colors.foreground, 0.3, p.kitty_colors.background) local visual_hl_def = vim.api.nvim_get_hl(0, { name = 'Visual', link = false }) visual_hl_def = next(visual_hl_def) and visual_hl_def or {} -- can return vim.empty_dict() so convert to lua table + local pastewin_hl = pastewin_color() local visual_hl_configs = { reverse = { default = true, @@ -58,67 +90,84 @@ local function highlight_definitions() }, darken = { default = true, - bg = ksb_util.darken( - hl_def.fg and string.format('#%06x', hl_def.fg) - or (vim.o.background == 'dark' and '#ffffff' or '#000000'), - 0.2, - normal_bg_color - ), + bg = ksb_util.darken(fg_or_fallback(pastewin_hl), 0.2, pastewin_hl.bg), }, nvim = visual_hl_def, } local visual_hl = visual_hl_configs[opts.visual_selection_highlight_mode] or visual_hl_configs.nvim + local normal_hl = normal_color() return { + KittyScrollbackNvimVisual = visual_hl, KittyScrollbackNvimNormal = { + default = true, + fg = normal_hl.fg, + bg = normal_hl.bg, + }, + -- status window + KittyScrollbackNvimStatusWinNormal = { default = true, fg = '#968c81', + bg = normal_hl.bg, }, - KittyScrollbackNvimHeart = { + KittyScrollbackNvimStatusWinHeartIcon = { default = true, fg = '#d55b54', + bg = normal_hl.bg, }, - KittyScrollbackNvimSpinner = { + KittyScrollbackNvimStatusWinSpinnerIcon = { default = true, fg = '#d3869b', + bg = normal_hl.bg, }, - KittyScrollbackNvimReady = { + KittyScrollbackNvimStatusWinReadyIcon = { default = true, fg = '#8faa80', + bg = normal_hl.bg, }, - KittyScrollbackNvimKitty = { + KittyScrollbackNvimStatusWinKittyIcon = { default = true, fg = '#754b33', + bg = normal_hl.bg, }, - KittyScrollbackNvimVim = { + KittyScrollbackNvimStatusWinNvimIcon = { default = true, fg = '#87987e', + bg = normal_hl.bg, }, + -- paste window KittyScrollbackNvimPasteWinNormal = { default = true, - bg = normal_bg_color, + bg = pastewin_hl.bg, blend = opts.paste_window.winblend or 0, }, KittyScrollbackNvimPasteWinFloatBorder = { default = true, - bg = normal_bg_color, + bg = pastewin_hl.bg, fg = floatborder_fg_color, blend = opts.paste_window.winblend or 0, }, KittyScrollbackNvimPasteWinFloatTitle = { default = true, bg = floatborder_fg_color, - fg = normal_bg_color, + fg = pastewin_hl.bg, blend = opts.paste_window.winblend or 0, }, - KittyScrollbackNvimVisual = visual_hl, } end +---@param private KsbPrivate +---@param options KsbOpts +---@return true|false M.setup = function(private, options) p = private opts = options ---@diagnostic disable-line: unused-local + p.orig_normal_hl = vim.api.nvim_get_hl(0, { name = 'Normal', link = false }) + if M.has_default_or_vim_colorscheme() then + -- clear Normal highlight to avoid flicker when bg color is set + vim.api.nvim_set_hl(0, 'Normal', {}) + end local ok, colors = ksb_api.get_kitty_colors(p.kitty_data) if ok then p.kitty_colors = colors @@ -127,7 +176,7 @@ M.setup = function(private, options) end ---Format nvim highlights to arguments passed to kitty launch command ----E.g., KittyScrollbackNvimVim with #188b25 to --env KITTY_SCROLLBACK_NVIM_VIM=#188b25 +---E.g., KittyScrollbackNvimStatusWinNvimIcon with #188b25 to --env KITTY_SCROLLBACK_NVIM_VIM=#188b25 ---@return table list of environment variable arguments M.get_highlights_as_env = function() local env = {} @@ -137,12 +186,7 @@ M.get_highlights_as_env = function() hl_def = next(hl_def) and hl_def or {} -- nvim_get_hl can return vim.empty_dict() so convert to lua table table.insert( env, - string.format( - '%s=#%06x', - ksb_util.screaming_snakecase(name), - hl_def.fg - or (vim.o.background == 'dark' and tonumber('ffffff', 16) or tonumber('000000', 16)) - ) + string.format('%s_HIGHLIGHT=%s', ksb_util.screaming_snakecase(name), fg_or_fallback(hl_def)) ) end return env diff --git a/lua/kitty-scrollback/launch.lua b/lua/kitty-scrollback/launch.lua index 7c93fc27..7af7e33c 100644 --- a/lua/kitty-scrollback/launch.lua +++ b/lua/kitty-scrollback/launch.lua @@ -49,6 +49,7 @@ local M = {} ---@class KsbPrivate ---@field orig_columns number +---@field orig_normal_hl table|nil ---@field bufid number|nil ---@field paste_bufid number|nil ---@field kitty_loading_winid number|nil @@ -332,6 +333,9 @@ M.setup = function(kitty_data_str) if ok then ksb_hl.set_highlights() ksb_kitty_cmds.open_kitty_loading_window(ksb_hl.get_highlights_as_env()) -- must be after opts and set highlights + if ksb_hl.has_default_or_vim_colorscheme() then + vim.api.nvim_set_hl(0, 'Normal', p.orig_normal_hl) + end end if @@ -399,10 +403,14 @@ M.launch = function() local term_buf_name = vim.api.nvim_buf_get_name(p.bufid) term_buf_name = term_buf_name:gsub('^(term://.-:).*', '%1kitty-scrollback.nvim') vim.api.nvim_buf_set_name(p.bufid, term_buf_name) - vim.api.nvim_set_option_value('winhighlight', 'Visual:KittyScrollbackNvimVisual', { - scope = 'local', - win = 0, - }) + vim.api.nvim_set_option_value( + 'winhighlight', + 'Normal:KittyScrollbackNvimNormal,Visual:KittyScrollbackNvimVisual', + { + scope = 'local', + win = 0, + } + ) vim.api.nvim_buf_delete(vim.fn.bufnr('#'), { force = true }) -- delete alt buffer after rename if opts.restore_options then diff --git a/lua/kitty-scrollback/windows.lua b/lua/kitty-scrollback/windows.lua index 2ba8aef1..f388f057 100644 --- a/lua/kitty-scrollback/windows.lua +++ b/lua/kitty-scrollback/windows.lua @@ -168,10 +168,14 @@ M.show_status_window = function() noautocmd = true, }) ) - vim.api.nvim_set_option_value('winhighlight', 'NormalFloat:KittyScrollbackNvimNormal', { - win = popup_winid, - scope = 'local', - }) + vim.api.nvim_set_option_value( + 'winhighlight', + 'NormalFloat:KittyScrollbackNvimStatusWinNormal', + { + win = popup_winid, + scope = 'local', + } + ) local count = 0 local spinner = { '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '✔' } if opts.status_window.style_simple then @@ -219,8 +223,8 @@ M.show_status_window = function() if spinner_icon ~= '' then endcol = #spinner_icon + 2 vim.api.nvim_buf_set_extmark(popup_bufid, nid, 0, startcol, { - hl_group = count >= #spinner and 'KittyScrollbackNvimReady' - or 'KittyScrollbackNvimSpinner', + hl_group = count >= #spinner and 'KittyScrollbackNvimStatusWinReadyIcon' + or 'KittyScrollbackNvimStatusWinSpinnerIcon', end_col = endcol, }) end @@ -228,19 +232,19 @@ M.show_status_window = function() startcol = endcol endcol = endcol + #kitty_icon + 1 vim.api.nvim_buf_set_extmark(popup_bufid, nid, 0, startcol, { - hl_group = 'KittyScrollbackNvimKitty', + hl_group = 'KittyScrollbackNvimStatusWinKittyIcon', end_col = endcol, }) startcol = endcol endcol = endcol + #love_icon + 1 vim.api.nvim_buf_set_extmark(popup_bufid, nid, 0, startcol, { - hl_group = 'KittyScrollbackNvimHeart', + hl_group = 'KittyScrollbackNvimStatusWinHeartIcon', end_col = endcol, }) startcol = endcol endcol = #fmt_msg vim.api.nvim_buf_set_extmark(popup_bufid, nid, 0, startcol, { - hl_group = 'KittyScrollbackNvimVim', + hl_group = 'KittyScrollbackNvimStatusWinNvimIcon', end_col = endcol, }) end @@ -282,14 +286,14 @@ M.show_status_window = function() else if count > #spinner then local hl_def = vim.api.nvim_get_hl(0, { - name = 'KittyScrollbackNvimReady', + name = 'KittyScrollbackNvimStatusWinReadyIcon', link = false, }) hl_def = next(hl_def) and hl_def or {} -- nvim_get_hl can return vim.empty_dict() so convert to lua table local fg_dec = hl_def.fg or 16777215 -- default to #ffffff local fg_hex = string.format('#%06x', fg_dec) local darken_hex = ksb_util.darken(fg_hex, 0.7) - vim.api.nvim_set_hl(0, 'KittyScrollbackNvimReady', { + vim.api.nvim_set_hl(0, 'KittyScrollbackNvimStatusWinReadyIcon', { fg = darken_hex, }) if count > #spinner + (#spinner / 2) then diff --git a/python/kitty_scrollback_nvim.py b/python/kitty_scrollback_nvim.py index 086ff483..168baf17 100755 --- a/python/kitty_scrollback_nvim.py +++ b/python/kitty_scrollback_nvim.py @@ -186,12 +186,11 @@ def handle_result(args: List[str], nvim_args = parse_nvim_args(args) + ( '--cmd', - ' lua ' + ' lua' ' vim.api.nvim_create_autocmd([[VimEnter]], {' ' group = vim.api.nvim_create_augroup([[KittyScrollBackNvimVimEnter]], { clear = true }),' ' pattern = [[*]],' ' callback = function()' - ' vim.cmd.colorscheme({ args = {[[vim]]}, mods = { emsg_silent = true }})' f' vim.opt.runtimepath:append([[{ksb_dir}]])' ' vim.api.nvim_exec_autocmds([[User]], { pattern = [[KittyScrollbackLaunch]], modeline = false })' f' require([[kitty-scrollback.launch]]).setup_and_launch([[{kitty_data}]])' diff --git a/python/loading.py b/python/loading.py index c89d1070..75705238 100755 --- a/python/loading.py +++ b/python/loading.py @@ -26,11 +26,16 @@ def env_to_fg_color(name): show_timer = os.environ.get('KITTY_SCROLLBACK_NVIM_SHOW_TIMER', False).lower() == 'true' -timer_color = env_to_fg_color('KITTY_SCROLLBACK_NVIM_NORMAL') -heart_color = env_to_fg_color('KITTY_SCROLLBACK_NVIM_HEART') -spinner_color = env_to_fg_color('KITTY_SCROLLBACK_NVIM_SPINNER') -kitty_color = env_to_fg_color('KITTY_SCROLLBACK_NVIM_KITTY') -nvim_color = env_to_fg_color('KITTY_SCROLLBACK_NVIM_VIM') +timer_color = env_to_fg_color( + 'KITTY_SCROLLBACK_NVIM_STATUS_WIN_NORMAL_HIGHLIGHT') +heart_color = env_to_fg_color( + 'KITTY_SCROLLBACK_NVIM_STATUS_WIN_HEART_ICON_HIGHLIGHT') +spinner_color = env_to_fg_color( + 'KITTY_SCROLLBACK_NVIM_STATUS_WIN_SPINNER_ICON_HIGHLIGHT') +kitty_color = env_to_fg_color( + 'KITTY_SCROLLBACK_NVIM_STATUS_WIN_KITTY_ICON_HIGHLIGHT') +nvim_color = env_to_fg_color( + 'KITTY_SCROLLBACK_NVIM_STATUS_WIN_NVIM_ICON_HIGHLIGHT') reset = '\x1b[0m' kitty_icon = os.environ.get('KITTY_SCROLLBACK_NVIM_KITTY_ICON', '󰄛')