this post was submitted on 19 Sep 2023
17 points (100.0% liked)

Neovim

2183 readers
1 users here now

founded 1 year ago
MODERATORS
 

๐Ÿ‘‹ Hey all, first post on Lemmy.

I recently released v1.0.1 of kitty-scrollback.nvim. If you have any feedback, issues, or suggestions feel free to open an issue. I'm interested to get feedback if the setup easy or if there are any unclear/confusing steps. This requires Neovim nightly (v0.10) and Kitty v0.29.

kitty-scrollbakc.nvim

โœจ Features

  • ๐Ÿ˜ป Navigate Kitty's scrollback buffer with Neovim
  • ๐Ÿฑ Copy contents from Neovim to system clipboard
  • ๐Ÿ˜บ Send contents from Neovim to Kitty shell
  • ๐Ÿ™€ Execute shell command from Neovim to Kitty shell
you are viewing a single comment's thread
view the rest of the comments
[โ€“] sorrybookbroke@sh.itjust.works 4 points 1 year ago (5 children)

I can see this being very useful for those small scripts I make but stubbornly don't break out into a script file when it doesn't work first try. It there any way to just make it launch empty on the prompt to start the command from there?

[โ€“] nvimmike@programming.dev 2 points 1 year ago (4 children)

thanks! when you say launch empty, do you mean without the scrollback buffer? or just with a blank window for the command?

[โ€“] sorrybookbroke@sh.itjust.works 2 points 1 year ago (3 children)

Sorry for the delay, but yeah I mean without the scrollback buffer. Right from the prompt, get a neovim buffer that excecutes. Thanks again for sharing btw, this is a fantastic project

[โ€“] nvimmike@programming.dev 3 points 1 year ago* (last edited 1 year ago) (1 children)

ah I gotcha. There is no option at the moment to completely disable the scrollback, but you could hook into some callbacks to trigger and customizations.

For example,

your_awesome_config.lua

local M = {}

M.config = function(kitty_data)
  return {
    paste_window = {
      winblend = 10,
      winopts_overrides = function(paste_winopts)
        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(footer_winopts, paste_winopts)
        return {
          border = 'single',
          title = ' kitty-scrollback.nvim ',
          title_pos = 'center',
        }
      end,
    },
    kitty_get_text = {
      extent = 'screen',
      ansi = true,
    },
    callbacks = {
      after_ready = function(kitty_data, opts)
        vim.cmd.startinsert()
      end,
    },
  }
end

return M

kitty.conf

map f1 kitty_scrollback_nvim --config-file /your_awesome_config.lua

demo-kitty-exec

I plan to document some of the advanced configurations, just haven't had time to get to it ๐Ÿ‘

I could add an option to have no scrollback and a single buffer like you mentioned similar to `` behavior in bash. I'll think on that one.

Thanks for the kind words ๐Ÿ™‚

[โ€“] sorrybookbroke@sh.itjust.works 2 points 1 year ago (1 children)

Wow that's sick, thank you for the help here didn't realise you were the dev. Fantastic work

[โ€“] nvimmike@programming.dev 2 points 1 year ago

haha yep ๐Ÿ™‚ took a couple attempts to get it to where it is but I'm happy with it now

load more comments (1 replies)
load more comments (1 replies)
load more comments (1 replies)