RAGUMAGU


Notepad and timestamps

I learnt that Notepad has this cool feature where you can press F5 to insert a timestamp at the current cursor position.

I added the same functionality to my Neovim setup using:


vim.keymap.set("n", "<F5>",":put =strftime('%Y-%m-%d %H:%M')<CR>j")

            

This mapping inserts a timestamp on the next line (instead of current cursor position), and puts the cursor on the line after (if it exists).

This is really useful when you want to make a log / journal entry.

I find this feature exciting because it is such a simple and useful shortcut. Notepad is barebones and doesn't provide many text editing options, and features like this are quite thoughtful.

Shrinidhi Raghunandan

Published: 26 February, 2024.