From 98d48f72d6a50a5a876dafbf8f26d2ad957857b3 Mon Sep 17 00:00:00 2001 From: t0xa Date: Wed, 22 Oct 2025 08:49:56 +0300 Subject: [PATCH] FTP: Add markdown insert date function --- ftplugin/markdown.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ftplugin/markdown.lua b/ftplugin/markdown.lua index 868f479..9b3432b 100644 --- a/ftplugin/markdown.lua +++ b/ftplugin/markdown.lua @@ -7,6 +7,13 @@ local conf = require("telescope.config").values local actions = require("telescope.actions") local action_state = require("telescope.actions.state") +local function formatted_date() + local current_date = os.date("%Y-%m-%d") + if type(current_date) == "string" then + vim.api.nvim_put({current_date}, 'c', true, true) + end +end + local function markdown_headings() local bufnr = vim.api.nvim_get_current_buf() local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) @@ -48,3 +55,4 @@ local function markdown_headings() end keymap.set("n", "fdh", markdown_headings, { desc = "Grep: Markdown headings" }) +keymap.set("n", "icd", formatted_date, { desc = "Insert current date" })