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

Configure Feed

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

chore: allowed new globals in luacheck ci

ptdewey 3aadbf7d 154ad4e3

+20 -18
+1 -1
Makefile
··· 4 4 5 5 lint: 6 6 echo "Linting lua/yankbank..." 7 - luacheck lua/ --globals vim 7 + luacheck lua/ --globals vim YANKS REG_TYPES OPTS 8 8 9 9 pr-ready: fmt lint
+1
README.md
··· 130 130 vim.keymap.set("n", "<leader>y", "<cmd>YankBank<CR>", { noremap = true }) 131 131 ``` 132 132 133 + <!-- TODO: add section for api --> 133 134 134 135 ## Potential Improvements 135 136 - nvim-cmp integration
+2 -2
lua/yankbank/api.lua
··· 25 25 26 26 --- add an entry to yankbank 27 27 ---@param yank_text string yank text to add to YANKS table 28 - ---@param reg_type string register type "v", "V", or "^V" for visual, visual-linewise, and visual-block modes respectively. 28 + ---@param reg_type string register type "v", "V", or "^V" (visual, v-line, v-block respectively) 29 29 function M.add_entry(yank_text, reg_type) 30 30 require("yankbank.clipboard").add_yank(yank_text, reg_type) 31 31 end ··· 36 36 local yank_text = table.remove(YANKS, i) 37 37 table.remove(REG_TYPES, i) 38 38 if OPTS.persist_type == "sqlite" then 39 - require("yankbank.persistence.sql").data():remove_match(yank_text) 39 + require("yankbank.persistence.sql").data().remove_match(yank_text) 40 40 end 41 41 end 42 42
+15 -14
lua/yankbank/menu.lua
··· 3 3 local data = require("yankbank.data") 4 4 local helpers = require("yankbank.helpers") 5 5 6 + -- default plugin keymaps 7 + local default_keymaps = { 8 + navigation_next = "j", 9 + navigation_prev = "k", 10 + paste = "<CR>", 11 + yank = "yy", 12 + close = { "<Esc>", "<C-c>", "q" }, 13 + } 14 + 15 + -- define default yank register 16 + local default_registers = { 17 + yank_register = "+", 18 + } 19 + 6 20 --- Container class for YankBank buffer related variables 7 21 ---@class YankBankBufData 8 22 ---@field bufnr integer ··· 88 102 --- Set key mappings for the popup window 89 103 ---@param b YankBankBufData 90 104 function M.set_keymaps(b) 91 - -- default plugin keymaps 92 - local default_keymaps = { 93 - navigation_next = "j", 94 - navigation_prev = "k", 95 - paste = "<CR>", 96 - yank = "yy", 97 - close = { "<Esc>", "<C-c>", "q" }, -- TODO: issues might arise passing non-table single value for this 98 - } 99 - 100 - -- define default yank register 101 - local default_registers = { 102 - yank_register = "+", 103 - } 104 - 105 105 -- key mappings for selection and closing the popup 106 106 local map_opts = { noremap = true, silent = true, buffer = b.bufnr } 107 107 ··· 189 189 end, { buffer = b.bufnr }) 190 190 191 191 -- close popup keybinds 192 + -- REFACTOR: check if close keybind is string, handle differently 192 193 for _, map in ipairs(k.close) do 193 194 vim.keymap.set("n", map, function() 194 195 vim.api.nvim_win_close(b.win_id, true)
+1 -1
lua/yankbank/persistence/sql.lua
··· 84 84 85 85 --- remove an entry from the banks table matching input text 86 86 ---@param text string 87 - function data:remove_match(text) 87 + function data.remove_match(text) 88 88 db:with_open(function() 89 89 return db:eval( 90 90 "DELETE FROM bank WHERE yank_text = :yank_text",