On 2009-08-14, Gary Johnson wrote:
> On 2009-08-14, Hari Krishna Dara wrote:
> > I have now published this as a new plugin at vim.org called "Notes":
> > 
> > http://www.vim.org/scripts/script.php?script_id=2732
> > 
> > I would appreciate any feedback. Here is the description from the script 
> > page:

I found another error.  I started vim as

    vim -c Note

and got the following error messages:

    Error detected while processing function notes#OpenNote:
    line   10:
    E172: Only one file name allowed: sp /home/garyjohn/Notes/New Note.txt

This is a consequence of:

    a)  Using a file name with an embedded space (ick).
    b)  Not properly quoting such a file name.

If users want to put spaces in their file names, that's fine, but I
don't think an application should do so by default.

To fix a), change this section of plugin/notes.vim as shown:

   127  if !exists('g:notesDefaultName')
   128    let g:notesDefaultName = 'New_Note' " Without extension.
   129  endif

A workaround is for the user to set  g:notesDefaultName
appropriately.

To fix b), change this section of autoload/notes.vim as shown:

    16    catch
    17      exec 'sp "'.notePath.'"'
    18    endtry

There are probably other instances of that error, but I didn't
search for them.

Having fixed those problems, I started vim again as

    vim -c Note

wrote "This is a test." in the upper window, and executed
":NoteAsNew".  The result was this error message:

    Error writing to file: /home/garyjohn/Notes/This is a test.txt
    Vim(write):E172: Only one file name allowed: w! /home/garyjohn/Notes/This 
is a test.txt

This is another instance of the problem discussed above.
Personally, I think you should replace spaces with underscores when
you construct a file name from the first line of the buffer.  At
least provide that as a configurable option.

Tried something else to get rid of second window:

    vim -c Note -c only

Then, with nothing in the buffer,

    :NoteAsNew

with the result:

    Error writing to file: /home/garyjohn/Notes/NewNote 4.txt
    Vim(write):E172: Only one file name allowed: w! 
/home/garyjohn/Notes/NewNote 4.txt

which is again a result of constructing a file name with an embedded
space and not quoting it properly, and again the same solutions
apply.

I guess there's no reason to start vim with "-c Note" if all you're
going to do is write a note, since all the action occurs when you go
to save it.  Just "vim" works as well.  Is that right?

Regards,
Gary



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

Raspunde prin e-mail lui