FTP: Add markdown insert date function
This commit is contained in:
parent
9a54ecf048
commit
98d48f72d6
1 changed files with 8 additions and 0 deletions
|
|
@ -7,6 +7,13 @@ local conf = require("telescope.config").values
|
||||||
local actions = require("telescope.actions")
|
local actions = require("telescope.actions")
|
||||||
local action_state = require("telescope.actions.state")
|
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 function markdown_headings()
|
||||||
local bufnr = vim.api.nvim_get_current_buf()
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||||
|
|
@ -48,3 +55,4 @@ local function markdown_headings()
|
||||||
end
|
end
|
||||||
|
|
||||||
keymap.set("n", "<leader>fdh", markdown_headings, { desc = "Grep: Markdown headings" })
|
keymap.set("n", "<leader>fdh", markdown_headings, { desc = "Grep: Markdown headings" })
|
||||||
|
keymap.set("n", "<leader>icd", formatted_date, { desc = "Insert current date" })
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue