# Open Kitty Scroll Back Buffer in Neovim
## Metadata
**Status**:: #x
**Zettel**:: #zettel/literature
**Created**:: [[2026-02-28]]
**Tags**:: #vim #command-line
## Synopsis
Change the keymap in `kitty.conf`.
```
map kitty_mod+h launch --stdin-source=@screen_scrollback --stdin-add-formatting --type=overlay nvim +TermHl
map kitty_mod+g launch --stdin-source=@last_cmd_output --stdin-add-formatting --type=overlay nvim +TermHl
```
The `TermHl` command comes from the neovim help on `ansi-colorize`:
```lua
vim.api.nvim_create_user_command("TermHl", function()
vim.api.nvim_open_term(0, {})
vim.keymap.set("n", "q", "<Cmd>q<CR>", { buffer = true })
end, { desc = "Highlights ANSI termcodes in curbuf" })
```
I also bind `q` to exit vim.
To simplify copying selection into system clipboard, set option `clipboard` to `unnameplus`. Use `KITTY_PIPE_DATA` to only enable when invoked from kitty:
```lua
vim.opt.clipboard = vim.env.KITTY_PIPE_DATA and "unnamedplus" or ""
```