The code I have so far is this:
command! -nargs=1 Nf call s:NewFile(<q-args>)<CR>
function! s:NewFile(fp)
:echom a:fp
:e %:h/a:fp
endfunction
The argument is passed in normally (I know because of the echom
statement).
When I run a command such as: :Nf test.py
, it echoes test.py
as it should, but when creating the file itself, it interprets a:fp
as the filename.
How can I get it to interpret test.py
as the filename (or more complex filenames like ../foo/bar/test.py
)?