kitty-scrollback.nvim icon indicating copy to clipboard operation
kitty-scrollback.nvim copied to clipboard

feat: make the yank register configurable

Open mikesmithgh opened this issue 2 years ago • 0 comments

Currently, the register '+' copies text and immediately exits. This register is hardcoded in the autocommands and keymaps, make this configurable similar to the paste window register.

See

  • https://github.com/mikesmithgh/kitty-scrollback.nvim/blob/4696f080f082377e9c2ce5f280abc1b02d33137b/lua/kitty-scrollback/autocommands.lua#L125
  • https://github.com/mikesmithgh/kitty-scrollback.nvim/blob/main/lua/kitty-scrollback/keymaps.lua#L51

Using the example from https://github.com/mikesmithgh/kitty-scrollback.nvim/issues/152

        global = function()
          vim.keymap.set({ 'v' }, 'Y', '<Plug>(KsbVisualYankLine)', {})
          vim.keymap.set({ 'v' }, 'y', '<Plug>(KsbVisualYank)', {})
          vim.keymap.set({ 'n' }, 'Y', '<Plug>(KsbNormalYankEnd)', {})
          vim.keymap.set({ 'n' }, 'y', '<Plug>(KsbNormalYank)', {})
          vim.keymap.set({ 'n' }, 'yy', '<Plug>(KsbYankLine)', {})

          vim.keymap.set({ 'v' }, '<leader>Y', '"aY', {})
          vim.keymap.set({ 'v' }, '<leader>y', '"ay', {})
          vim.keymap.set({ 'n' }, '<leader>Y', '"aY', {})
          vim.keymap.set({ 'n' }, '<leader>y', '"ay', {})
          vim.keymap.set({ 'n' }, '<leader>yy', '"ayy', {})
          return {
            paste_window = { yank_register = 'a' },
          }

yanks to other registers, for example b still go to the register +.

The current state makes it difficult to modify the behavior of yanks opening the paste window vs normal behavior vs copying to the clipboard and quitting.

mikesmithgh avatar Jan 07 '24 16:01 mikesmithgh