I often want to open a note file or log file, go to the last line, add a blank line, then begin entering some text.
It is handy to do all of this from the command line using an alias to call gvim with the
-c command option.
alias note="gvim -c $ +foldopen +put_ +startinsert ~/path-to-file/notes.md"
This opens the notes.md Markdown file, goes to the last line (
$), opens any folds, appends a blank line (
put_), then starts insert mode.
: is assumed with
-c) inserts the contents of register
_ linewise, after the current line. The black hole register (
_) contains nothing so the
put appends an empty new line.
Thanks for the cleanup! If anyone knows how, I'd like to also add a Markdown header, as in ## at the beginning of that newline? Thanks. Rick