I keep a sys.md file where I record a dated entry of every modification I make to my system (mostly installations of software, sometimes configuration changes) and based on an old Hacker News link about a did file I came up with the idea of an alias that would auto-insert the date and set me up with exactly the prompt I want for an entry to sys.md.
This command opens my sys.md file and inserts the date and the bottom:
nvim +'normal Go' +r!date' ~/notes/sys.md
I want to copy that line, paste it below, replace it with -'s as a markdown h2 heading, insert a new line and begin it with a dash-space -_ to start a bullet.
yypVr-o-_
However,
nvim +'normal Go' +'r!date' -c 'yypVr-o-_' ~/notes/sys.md
does not work. How can I auto-execute those commands?
vim +'$pu_|r!date' +'norm yypVr-o-_' foo.txt? I think you are missing your:normalcommand. See:h :norm– Peter Rincker Aug 22 '18 at 21:59nvim +'normal Go' +'r!date' +'yypVr-o-_' ~/notes/sys.mdBecause the BASH aliasing system didn't like your$pu_, but the+'norm <commands>'synax was what I was looking for anyway. Thank you! – mas Aug 23 '18 at 14:03:putwith the black hole register,"_, will create a blank line. Providing a range of$will mean we put a blank line at the end of the file. See:h :range,:h quote_, and:h :put– Peter Rincker Aug 23 '18 at 14:09