-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: redesign kitty-scrollback.nvim configuration (#118)
closes #69 BREAKING CHANGE: kitty-scrollback.nvim loads your Neovim configuration by default. Previous versions of kitty-scrollback.nvim, did not load any configurations or plugins by default. - Previously, kitty-scrollback.nvim did not open Neovim with your Neovim configuration by default. This has changed to loading your Neovim configuration by default, with the ability to opt out. If you prefer to continue not loading your Neovim configuration, then follow the steps at [No Configuration](#no-configuration). - If you previously used the flag `--no-nvim-args`, then delete it from your configuration because it no longer has any effect. The flag `--nvim-args` remains unchanged and can still be used. - `ksb_example` configurations have been removed and can no longer be referenced by name. If you were previously referencing an example configuration by name, then you can manually copy it from [./tests/example.lua](./tests/example.lua) into your kitty-scrollback.nvim configuration. See [Plugin Configuration](#plugin-configuration) for detailed instructions on configuration kitty-scrollback.nvim. - The command `KittyScrollbackGenerateKittens` and api `generate_kittens` no longer have an option to generate `ksb_example` configurations. - The command `KittyScrollbackGenerateKittens` no longer accepts the bang `!` modifier - The api `generate_kittens` signature removed the `all` parameter - The reserved `global` configuration name has been removed and global options are now configured by the first element of the options table without a key. See [Global Configuration](#global-configuration) for more details. - The undocumented reserved `default` configuration name has been removed. kitty-scrollback.nvim defaults to `ksb_builtin_get_text_all` if no configuration is provided.
- Loading branch information
1 parent
f5fb791
commit 97fea1b
Showing
29 changed files
with
1,532 additions
and
1,001 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,21 @@ | ||
local prefix = 'ksb_builtin_' | ||
|
||
---@type table<string, KsbOpts|fun(KsbKittyData):KsbOpts> | ||
return { | ||
configs = { | ||
[prefix .. 'get_text_all'] = function() | ||
return { | ||
kitty_get_text = { | ||
extent = 'all', | ||
ansi = true, | ||
}, | ||
} | ||
end, | ||
[prefix .. 'last_cmd_output'] = function() | ||
return { | ||
kitty_get_text = { | ||
extent = 'last_cmd_output', | ||
ansi = true, | ||
}, | ||
} | ||
end, | ||
[prefix .. 'last_visited_cmd_output'] = function() | ||
return { | ||
kitty_get_text = { | ||
extent = 'last_visited_cmd_output', | ||
ansi = true, | ||
}, | ||
} | ||
end, | ||
[prefix .. 'checkhealth'] = function() | ||
return { | ||
checkhealth = true, | ||
} | ||
end, | ||
ksb_builtin_get_text_all = { | ||
kitty_get_text = { | ||
extent = 'all', | ||
}, | ||
}, | ||
ksb_builtin_last_cmd_output = { | ||
kitty_get_text = { | ||
extent = 'last_cmd_output', | ||
}, | ||
}, | ||
ksb_builtin_last_visited_cmd_output = { | ||
kitty_get_text = { | ||
extent = 'last_visited_cmd_output', | ||
}, | ||
}, | ||
ksb_builtin_checkhealth = { | ||
checkhealth = true, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
---@class KsbCallbacks | ||
---@field after_setup fun(kitty_data:KsbKittyData, opts:KsbOpts)|nil callback executed after initializing kitty-scrollback.nvim | ||
---@field after_launch fun(kitty_data:KsbKittyData, opts:KsbOpts)|nil callback executed after launch started to process the scrollback buffer | ||
---@field after_ready fun(kitty_data:KsbKittyData, opts:KsbOpts)|nil callback executed after scrollback buffer is loaded and cursor is positioned | ||
|
||
---@class KsbKittyGetText | ||
---@field ansi boolean|nil If true, the text will include the ANSI formatting escape codes for colors, bold, italic, etc. | ||
---@field clear_selection boolean|nil If true, clear the selection in the matched window, if any. | ||
---@field extent string|nil | 'screen' | 'all' | 'selection' | 'first_cmd_output_on_screen' | 'last_cmd_output' | 'last_visited_cmd_output' | 'last_non_empty_output' 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 | ||
|
||
---@class KsbStatusWindowIcons | ||
---@field kitty string kitty status window icon, defaults to | ||
---@field heart string heart status window icon, defaults to | ||
---@field nvim string nvim status window icon, defaults to | ||
|
||
---@class KsbStatusWindowOpts | ||
---@field enabled boolean If true, show status window in upper right corner of the screen | ||
---@field style_simple boolean If true, use plaintext instead of nerd font icons | ||
---@field autoclose boolean If true, close the status window after kitty-scrollback.nvim is ready | ||
---@field show_timer boolean If true, show a timer in the status window while kitty-scrollback.nvim is loading | ||
---@field icons KsbStatusWindowIcons Icons displayed in the status window, defaults to | ||
|
||
---@alias KsbWinOpts table<string, any> | ||
|
||
---@alias KsbWinOptsOverrideFunction fun(paste_winopts:KsbWinOpts):KsbWinOpts | ||
---@alias KsbFooterWinOptsOverrideFunction fun(footer_winopts:KsbWinOpts, paste_winopts:KsbWinOpts):KsbWinOpts | ||
|
||
---@class KsbPasteWindowOpts | ||
---@field highlight_as_normal_win nil|fun():boolean If function returns true, use Normal highlight group. If false, use NormalFloat | ||
---@field filetype string|nil The filetype of the paste window | ||
---@field hide_footer boolean|nil If true, hide mappings in the footer when the paste window is initially opened | ||
---@field winblend integer|nil The winblend setting of the window, see :help winblend | ||
---@field winopts_overrides KsbWinOptsOverrideFunction|nil Paste float window overrides, see nvim_open_win() for configuration | ||
---@field footer_winopts_overrides KsbFooterWinOptsOverrideFunction|nil Paste footer window overrides, see nvim_open_win() for configuration | ||
---@field yank_register string|nil register used during yanks to paste window, see :h registers | ||
---@field yank_register_enabled boolean|nil If true, the `yank_register` copies content to the paste window. If false, disable yank to paste window | ||
|
||
---@class KsbOpts | ||
---@field callbacks KsbCallbacks|nil fire and forget callback functions | ||
---@field keymaps_enabled boolean|nil if true, enabled all default keymaps | ||
---@field restore_options boolean|nil if true, restore options that were modified while processing the scrollback buffer | ||
---@field highlight_overrides KsbHighlights|nil kitty-scrollback.nvim highlight overrides | ||
---@field status_window KsbStatusWindowOpts|nil options for status window indicating that kitty-scrollback.nvim is ready | ||
---@field paste_window KsbPasteWindowOpts|nil options for paste window that sends commands to Kitty | ||
---@field kitty_get_text KsbKittyGetText|nil options passed to get-text when reading scrollback buffer, see `kitty @ get-text --help` | ||
---@field checkhealth boolean|nil if true execute :checkhealth kitty-scrollback and skip setup | ||
---@field visual_selection_highlight_mode string | 'darken' | 'kitty' | 'nvim' | 'reverse' | nil | ||
local default_opts = { | ||
callbacks = nil, | ||
keymaps_enabled = true, | ||
restore_options = false, | ||
highlight_overrides = nil, | ||
status_window = { | ||
enabled = true, | ||
style_simple = false, | ||
autoclose = false, | ||
show_timer = false, | ||
icons = { | ||
kitty = '', | ||
heart = '', -- variants | | | ♥ | | | | ||
nvim = '', -- variants | | | | ||
}, | ||
}, | ||
paste_window = { | ||
highlight_as_normal_win = nil, | ||
filetype = nil, | ||
hide_footer = false, | ||
winblend = 0, | ||
winopts_overrides = nil, | ||
footer_winopts_overrides = nil, | ||
yank_register = '', | ||
yank_register_enabled = true, | ||
}, | ||
kitty_get_text = { | ||
ansi = true, | ||
extent = 'all', | ||
clear_selection = true, | ||
}, | ||
checkhealth = false, | ||
visual_selection_highlight_mode = 'darken', | ||
} | ||
|
||
return default_opts |
Oops, something went wrong.