Reputation: 141440
I have often PATHs for files which do not exist in my codes.
I run as my cursor is at a PATH which does not exist
CTRL-W f
I get
E447: Can't find file "~/bin/editors/emacs/python_mode" in path
The long way of creating new file is
Ctrl-W v
:args [copy_paste_the_path_with_mouse]
Do you know any short way of creating a new file in Vim when you have PATHs for files in a file which do not exists yet?
I would like to create a new file simply by
CTRL-W f
Upvotes: 1
Views: 2384
Reputation: 24084
To avoid having to copy-paste with the mouse you can do :edit ^R^P
to copy the path/filename at the cursor position into the command line. For more info do :help ^R^P
Upvotes: 0
Reputation: 73006
If you do :h E447
to look up the error message you received, you will see this:
...
If you do want to edit a new file, use:
:e <cfile>
To make gf always work like that:
:map gf :e <cfile><CR>
So try this:
:nmap <C-w>f :e <cfile><CR>
Upvotes: 3
Reputation: 2210
:e path_to_file
:w!
I don't think there's a built in key combination for reading in the clipboard for the new file.
You should be able to use key maps for this or a custom script.
See this question and vim.org for more info.
Hope that helps
Upvotes: 1