~/.vimrc, I have a command defined approximately like this:
nnoremap <expr> <Leader>n ':new ~/Notes/' . strftime('%F') . '-'
It is designed for creating notes files that contain the current date in the filename. The keybinding is designed to leave my cursor on the command line so that I can type the topic of the note and hit Return.
This works from within vim fine. However, I am also trying to specify a terminal command that I can use to open vim and then fire this command. I've tried:
vim -c '\n'
(my Leader is set to the default of
\, which I would prefer not to change)
However, this doesn't work - instead I just get Error detected while processing command line: E10: \ should be followed by /, ? or &. I'm not sure if this is a bug in vim or if I'm doing something wrong. I also tried:
vim -c '<Leader>n'
But this gives: Error detected while processing command line: E488: Trailing characters: n Press ENTER or type command to continue.
Is there a way to achieve what I want?