-
Notifications
You must be signed in to change notification settings - Fork 12
Advanced Configuration Examples
ksb_builtin_get_text_all
Configuration
- Source: builtin.lua#L3-L7
{
kitty_get_text = {
extent = 'all',
},
},
ksb_example_get_text_all_plain
Configuration
- Source: example.lua#L62-L67
{
kitty_get_text = {
extent = 'all',
ansi = false,
},
},
ksb_builtin_last_cmd_output
Configuration
- Source: builtin.lua#L8-L12
{
kitty_get_text = {
extent = 'last_cmd_output',
},
},
ksb_example_get_text_last_cmd_output_plain
Configuration
- Source: example.lua#L80-L85
{
kitty_get_text = {
extent = 'last_cmd_output',
ansi = false,
},
},
ksb_builtin_last_visited_cmd_output
Configuration
- Source: builtin.lua#L13-L17
{
kitty_get_text = {
extent = 'last_visited_cmd_output',
},
},
ksb_example_get_text_last_visited_cmd_output_plain
Configuration
- Source: example.lua#L98-L103
{
kitty_get_text = {
extent = 'last_visited_cmd_output',
ansi = false,
},
},
ksb_example_callbacks
Configuration
- Source: example.lua#L24-L61
function()
local msg = {}
return {
callbacks = {
after_setup = function()
vim.defer_fn(function()
table.insert(
msg,
'# kitty-scrollback after_setup callback triggered @ ' .. vim.fn.strftime('%c')
)
end, 1000)
end,
after_launch = function()
vim.defer_fn(function()
table.insert(
msg,
'# kitty-scrollback after_launch callback triggered @ ' .. vim.fn.strftime('%c')
)
end, 2000)
end,
after_ready = function(kitty_data, opts)
vim.defer_fn(function()
vim.cmd.startinsert()
table.insert(
msg,
'# kitty-scrollback after_ready callback triggered @ ' .. vim.fn.strftime('%c')
)
table.insert(msg, '# kitty_data:')
table.insert(msg, '# ' .. vim.fn.json_encode(kitty_data))
table.insert(msg, '# opts:')
table.insert(msg, '# ' .. vim.fn.json_encode(vim.inspect(opts)))
vim.api.nvim_buf_set_lines(0, 0, -1, false, msg)
vim.cmd.stopinsert()
end, 3000)
end,
},
}
end,
ksb_example_status_win_autoclose
Configuration
- Source: example.lua#L292-L296
{
status_window = {
autoclose = true,
},
},
ksb_example_status_win_show_timer
Configuration
- Source: example.lua#L302-L311
{
status_window = {
show_timer = true,
},
callbacks = {
after_setup = function()
vim.loop.sleep(8000)
end,
},
},
ksb_example_status_win_vim
Configuration
- Source: example.lua#L312-L318
{
status_window = {
icons = {
nvim = '',
},
},
},
ksb_example_status_win_simple
Configuration
- Source: example.lua#L319-L323
{
status_window = {
style_simple = true,
},
},
ksb_example_get_text_first_cmd_output_on_screen
Configuration
- Source: example.lua#L68-L73
{
kitty_get_text = {
extent = 'first_cmd_output_on_screen',
ansi = true,
},
},
ksb_example_get_text_first_cmd_output_on_screen_plain
Configuration
- Source: example.lua#L74-L79
{
kitty_get_text = {
extent = 'first_cmd_output_on_screen',
ansi = false,
},
},
ksb_example_get_text_last_non_empty_output
Configuration
- Source: example.lua#L86-L91
{
kitty_get_text = {
extent = 'last_non_empty_output',
ansi = true,
},
},
ksb_example_get_text_last_non_empty_output_plain
Configuration
- Source: example.lua#L92-L97
{
kitty_get_text = {
extent = 'last_non_empty_output',
ansi = false,
},
},
ksb_example_get_text_screen
Configuration
- Source: example.lua#L104-L109
{
kitty_get_text = {
extent = 'screen',
ansi = true,
},
},
ksb_example_get_text_screen_plain
Configuration
- Source: example.lua#L110-L115
{
kitty_get_text = {
extent = 'screen',
ansi = false,
},
},
ksb_example_get_text_selection
Configuration
- Source: example.lua#L116-L121
{
kitty_get_text = {
extent = 'selection',
ansi = true,
},
},
ksb_example_get_text_selection_plain
Configuration
- Source: example.lua#L129-L134
{
kitty_get_text = {
extent = 'selection',
ansi = false,
},
},
ksb_example_get_text_selection_keep_selection
Configuration
- Source: example.lua#L122-L128
{
kitty_get_text = {
extent = 'selection',
ansi = true,
clear_selection = false,
},
},
ksb_example_highlight_overrides
Configuration
- Source: example.lua#L135-L180
function()
for i = 0, 15 do
vim.g['terminal_color_' .. i] = 'Cyan'
end
return {
highlight_overrides = {
KittyScrollbackNvimStatusWinNormal = {
fg = '#ee82ee',
bg = '#ee82ee',
},
KittyScrollbackNvimStatusWinHeartIcon = {
fg = '#ff0000',
bg = '#4b0082',
},
KittyScrollbackNvimStatusWinSpinnerIcon = {
fg = '#000099',
bg = '#4b0082',
},
KittyScrollbackNvimStatusWinReadyIcon = {
fg = '#4b0082',
bg = '#ffa500',
},
KittyScrollbackNvimStatusWinKittyIcon = {
fg = '#ffa500',
bg = '#000099',
},
KittyScrollbackNvimStatusWinNvimIcon = {
fg = '#008000',
bg = '#000099',
},
KittyScrollbackNvimPasteWinNormal = {
link = 'IncSearch',
},
KittyScrollbackNvimPasteWinFloatBorder = {
link = 'IncSearch',
},
KittyScrollbackNvimPasteWinFloatTitle = {
link = 'IncSearch',
},
KittyScrollbackNvimVisual = {
bg = 'Pink',
fg = 'Black',
},
},
}
end,
ksb_example_visual_selection_highlight_mode_reverse
Configuration
- Source: example.lua#L181-L183
{
visual_selection_highlight_mode = 'reverse',
},
ksb_example_keymaps_custom
Configuration
- Source: example.lua#L184-L197
function()
vim.keymap.set({ 'v' }, 'sY', '<Plug>(KsbVisualYankLine)', {})
vim.keymap.set({ 'v' }, 'sy', '<Plug>(KsbVisualYank)', {})
vim.keymap.set({ 'n' }, 'sY', '<Plug>(KsbNormalYankEnd)', {})
vim.keymap.set({ 'n' }, 'sy', '<Plug>(KsbNormalYank)', {})
vim.keymap.set({ 'n' }, 'syy', '<Plug>(KsbYankLine)', {})
vim.keymap.set({ 'n' }, 'q', '<Plug>(KsbCloseOrQuitAll)', {})
vim.keymap.set({ 'n', 't', 'i' }, 'ZZ', '<Plug>(KsbQuitAll)', {})
vim.keymap.set({ 'n' }, '<tab>', '<Plug>(KsbToggleFooter)', {})
vim.keymap.set({ 'n', 'i' }, '<cr>', '<Plug>(KsbExecuteCmd)', {})
vim.keymap.set({ 'n', 'i' }, '<c-v>', '<Plug>(KsbPasteCmd)', {})
vim.keymap.set({ 'v' }, '<leader><cr>', '<Plug>(KsbExecuteVisualCmd)', {})
vim.keymap.set({ 'v' }, '<leader><c-v>', '<Plug>(KsbPasteVisualCmd)', {})
end,
ksb_example_keymaps_disabled
Configuration
- Source: example.lua#L198-L200
{
keymaps_enabled = false,
},
ksb_example_paste_win_filetype
Configuration
- Source: example.lua#L201-L235
{
paste_window = {
filetype = 'markdown',
},
callbacks = {
after_ready = vim.schedule_wrap(function()
local msg = {
'',
'\t',
'',
'# kitty-scrollback.nvim example',
'',
'## Change paste window filetype to `markdown`',
'',
'```lua',
'paste_window = {',
' filetype = "markdown", -- change this to your desired filetype',
'},',
'```',
}
local curbuf = vim.api.nvim_get_current_buf()
vim.cmd.startinsert()
vim.fn.timer_start(250, function(t) ---@diagnostic disable-line: redundant-parameter
if curbuf ~= vim.api.nvim_get_current_buf() then
vim.fn.timer_stop(t)
vim.api.nvim_buf_set_lines(0, 0, -1, false, msg)
vim.cmd.stopinsert()
vim.fn.setcursorcharpos(2, 4)
end
end, {
['repeat'] = 12,
})
end),
},
},
ksb_example_paste_win_hide_mappings
Configuration
- Source: example.lua#L236-L240
{
paste_window = {
hide_footer = true,
},
},
ksb_example_paste_win_highlight_as_float
Configuration
- Source: example.lua#L241-L247
{
paste_window = {
highlight_as_normal_win = function()
return false
end,
},
},
ksb_example_paste_win_register_disabled
Configuration
- Source: example.lua#L253-L257
{
paste_window = {
yank_register_enabled = false,
},
},
ksb_example_paste_win_register
Configuration
- Source: example.lua#L248-L252
{
paste_window = {
yank_register = '*',
},
},
ksb_example_paste_win_winblend
Configuration
- Source: example.lua#L258-L262
{
paste_window = {
winblend = 50,
},
},
ksb_example_paste_win_winopts
Configuration
- Source: example.lua#L263-L284
{
paste_window = {
winblend = 10,
winopts_overrides = function()
local h = vim.o.lines - 5 -- TODO: magic number 3 for footer and 2 for border
return {
border = 'solid',
row = 0,
col = 0,
height = h < 1 and 3 or h, -- TODO: magic number 3 for footer
width = vim.o.columns,
}
end,
footer_winopts_overrides = function()
return {
border = 'single',
title = ' kitty-scrollback.nvim ',
title_pos = 'center',
}
end,
},
},
ksb_example_restore_opts
Configuration
- Source: example.lua#L285-L291
function()
vim.o.termguicolors = true
vim.o.number = true
return {
restore_options = true,
}
end,
ksb_example_status_win_disabled
Configuration
- Source: example.lua#L297-L301
{
status_window = {
enabled = false,
},
},
ksb_example_env_nvim_appname
ksb_example_nvim_args_darkblue
ksb_builtin_checkhealth
Configuration
- Source: builtin.lua#L18-L20
{
checkhealth = true,
},
😽 Open your Kitty scrollback buffer with Neovim. Ameowzing!