-
Notifications
You must be signed in to change notification settings - Fork 631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Add mapping and command to insert current date #1413
Comments
I'm not sure if this feature is directly related to Vimwiki, but you could try an abbreviation: inoreabbrev cdate <C-r>=strftime("%F")<CR> |
Hi, thank you @qadzek for sharing your snippet. It is pretty nice and usefull. One should never have to enter today's date by hand on a computer. I agree to add it to Vimwiki. But it may take time to accepted a default keymap, accept it and merge. So I would advice users to have their own map or abbrv like @qadzek in their vimrc (PS: I just did it myself lol, it is such a nice abbrv). |
@tinmarino Happy to make your In this case, I feel like an abbreviation makes more sense than a mapping, as you are probably in insert mode when wanting to add a date. That's a personal choice of course. Let me share this one as well, if you want to add a timestamp like inoreabbrev <expr> ctime strftime("%T") The To avoid inserting a trailing space after expanding the abbreviation, I use this " See :helpgrep Eatchar
function! Eatchar(pat)
let l:c = nr2char(getchar(0))
return (l:c =~ a:pat) ? '' : l:c
endfunc
inoreabbrev cdate <C-r>=strftime("%F")<CR><C-r>=Eatchar('\s')<CR> |
I often need to insert the current date, to create a log of events on wiki pages other than the diary. For this, I thin it'd be great if we had a shortcut to avoid typing the same date all over again, if one has many projects running in parallel.
The text was updated successfully, but these errors were encountered: