🪴 my neovim config:)
1
fork

Configure Feed

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

plugin: insertsection keymap

robin 2064e812 fe0c9317

+19
+2
config/lua/ivy/config/keybinds.lua
··· 180 180 vim.keymap.set("n", [[\r]], "<Cmd>setlocal relativenumber! relativenumber?<CR>", { desc = "toggle 'relativenumber'" }) 181 181 vim.keymap.set("n", [[\s]], "<Cmd>setlocal spell! spell?<CR>", { desc = "toggle 'spell'" }) 182 182 vim.keymap.set("n", [[\w]], "<Cmd>setlocal wrap! wrap?<CR>", { desc = "toggle 'wrap'" }) 183 + 184 + vim.keymap.set("n", "<leader>is", "<Plug>(ivy-insert-section)")
+17
config/plugin/keymap.insertsection.lua
··· 1 + -- https://github.com/echasnovski/nvim/blob/0a87022921d2e2a95fb987c4f11fc4804b57d6f9/plugin/21_functions.lua#L23 2 + 3 + vim.keymap.set("n", "<Plug>(ivy-insert-section)", function() 4 + local symbol = "=" 5 + local total_width = vim.o.textwidth > 0 and vim.o.textwidth or 79 6 + 7 + -- Insert template: 'commentstring' but with '%s' replaced by section symbols 8 + local comment_string = vim.bo.commentstring 9 + local content = string.rep(symbol, total_width - (comment_string:len() - 2)) 10 + local section_template = comment_string:format(content) 11 + vim.fn.append(vim.fn.line("."), section_template) 12 + 13 + -- Enable Replace mode in appropriate place 14 + local inner_start = comment_string:find("%%s") 15 + vim.fn.cursor(vim.fn.line(".") + 1, inner_start) 16 + vim.cmd([[startreplace]]) 17 + end)