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

Configure Feed

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

doc: updated readme with api changes

+28 -2
+28 -2
README.md
··· 58 58 | keymaps.navigation_next | string | `"j"` | 59 59 | keymaps.navigation_prev | string | `"k"` | 60 60 | keymaps.paste | string | `"<CR>"` | 61 + | keymaps.paste_back | string | `"P"` | 61 62 | keymaps.yank | string | `"yy"` | 62 63 | keymaps.close | table of strings | `{ "<Esc>", "<C-c>", "q" }` | 63 64 | num_behavior | string defining jump behavior "prefix" or "jump" | `"prefix"` | ··· 81 82 persist_type = "sqlite", 82 83 keymaps = { 83 84 paste = "<CR>", 85 + paste_back = "P", 84 86 }, 85 87 registers = { 86 88 yank_register = "+", ··· 118 120 } 119 121 ``` 120 122 121 - 122 123 ## Usage 123 124 124 125 The popup menu can be opened with the command:`:YankBank`, an entry is pasted at the current cursor position by hitting enter, and the menu can be closed by hitting escape, ctrl-c, or q. ··· 130 131 vim.keymap.set("n", "<leader>y", "<cmd>YankBank<CR>", { noremap = true }) 131 132 ``` 132 133 133 - <!-- TODO: add section for api --> 134 + --- 135 + 136 + ## API (WIP) 137 + 138 + Some plugin internals are also accessible via the YankBank api. 139 + 140 + Examples: 141 + ```lua 142 + -- get the 2nd entry in the bank 143 + ---@param i integer index to get 144 + -- output format: { yank_text = "entry", reg_type = "v" } 145 + local e = require("yankbank.api").get_entry(2) 146 + 147 + -- add an entry to the bank 148 + ---@param yank_text string yank text to add to YANKS table 149 + ---@param reg_type string register type "v", "V", or "^V" (visual, v-line, v-block respectively) 150 + require("yankbank.api").add_entry("yank_text", "reg_type") 151 + 152 + -- remove an entry from the bank by index 153 + ---@param i integer index to remove 154 + require("yankbank.api").remove_entry(1) 155 + ``` 156 + 157 + For more details about the API see [lua/yankbank/api.lua](lua/yankbank/api.lua) 158 + 159 + --- 134 160 135 161 ## Potential Improvements 136 162 - nvim-cmp integration