I have a ~/.vimrc
that contains just this:
function! NewFile()
let filename = input("Filename:")
endfunction
command NewFile :call NewFile()<cr>
(of course my real .vimrc
is more complex, but I've recreated this small test case with no plugins etc.)
My intent is to write a function that supports creating a new file according to a template. Some input items will be asked from the vi user, such as the name of the file.
The function isn't that sophisticated yet (understatement!) - all it does is ask for the filename. When I use the command NewFile
from the vi command line, it starts, but then once I enter the filename and hit Enter, I get the error:
E488: Trailing characters
Why is that? What am I doing wrong?