Wednesday, February 24, 2010

Re: Open a new file if the file doesn't exist when using ctrl+W_ctrl+F?

On Feb 21, 10:07 pm, "Benjamin R. Haskell" <v...@benizi.com> wrote:
> On Sun, 21 Feb 2010, Peng  Yu wrote:
> > If I type ctrl+W_ctrl+F over a string and there is not a file whose
> > name is the string, vim will show "E447: Can't file file '<the
> > string>' in path". However, sometimes I do want to open a new file
> > with the string with some short cut. Is there a way to do so?
>
> Interesting.  I should have figured there was a shortcut for this.  
> Earlier tonight I came up with this snippet to do just that:
>
> :map <C-O> :exe "new ".expand("<cfile>")<CR>
>
> to open the file name under the cursor on pressing ctrl+shift+o.  It
> works regardless of whether that file exists.


When the cursor is on <file>.xyz, I actually want to open <file>.abc.
Would you please show me how to do it?

More generally, give a 1-1 mapping form a suffix set (S1) to another
suffix set (S2), when the cursor is on any file name that has a suffix
in S1, I want to open the file with the suffix replaced by the
corresponding one in S2. Would you please show me how to do it?

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: