In my ~/.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?
How can I start vim and then execute a particular command that includes a \, from the command line?
command line;key bindings;invocation;startup
You could make a function that creates the new entry, and then use the function as part of your mapping:nnoremap <leader>t :call NewEntry()<cr>function! NewEntry()  let title = expand('~/Notes/') . strftime('%F') . '-' . input(Title: )  execute 'edit ' . titleendfunctionThe mapping may be called as described by @Carpetsmoker:vim -c 'execute normal \\t'