Skip to content
Mike edited this page Aug 14, 2024 · 24 revisions

Table of Contents generated with DocToc

Advanced Configuration

Examples

See Advanced Configuration Examples for detailed demos of configuration options.

Useful Configurations

Find text in scrollback buffer / start in backward search

After kitty-scrollback.nvim loads, enter command-line mode with the search pattern "?" to start searching for text. The following creates a configurations with the name search and a mapping to open it with kitty_mod+f.

Plugin Configuration

require('kitty-scrollback').setup({
  search = {
    callbacks = {
      after_ready = function()
        vim.api.nvim_feedkeys('?', 'n', false)
      end,
    },
  },
})

Kitten Configuration

map kitty_mod+f kitty_scrollback_nvim --config search

Recommended Configurations for other plugins

Recommended configurations for other plugins that may be impacted by kitty-scrollback.nvim.

Disable auto-save.nvim when kitty-scrollback.nvim is active.

require('auto-save').setup({
  enabled = vim.env.KITTY_SCROLLBACK_NVIM ~= 'true',
})

Disable auto-session when kitty-scrollback.nvim is active.

require('auto-session').setup({
  auto_session_enabled = vim.env.KITTY_SCROLLBACK_NVIM ~= 'true',
})

Hide kitty-scrollback.nvim buffers in the tabline.

require('barbar').setup({
  auto_hide = vim.env.KITTY_SCROLLBACK_NVIM == 'true' and 1 or -1,
})

Disable image.nvim when kitty-scrollback.nvim is active.

if vim.env.KITTY_SCROLLBACK_NVIM ~= 'true' then
  require('image').setup()
end

Alternatively, if you are using lazy.nvim, then you can use the cond option.

{
  '3rd/image.nvim',
  cond = vim.env.KITTY_SCROLLBACK_NVIM ~= 'true',
  ...
}

If you prefer to have image.nvim enabled, see #261 for additional troubleshooting steps.

Recommended Configurations for shells

Bash

  • kitty-scrollback.nvim uses bracketed paste mode when sending contents to kitty. \e[200~ is sent to the terminal to start bracketed paste mode where \e represents escape. It is possible that if you have already typed escape and then opened kitty-scrollback.nvim, you will see the text [200~ before the content you sent to kitty. This is because the first escape causes the start of the message to be \e\e[200~ and the first \e interferes with the second \e which is starting bracketed paste mode. kitty-scrollback.nvim previously handled this is versions <= v4.3.4 by starting the message with a null character to avoid the case of two escapes. The start of the message would then look like \e\0\e[200~ where \e is escape and \0 is the null character. This worked as expected for bash, but causes empty spaces to be displayed for other shells like fish. kitty-scrollback.nvim no longer sends the null character and it is recommended to replace two escapes to a no operation in bash to avoid this scenario.
    • Add the following to your ~/.inputrc file to remap two escapes to a no operation. ~/.inputrc is the readline init file that is used by bash to handle custom key bindings.
      "\e\e": ""
Clone this wiki locally