home
vim-time.md

Blog Time

2022-08-28 2

When I started writing the blog I added a command to my vimrc to insert the date. I had it with the time as well but I was bothered about how it was displaying the time. I could strip it out when displaying it on the web but I didn’t want to see the times I was writing at. That would tell a story, mostly that I was doing it during work hours or at stupid’o clock.

However now that I’m writing more randomly and allowing the devlog to just be a dumping ground, I’m getting weird sort orders when I build the index page. It is rebuilt each time rather than being appended to. I tried to use the linux modified time but then I would lose the order if I ever went back to correct a typo.

I’ve caved now to add unix time to my insert command so that way I can order against that when I have multiple posts on the same day.

This was my original insert.

" Shortcut to print out the date
nnoremap asd :pu! =strftime('%Y-%m-%d')<cr>A<space>

My new, more invasive insert.

" Shortcut to print out the date
nnoremap asd :pu! =strftime('%Y-%m-%d %s')<cr>A<space>

I then removed it when building the template but use it when building the index page.

At least I can’t read unix time so I don’t see what time I wrote things. Though it is easy enough to convert. Bah. It feels like I’m judging myself.

Tangent: I might switch my filesystem to something else to get create times. XFS doesn’t have it and it seems many linuxes don’t have create time. There must be some thing about it that makes it trickier than I’m getting as to me a create time would be both useful and a default when designing a file system.

Bah! I’m an idiot. Instead of a unix timestamp. I’ll just add a sequence number to it manually. That’s perfectly fine and I much prefer that.

My much better insert.

" Shortcut to print out the date
nnoremap asd :pu! =strftime('%Y-%m-%d 1')<cr>A<space>