I'm making a program for taking statistics during sports, where I script the games. I'm would like to make a VIM shortcut/remap, so every time I press that it does exactly what the ENTER-key normally does, but that it simply inserts a timestamp as well (and it should only be done in Insert-mode).
My thinking was, that I then could go into my VIMRC-file and activate the shortcut, whenever I was doing statistics.
Here's what I've tried:
iabbrev <CR> <CR>:put =strftime('%H%M%S')^
The '^' in the end is there in the end, because when you insert the timestamp with :put =strftime('....'), that the cursor then is a the beginning of the newly inserted timestamp. But nothing happens with this in my VIMRC-file.
I've also tried:
iabbrev <ENTER> <ENTER>:put =strftime('%H%M%S')<CR>
And still, nothing happens.
I've even tried this, to try and see, if I could just make VIM insert any character, whenever I hit ENTER, but this doesn't do anything either:
iabbrev <CR> <CR>1
I apologies, if this is a stupid question.
EXAMPLE OF USE:
Let's say that I was typing this on the keyboard:
upthrtwo ussevfiv tptwothr uhsevtwo
Then I wanted VIM to have written this:
151852upthrtwo 151907ussevfiv 151917tptwothr 151949uhsevtwo
Thanks for your time and assistance.