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

Configure Feed

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

docs: update README with discussion on lazy loading

ptdewey 3ec87bab 922115f5

+47
+47
README.md
··· 27 27 { 28 28 "ptdewey/yankbank-nvim", 29 29 dependencies = "kkharji/sqlite.lua", 30 + cmd = { "YankBank" }, 30 31 config = function() 31 32 require('yankbank').setup({ 32 33 persist_type = "sqlite", ··· 41 42 ```lua 42 43 { 43 44 "ptdewey/yankbank-nvim", 45 + cmd = { "YankBank" }, 44 46 config = function() 45 47 require('yankbank').setup() 46 48 end, 47 49 } 48 50 ``` 51 + 52 + #### Lazy loading 53 + 54 + Per [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 <1ms. 55 + 56 + ```lua 57 + -- plugins/yankbank.lua 58 + return { 59 + { 60 + "ptdewey/yankbank-nvim", 61 + lazy = false, 62 + config = function() 63 + -- ... 64 + end, 65 + }, 66 + { 67 + "kkharji/sqlite.lua", 68 + lazy = true, 69 + }, 70 + } 71 + ``` 72 + 73 + If 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. 74 + ```lua 75 + { 76 + "ptdewey/yankbank-nvim", 77 + dependencies = "kkharji/sqlite.lua", 78 + keys = { 79 + { "y" }, 80 + { "Y", "y$" }, -- redefine Y behavior to y$ to avoid breaking lazy 81 + { "D" }, 82 + { "d" }, 83 + { "x" }, 84 + { "<leader>p", desc = "Open YankBank" }, 85 + }, 86 + cmd = { "YankBank" }, 87 + event = { "FocusGained" }, 88 + config = function() 89 + require("yankbank").setup({ 90 + -- ... 91 + }) 92 + end 93 + } 94 + ``` 95 + 49 96 50 97 ### Setup Options 51 98