Skip to content

feat: add option: close_after_yankΒ #328

@EmmetZ

Description

@EmmetZ

Could we have a close_after_yank setting in the default config? It would default to true but let users choose their preferred behaviour.


use case:
sometimes I want to copy multiple words and paste them in different places, but once I yank the first word, scrollback buffer automatically closes and I have to relaunch it again to yank the rest.

I get this idea from Alacritty since it won't quit vim mode after a yank operation. (Thanks for this awesome plugin. Now I can use vim mode in Kitty just like in Alacritty but with even more features!)

posible solution:

in lua/kitty-scrollback/configs/defaults.lua:

@@ -62,6 +63,7 @@ local default_opts = {
   keymaps_enabled = true,
   restore_options = false,
   highlight_overrides = nil,
+  close_after_yank = true,
   status_window = {
     enabled = true,
     style_simple = false,

in lua/kitty-scrollback/autocommands.lua:

@@ -154,9 +154,11 @@ M.set_yank_post_autocmd = function()
             -- see issue https://github.com/astrand/xclip/issues/38#ref-commit-b042f6d
             defer_ms = 200
           end
-          vim.defer_fn(function()
-            ksb_util.quitall()
-          end, defer_ms)
+          if opts.close_after_yank then
+            vim.defer_fn(function()
+              ksb_util.quitall()
+            end, defer_ms)
+          end
         else

Do you think this is appropriate :) ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions