Neovim plugin improving access to clipboard history (mirror)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add paste-by-index keybind functionality

ptdewey 8b9b22bf ded8f01b

+21
+21
lua/yankbank/init.lua
··· 10 10 local menu = require("yankbank.menu") 11 11 local clipboard = require("yankbank.clipboard") 12 12 local persistence = require("yankbank.persistence") 13 + local helpers = require("yankbank.helpers") 13 14 14 15 -- default plugin options 15 16 local default_opts = { ··· 23 24 keymaps = {}, 24 25 persist_type = nil, 25 26 db_path = nil, 27 + bind_indices = nil, 26 28 } 27 29 28 30 --- wrapper function for main plugin functionality ··· 61 63 vim.api.nvim_create_user_command("YankBank", function() 62 64 show_yank_bank() 63 65 end, { desc = "Show Recent Yanks" }) 66 + 67 + -- Bind 1-n if `bind_indices` is set to a string 68 + print(YB_OPTS.bind_indices or "no index keybind map set") 69 + if YB_OPTS.bind_indices then 70 + for i = 1, YB_OPTS.max_entries do 71 + vim.keymap.set( 72 + "n", 73 + YB_OPTS.bind_indices .. i, 74 + function() 75 + helpers.smart_paste(YB_YANKS[i], YB_REG_TYPES[i], true) 76 + end, 77 + { 78 + noremap = true, 79 + silent = true, 80 + desc = "Paste YankBank entry " .. i, 81 + } 82 + ) 83 + end 84 + end 64 85 end 65 86 66 87 return M