🪴 my neovim config:)
1
fork

Configure Feed

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

plugin: create jamjar

robin eb783024 5d98529b

+171 -46
-5
config/lua/ivy/plugins/init.lua
··· 168 168 }, 169 169 170 170 { 171 - "toggleterm.nvim", 172 - event = "UIEnter", 173 - }, 174 - 175 - { 176 171 "cloak.nvim", 177 172 event = "BufReadPre", 178 173 },
+171
config/plugin/jamjar.lua
··· 1 + if vim.g.loaded_jamjar then 2 + return 3 + end 4 + 5 + vim.g.loaded_jamjar = true 6 + 7 + ---@return vim.api.keyset.win_config 8 + local function get_winopts() 9 + local horiz = vim.opt.fillchars:get().horiz 10 + 11 + local height = math.ceil(vim.o.lines * 0.3) 12 + local offset = vim.o.cmdheight + 1 13 + 14 + return { 15 + relative = "editor", 16 + col = 0, 17 + row = vim.o.lines - height - offset - 1, 18 + height = height, 19 + width = vim.o.columns, 20 + style = "minimal", 21 + border = { horiz, horiz, horiz, "", "", "", "", "" }, 22 + } 23 + end 24 + 25 + ---@class jamjar.Terminal.proto 26 + ---@field cmd? string 27 + ---@field cwd? string 28 + ---@field winoptsfn? fun(): vim.api.keyset.win_config 29 + ---@field on_open? fun(self: jamjar.Terminal) 30 + 31 + ---@class jamjar.Terminal : jamjar.Terminal.proto 32 + ---@field cmd string 33 + ---@field buf integer 34 + ---@field win? integer 35 + local Terminal = {} 36 + Terminal.__index = Terminal 37 + 38 + local function get_defaultopts() 39 + return { 40 + cmd = vim.o.shell, 41 + on_open = function(self) 42 + vim.api.nvim_set_option_value( 43 + "winhighlight", 44 + "Normal:Normal,NormalNC:NormalNC,FloatBorder:WinSeparator", 45 + { win = self.win } 46 + ) 47 + end, 48 + } 49 + end 50 + 51 + ---@param opts? jamjar.Terminal.proto 52 + function Terminal:new(opts) 53 + return setmetatable(vim.tbl_extend("force", get_defaultopts(), opts or {}), self) 54 + end 55 + 56 + function Terminal:init() 57 + self.buf = vim.api.nvim_create_buf(true, true) 58 + vim.api.nvim_set_option_value("buftype", "nofile", { buf = self.buf }) 59 + 60 + vim._with({ buf = self.buf }, function() 61 + vim.fn.jobstart(self.cmd, { 62 + term = true, 63 + cwd = self.cwd, 64 + on_exit = function() 65 + self:delete() 66 + end, 67 + }) 68 + end) 69 + end 70 + 71 + function Terminal:toggle() 72 + if not self.win then 73 + self:open() 74 + return 75 + end 76 + 77 + local wcfg = vim.api.nvim_win_get_config(self.win) 78 + local hidden = wcfg.hide 79 + 80 + if hidden then 81 + self:open() 82 + else 83 + self:close() 84 + end 85 + end 86 + 87 + function Terminal:open() 88 + if not self.win then 89 + if not self.buf then 90 + self:init() 91 + end 92 + self.win = vim.api.nvim_open_win(self.buf, true, self.winoptsfn and self.winoptsfn() or get_winopts()) 93 + vim.api.nvim_set_option_value("signcolumn", "no", { win = self.win }) 94 + vim.api.nvim_set_option_value("foldcolumn", "0", { win = self.win }) 95 + self.on_open(self) 96 + else 97 + vim.api.nvim_win_set_config(self.win, { 98 + hide = false, 99 + }) 100 + vim.api.nvim_set_current_win(self.win) 101 + end 102 + end 103 + 104 + function Terminal:close() 105 + if self.win then 106 + vim.api.nvim_win_set_config(self.win, { 107 + hide = true, 108 + }) 109 + if vim.api.nvim_get_current_win() == self.win then 110 + vim.cmd.wincmd("p") 111 + end 112 + end 113 + end 114 + 115 + function Terminal:quit() 116 + if self.win then 117 + vim.api.nvim_win_close(self.win, true) 118 + self.win = nil 119 + end 120 + end 121 + 122 + function Terminal:delete() 123 + self:quit() 124 + 125 + if self.buf and vim.api.nvim_buf_is_valid(self.buf) then 126 + vim.bo[self.buf].buflisted = false 127 + vim.api.nvim_buf_delete(self.buf, { unload = true }) 128 + self.buf = nil 129 + end 130 + end 131 + 132 + local terminals = {} 133 + 134 + local function makemanaged(name, opts) 135 + return function() 136 + local term = terminals[name] 137 + if not term then 138 + term = Terminal:new(opts) 139 + vim.schedule(function() 140 + terminals[name] = term 141 + end) 142 + 143 + term:init() 144 + end 145 + term:toggle() 146 + end 147 + end 148 + 149 + vim.keymap.set("n", "<Plug>(jamjar-toggle-scratch)", makemanaged("scratch")) 150 + 151 + vim.keymap.set({ "n", "t" }, "<m-`>", [[<c-\><c-n><Plug>(jamjar-toggle-scratch)]]) 152 + vim.keymap.set( 153 + "n", 154 + "<leader>tg", 155 + makemanaged("lazygit", { 156 + cmd = "lazygit", 157 + winoptsfn = function() 158 + local height = math.ceil(vim.o.lines * 0.8) 159 + local width = math.ceil(vim.o.columns * 0.8) 160 + return { 161 + relative = "editor", 162 + row = (vim.o.lines - height) / 2, 163 + height = height, 164 + col = (vim.o.columns - width) / 2, 165 + width = width, 166 + style = "minimal", 167 + } 168 + end, 169 + on_open = function(_) end, 170 + }) 171 + )
-23
pkgs/ivy-plugins/_sources/generated.json
··· 849 849 }, 850 850 "version": "164083f87438c7c797ae3038b9bbe8afb13e930c" 851 851 }, 852 - "toggleterm": { 853 - "cargoLocks": null, 854 - "date": "2025-03-09", 855 - "extract": null, 856 - "name": "toggleterm", 857 - "passthru": { 858 - "as": "toggleterm" 859 - }, 860 - "pinned": false, 861 - "src": { 862 - "deepClone": false, 863 - "fetchSubmodules": false, 864 - "leaveDotGit": false, 865 - "name": null, 866 - "owner": "akinsho", 867 - "repo": "toggleterm.nvim", 868 - "rev": "9a88eae817ef395952e08650b3283726786fb5fb", 869 - "sha256": "sha256-fytbX+L12TK45YKFU9K+iFJcDrwboKabihc2LtX29J4=", 870 - "sparseCheckout": [], 871 - "type": "github" 872 - }, 873 - "version": "9a88eae817ef395952e08650b3283726786fb5fb" 874 - }, 875 852 "treewalker": { 876 853 "cargoLocks": null, 877 854 "date": "2025-12-09",
-13
pkgs/ivy-plugins/_sources/generated.nix
··· 489 489 as = "tether"; 490 490 date = "2025-11-16"; 491 491 }; 492 - toggleterm = { 493 - pname = "toggleterm"; 494 - version = "9a88eae817ef395952e08650b3283726786fb5fb"; 495 - src = fetchFromGitHub { 496 - owner = "akinsho"; 497 - repo = "toggleterm.nvim"; 498 - rev = "9a88eae817ef395952e08650b3283726786fb5fb"; 499 - fetchSubmodules = false; 500 - sha256 = "sha256-fytbX+L12TK45YKFU9K+iFJcDrwboKabihc2LtX29J4="; 501 - }; 502 - as = "toggleterm"; 503 - date = "2025-03-09"; 504 - }; 505 492 treewalker = { 506 493 pname = "treewalker"; 507 494 version = "c1028cb50ba61ac21c712fa1a8b7a121cf256512";
-5
pkgs/ivy-plugins/nvfetcher.toml
··· 187 187 src.git = "https://github.com/comfysage/tether.nvim" 188 188 passthru.as = "tether" 189 189 190 - [toggleterm] 191 - fetch.github = "akinsho/toggleterm.nvim" 192 - src.git = "https://github.com/akinsho/toggleterm.nvim" 193 - passthru.as = "toggleterm" 194 - 195 190 [treewalker] 196 191 fetch.github = "aaronik/treewalker.nvim" 197 192 src.git = "https://github.com/aaronik/treewalker.nvim"