Natural language dates for Neovim. Parse date strings like "next Friday", "tomorrow", or "2 weeks ago" into formatted dates.
- Parse natural language dates using chrono-node
- Format dates with moment.js
- Visual mode integration - select text and transform in place
Neovim>= 0.9.0Node.js>= 18npm
Run :checkhealth provider in Neovim to verify your Node provider is working.
return {
"obsidian-nvim/nldates.nvim",
build = function()
if not vim.g.node_host_prog then
vim.g.node_host_prog = vim.fn.exepath("neovim-node-host")
end
vim.fn.jobstart("cd rplugin/node/nldates; npm install")
vim.cmd("UpdateRemotePlugins")
end,
}cd ~/.local/share/nvim/lazy/nldates.nvim/rplugin/node/nldates
npm installRestart Neovim after installation.
- Install Node.js >= 18
- Install the neovim npm package:
npm install -g neovim - Run
:checkhealth providerin Neovim to verify
Select a date string in visual mode and run:
:'<,'>lua require("nldates").replace_selection()vim.keymap.set("v", "<leader>nd", function()
require("nldates").replace_selection()
end)Select next friday and press gd → becomes 2025-02-21
See https://momentjs.com/docs/#/displaying/format/ for full reference.
vim.keymap.set("v", "<leader>nd", function()
require("nldates").replace_selection({ format = "[[][[]YYYY-MM-DD[]][]]" })
end)Select next friday and press gd → becomes 2025-02-21
Parses the visual selection as a natural language date and replaces it.
Options:
format(string): Output format. Default:"YYYY-MM-DD"
- Relative: "tomorrow", "next week", "2 days ago"
- Specific: "January 15th", "2025-01-15"
- Day names: "next friday", "last monday"
- Time: "at 3pm", "tomorrow morning"