Skip to content

Commit c73a59e

Browse files
feat: make temporary scrollback buffer columns configurable (#343)
* feat: make temporary scrollback buffer columns configurable --------- Co-authored-by: Mike Smith <10135646+mikesmithgh@users.noreply.github.com>
1 parent 36d19dc commit c73a59e

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,8 @@ The configuration precedence is `default` > `global` > `builtin` > `user` where
653653
checkhealth = false,
654654
-- 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.
655655
visual_selection_highlight_mode = 'darken',
656+
-- integer? Temporary column width during get-text operation to avoid hard wrapping (larger values may impact performance), see :h columns
657+
scrollback_columns = 300,
656658
}
657659
```
658660

lua/kitty-scrollback/configs/defaults.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
---@field kitty_get_text KsbKittyGetText|nil options passed to get-text when reading scrollback buffer, see `kitty @ get-text --help`
5858
---@field checkhealth boolean|nil if true execute :checkhealth kitty-scrollback and skip setup
5959
---@field visual_selection_highlight_mode string | 'darken' | 'kitty' | 'nvim' | 'reverse' | nil
60+
---@field scrollback_columns integer|nil temporary column width during get-text operation to avoid hard wrapping (larger values may impact performance), see :h columns
6061
local default_opts = {
6162
callbacks = nil,
6263
keymaps_enabled = true,
@@ -90,6 +91,7 @@ local default_opts = {
9091
},
9192
checkhealth = false,
9293
visual_selection_highlight_mode = 'darken',
94+
scrollback_columns = 300,
9395
}
9496

9597
return default_opts

lua/kitty-scrollback/kitty_commands.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ M.get_text_term = function(get_text_opts, on_exit_cb)
7878
-- current window size. Note: a larger min_cols appears to impact performance
7979
-- defer is used as a timing workaround because this is expected to be called right before
8080
-- opening the terminal
81-
p.orig_columns = defer_resize_term(300)
81+
p.orig_columns = defer_resize_term(opts.scrollback_columns)
8282

8383
-- set the shell used to sh to avoid imcompatabiliies with other shells (e.g., nushell, fish, etc)
8484
vim.o.shell = 'sh'

0 commit comments

Comments
 (0)