@david@collantes.us While you’re typing? I guess this could be used as a starting point (doesn’t work on the very first line):
inoremap <CR> <Esc>:r!date +"\%F \%T"<CR>A
What’s the end goal here? 😅
@david@collantes.us While you’re typing? I guess this could be used as a starting point (doesn’t work on the very first line):
inoremap <CR> <Esc>:r!date +"\%F \%T"<CR>A
What’s the end goal here? 😅
@movq@www.uninformativ.de wow, that almost works as I want it! Only think missing is the first time stamp, on opening. Hmm…
This works! Any way to streamline it further?
autocmd BufNewFile * call s:InsertTimestamp()
inoremap <CR> <Esc>:r!date +"\%F \%T"<CR>A
function! s:InsertTimestamp()
call setline(1, strftime('%Y-%m-%d %H:%M:%S '))
normal! G$
endfunction
@david@collantes.us Ah, I just went to bed, great to see you figured it out. 😅 I probably would have ended up with something similar (but I’m not a Vimscript guru). 🤔