{"id":13477371,"url":"https://github.com/ptdewey/yankbank-nvim","last_synced_at":"2026-01-17T22:24:01.710Z","repository":{"id":227882388,"uuid":"772298624","full_name":"ptdewey/yankbank-nvim","owner":"ptdewey","description":"Neovim plugin improving access to clipboard history","archived":false,"fork":false,"pushed_at":"2026-01-17T01:39:19.000Z","size":405,"stargazers_count":123,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-17T13:57:12.143Z","etag":null,"topics":["lua","neovim","neovim-lua","neovim-plugin"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ptdewey.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"ptdewey"}},"created_at":"2024-03-14T23:12:23.000Z","updated_at":"2026-01-17T01:39:13.000Z","dependencies_parsed_at":"2024-04-02T19:28:45.424Z","dependency_job_id":"ba3d3d27-dd61-405b-8f0c-05db9284745e","html_url":"https://github.com/ptdewey/yankbank-nvim","commit_stats":null,"previous_names":["ptdewey/yankbank-nvim"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/ptdewey/yankbank-nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptdewey%2Fyankbank-nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptdewey%2Fyankbank-nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptdewey%2Fyankbank-nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptdewey%2Fyankbank-nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ptdewey","download_url":"https://codeload.github.com/ptdewey/yankbank-nvim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptdewey%2Fyankbank-nvim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28520282,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T22:11:28.393Z","status":"ssl_error","status_checked_at":"2026-01-17T22:11:27.841Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lua","neovim","neovim-lua","neovim-plugin"],"created_at":"2024-07-31T16:01:41.823Z","updated_at":"2026-01-17T22:24:01.704Z","avatar_url":"https://github.com/ptdewey.png","language":"Lua","funding_links":["https://github.com/sponsors/ptdewey"],"categories":["Lua","Editing Support"],"sub_categories":["Scrollbar"],"readme":"# YankBank\n\nA Neovim plugin for keeping track of more recent yanks and deletions and exposing them in a quick access menu.\n\n## What it Does\n\nYankBank stores the N recent yanks into the unnamed register (\"), then populates a popup window with these recent yanks, allowing for quick access to recent yank history.\nUpon opening the popup menu, the current contents of the unnamedplus (+) register are also added to the menu (if they are different from the current contents of the unnamed register).\n\nChoosing an entry from the menu (by hitting enter) will paste it into the currently open buffer at the cursor position.\n\nYankBank also offers persistence between sessions, meaning that you won't lose your yanks after closing and reopening a session (see [persistence](#Persistence)).\n\n### Screenshots\n\n![YankBank popup window zoomed](assets/screenshot-2.png)\n\nThe menu is specific to the current session, and will only contain the contents of the current unnamedplus register upon opening in a completely new session.\nIt will be populated further for each yank or deletion in that session.\n\n## Installation and Setup\n\n#### With Persistence (Recommended)\n\nUsing lazy.nvim\n```lua\n{\n    \"ptdewey/yankbank-nvim\",\n    dependencies = \"kkharji/sqlite.lua\",\n    cmd = { \"YankBank\" },\n    config = function()\n        require('yankbank').setup({\n            persist_type = \"sqlite\",\n        })\n    end,\n}\n```\n\n#### Without persistence:\n\nUsing lazy.nvim\n```lua\n{\n    \"ptdewey/yankbank-nvim\",\n    cmd = { \"YankBank\" },\n    config = function()\n        require('yankbank').setup()\n    end,\n}\n```\n\n#### Lazy loading\n\nPer [best practices](https://github.com/nvim-neorocks/nvim-best-practices?tab=readme-ov-file#sleeping_bed-lazy-loading), YankBank's initialization footprint is very minimal, and functionalities are only loaded when they are needed. As such, I set `lazy=false` in my config, and get a startup time of \u003c1ms.\n\n```lua\n-- plugins/yankbank.lua\nreturn {\n    {\n        \"ptdewey/yankbank-nvim\",\n        lazy = false,\n        config = function()\n            -- ...\n        end,\n    },\n    {\n        \"kkharji/sqlite.lua\",\n        lazy = true,\n    },\n}\n```\n\nIf you don't want to load YankBank on startup, I previously loaded it on keypresses that yank text (`y`, `Y`, `d`, `D`, `x`), the `FocusGained` event, and the `YankBank` command.\n```lua\n{\n    \"ptdewey/yankbank-nvim\",\n    dependencies = \"kkharji/sqlite.lua\",\n    keys = {\n        { \"y\" },\n        { \"Y\", \"y$\" }, -- redefine Y behavior to y$ to avoid breaking lazy\n        { \"D\" },\n        { \"d\" },\n        { \"x\" },\n        { \"\u003cleader\u003ep\", desc = \"Open YankBank\" },\n    },\n    cmd = { \"YankBank\" },\n    event = { \"FocusGained\" },\n    config = function()\n        require(\"yankbank\").setup({\n            -- ...\n        })\n    end\n}\n```\n\n\n### Setup Options\n\nThe setup function also supports taking in a table of options:\n| Option | Type | Default |\n|-------------|--------------------------------------------|----------------|\n| max_entries | integer number of entries to show in popup | `10` |\n| sep | string separator to show between table entries | `\"-----\"` |\n| keymaps | table containing keymap overrides | `{}` |\n| keymaps.navigation_next | string | `\"j\"` |\n| keymaps.navigation_prev | string | `\"k\"` |\n| keymaps.paste | string | `\"\u003cCR\u003e\"` |\n| keymaps.paste_back | string | `\"P\"` |\n| keymaps.yank | string | `\"yy\"` |\n| keymaps.close | table of strings | `{ \"\u003cEsc\u003e\", \"\u003cC-c\u003e\", \"q\" }` |\n| num_behavior | string defining jump behavior \"prefix\" or \"jump\" | `\"prefix\"` |\n| focus_gain_poll | boolean | `false` |\n| registers | table container for register overrides | `{ }` |\n| registers.yank_register | default register to yank from popup to | `\"+\"` |\n| persist_type | string defining persistence type \"sqlite\" or nil | `nil` |\n| db_path | string defining database file path for use with sqlite persistence | plugin install directory |\n| bind_indices | optional string to be used for keybind prefix for pasting by index number (i.e. \"\u003cleader\u003ep\") | `nil` |\n| pickers | table containing all pickers. | `{}` |\n| pickers.snacks | boolean | `false` |\n\n\n#### Example Configuration\n\n```lua\n{\n    \"ptdewey/yankbank-nvim\",\n    dependencies = {\n        \"folke/snacks.nvim\", -- (optional) - snacks picker integration\n    },\n    config = function()\n        require('yankbank').setup({\n            max_entries = 9,\n            sep = \"-----\",\n            num_behavior = \"jump\",\n            focus_gain_poll = true,\n            persist_type = \"sqlite\",\n            keymaps = {\n                paste = \"\u003cCR\u003e\",\n                paste_back = \"P\",\n            },\n            registers = {\n                yank_register = \"+\",\n            },\n            bind_indices = \"\u003cleader\u003ep\"\n            pickers = {\n                snacks = true,\n            },\n        })\n    end,\n}\n```\n\nIf no separator is desired, pass in an empty string for `sep`\n\nThe 'num_behavior' option defines in-popup navigation behavior when hitting number keys.\n- `num_behavior = \"prefix\"` works similar to traditional vim navigation with '3j' moving down 3 entries in the bank.\n- `num_behavior = \"jump\"` jumps to entry matching the pressed number key (i.e. '3' jumps to entry 3)\n    - Note: If 'max_entries' is a two-digit number, there will be a delay upon pressing numbers that prefix a valid entry.\n\nThe 'focus_gain_poll' option allows for enabling an additional autocommand that watches for focus gains (refocusing Neovim window), and checks for changes in the unnamedplus ('+') register, adding to yankbank when new contents are found. This allows for automatically adding text copied from other sources (like a browser) to the yankbank without the bank opening trigger. Off by default, but I highly recommend enabling it with `focus_gain_poll = true`.\n\n### Persistence\nFor the best experience with YankBank, enabling persistence is highly recommended.\nIf persistence is enabled, sqlite.lua will be used to create a persistent store for recent yanks in the plugin root directory.\nTo utilize sqlite persistence, `\"kkharji/sqlite.lua\"` must be added as a dependency in your config, and `persist_type` must be set to `\"sqlite\"`:\n\n```lua\n-- lazy\nreturn {\n    \"ptdewey/yankbank-nvim\",\n    dependencies = \"kkharji/sqlite.lua\",\n    config = function()\n        require('yankbank').setup({\n            -- other options...\n            persist_type = \"sqlite\"\n        })\n    end,\n}\n```\n\nNote: The database can be cleared with the `:YankBankClearDB` command or by deleting the db file (found in the plugin install directory by default).\n\nIf you run into any SQL related issues, please file an issue on GitHub. (As a temporary fix, you can also try clearing the database)\n\n\nIf you run into permissions issues when creating the db file (i.e. when installing using Nix), use the `db_path` option to change the default file path. (`vim.fn.stdpath(\"data\")` should work)\n\n## Usage\n\nThe 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.\nAn entry from the menu can also be yanked into the unnamedplus register by hitting yy.\n\nI would personally also recommend setting a keybind to open the menu.\n```lua\n-- map to '\u003cleader\u003ey'\nvim.keymap.set(\"n\", \"\u003cleader\u003ey\", \"\u003ccmd\u003eYankBank\u003cCR\u003e\", { noremap = true })\n```\n\n### Snacks Picker\nIf `pickers.snacks` is set to true in the setup options, the snacks picker can be used to open the yankbank menu.\nThis can be triggered by running the command `:YankBankSnacks` or using `Snacks.picker.yankbank()` as you would any other snacks picker.\n\n---\n\n## API (WIP)\n\nSome plugin internals are also accessible via the YankBank api.\n\nExamples:\n```lua\n-- get the ith entry in the bank\n---@param i integer index to get\n-- output format: { yank_text = \"entry\", reg_type = \"v\" }\nlocal e = require(\"yankbank.api\").get_entry(i)\n\n-- add an entry to the bank\n---@param yank_text string yank text to add to YANKS table\n---@param reg_type string register type \"v\", \"V\", or \"^V\" (visual, v-line, v-block respectively)\nrequire(\"yankbank.api\").add_entry(\"yank_text\", \"reg_type\")\n\n-- remove an entry from the bank by index\n---@param i integer index to remove\nrequire(\"yankbank.api\").remove_entry(i)\n\n--- pin entry to yankbank so that it won't be removed when its position exceeds the max number of entries\n---@param i integer index to pin\nrequire(\"yankbank.api\").pin_entry(i)\n\n\n--- unpin bank entry\n---@param i integer index to unpin\nrequire(\"yankbank.api\").unpin_entry(i)\n```\n\nFor more details about the API see [lua/yankbank/api.lua](lua/yankbank/api.lua)\n\n---\n\n## Potential Improvements\n- nvim-cmp integration\n- fzf integration\n- telescope integration\n\n## Alternatives\n\n- [nvim-neoclip](https://github.com/AckslD/nvim-neoclip.lua)\n- [yanky.nvim](https://github.com/gbprod/yanky.nvim)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fptdewey%2Fyankbank-nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fptdewey%2Fyankbank-nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fptdewey%2Fyankbank-nvim/lists"}