clone of my dotfiles.ssp.sh
1
fork

Configure Feed

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

adding reading and wordcount for neomd

sspaeti 33a05394 0e3d56f4

+36 -2
+14 -1
nvim/.config/nvim/lua/sspaeti/custom.lua
··· 54 54 vim.cmd("startinsert") 55 55 end 56 56 57 - -- Only map <leader>a when editing a neomd compose buffer (neomd-*.md) 57 + -- Only activate neomd writing mode when editing a neomd compose buffer (neomd-*.md) 58 58 vim.api.nvim_create_autocmd("BufEnter", { 59 59 pattern = "neomd-*.md", 60 60 callback = function() 61 + -- Attach file via yazi 61 62 vim.keymap.set("n", "<leader>a", neomd_attach, { 62 63 buffer = true, 63 64 desc = "neomd: attach file via yazi", 64 65 }) 66 + 67 + -- Writing-optimized settings (from nvim-wp/set_wp.lua) 68 + vim.wo.spell = true 69 + vim.bo.spelllang = "en_us,de" 70 + vim.wo.wrap = true 71 + vim.wo.linebreak = true 72 + vim.wo.breakindent = true 73 + vim.wo.breakindentopt = "shift:1" 74 + vim.wo.showbreak = "↪ " 75 + vim.wo.conceallevel = 2 76 + vim.wo.relativenumber = false 77 + -- Word count + reading time is handled by lualine (see plugins/lualine.lua) 65 78 end, 66 79 }) 67 80 -- ── end neomd ──────────────────────────────────────────────────────────────
+22 -1
nvim/.config/nvim/lua/sspaeti/plugins/lualine.lua
··· 77 77 --word per minute 78 78 local wpm = require("wpm") 79 79 80 + -- neomd compose: word count + reading time (only for neomd-*.md buffers) 81 + local function is_neomd() 82 + return vim.fn.expand("%:t"):match("^neomd%-.*%.md$") ~= nil 83 + end 84 + local neomd_words = { 85 + function() 86 + return vim.fn.wordcount().words .. " words" 87 + end, 88 + cond = is_neomd, 89 + color = { fg = "#7aa2f7" }, 90 + } 91 + local neomd_reading = { 92 + function() 93 + local words = vim.fn.wordcount().words 94 + local mins = math.max(math.floor(words / 200), 1) 95 + return "~" .. mins .. " min read" 96 + end, 97 + cond = is_neomd, 98 + color = { fg = "#9ece6a" }, 99 + } 100 + 80 101 -- macro recording indicator 81 102 local recording = { 82 103 function() ··· 103 124 lualine_a = { "mode", recording }, 104 125 lualine_b = {}, 105 126 lualine_c = { branch, active_lsp, filename }, 106 - lualine_x = { wpm.historic_graph, diff, diagnostics, { get_venv, color = { gui = "bold" } }, filetype }, 127 + lualine_x = { neomd_words, neomd_reading, wpm.historic_graph, diff, diagnostics, { get_venv, color = { gui = "bold" } }, filetype }, 107 128 lualine_y = {}, 108 129 lualine_z = { progress, location }, 109 130 },