Apparent Vim 7.0 bug (re comments)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Apparent Vim 7.0 bug (re comments)

Robert Lee-7
I have a gvim 7.0 (win32 with +comments) that seems to be ignoring the
"set comments" line in my .vimrc file. I can submit the entire .vimrc
file if desired but the relevant line is:

set comments=s:/**,mb:*,ex:*/

What I get is this (vim default?):

/*
**
**
*/

and what I expect is this (phpdoc standard syntax):

/**
*
*
*/
 
This seems to indicate that vim was compiled without +comments but
according to :version (posted below), this directive was included. This
is an unmodified gvim binary as downloaded very recently from vim.org.

I doubt that this is a bug, but I don't see what else could be causing this.

Thanks for any help!

-Robert

:version
VIM - Vi IMproved 7.0 (2006 May 7, compiled Oct 10 2006 10:07:11)
Included patches: 1-122
Compiled by corinna@cathi
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info
+comments
+cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path
+folding -footer +fork() +gettext -hangul_input +iconv +insert_expand
+jumplist
 +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu
+mksession +modify_fname +mouse -mouseshape +mouse_dec -mouse_gpm
-mouse_jsbterm +mouse_netterm +mouse_xterm +multi_byte +multi_lang -mzscheme
-netbeans_intg -osfiletype +path_extra -perl +postscript +printer +profile
-python +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent
-sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static
-tag_any_white -tcl +terminfo +termresponse +textobjects +title -toolbar
+user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace
+wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2
Linking:
gcc   -L/usr/local/lib -o vim.exe       -lncurses  -liconv -lintl
Reply | Threaded
Open this post in threaded view
|

Re: Apparent Vim 7.0 bug (re comments)

A.J.Mechelynck
Robert Lee wrote:

> I have a gvim 7.0 (win32 with +comments) that seems to be ignoring the
> "set comments" line in my .vimrc file. I can submit the entire .vimrc
> file if desired but the relevant line is:
>
> set comments=s:/**,mb:*,ex:*/
>
> What I get is this (vim default?):
>
> /*
> **
> **
> */
>
> and what I expect is this (phpdoc standard syntax):
>
> /**
> *
> *
> */
>
> This seems to indicate that vim was compiled without +comments but
> according to :version (posted below), this directive was included. This
> is an unmodified gvim binary as downloaded very recently from vim.org.
>
> I doubt that this is a bug, but I don't see what else could be causing
> this.
>
> Thanks for any help!
>
> -Robert

I haven't delved very deep into the 'comments' options. In CSS files it is set
(by the ftplugin, I guess) to
        comments=s1:/*,mb:*,ex:*/

and I get

/*
  *
  *
  */

With your settings, I see
/**
*__
*__
*/

where the underscores represent spaces which are removed if I add no text; but
there must be some other relevant settings, because I see it if I do it after
":set ft=css" but not in a virgin [No Name] buffer, where Vim adds no comment
leader.

-- Are you sure you typed _both_ asterisks after the slash in the first
comment line?


Best regards,
Tony.
Reply | Threaded
Open this post in threaded view
|

Re: Apparent Vim 7.0 bug (re comments)

Robert Lee-7
A.J.Mechelynck wrote:

> Robert Lee wrote:
>> I have a gvim 7.0 (win32 with +comments) that seems to be ignoring
>> the "set comments" line in my .vimrc file. I can submit the entire
>> .vimrc file if desired but the relevant line is:
>>
>> set comments=s:/**,mb:*,ex:*/
>>
>> What I get is this (vim default?):
>>
>> /*
>> **
>> **
>> */
>>
>> and what I expect is this (phpdoc standard syntax):
>>
>> /**
>> *
>> *
>> */
>>
>> This seems to indicate that vim was compiled without +comments but
>> according to :version (posted below), this directive was included.
>> This is an unmodified gvim binary as downloaded very recently from
>> vim.org.
>>
>> I doubt that this is a bug, but I don't see what else could be
>> causing this.
>>
>> Thanks for any help!
>>
>> -Robert
>
> I haven't delved very deep into the 'comments' options. In CSS files
> it is set (by the ftplugin, I guess) to
>     comments=s1:/*,mb:*,ex:*/
>
> and I get
>
> /*
>  *
>  *
>  */
>
> With your settings, I see
> /**
> *__
> *__
> */
>
> where the underscores represent spaces which are removed if I add no
> text; but there must be some other relevant settings, because I see it
> if I do it after ":set ft=css" but not in a virgin [No Name] buffer,
> where Vim adds no comment leader.
>
> -- Are you sure you typed _both_ asterisks after the slash in the
> first comment line?
>
>
> Best regards,
> Tony.
>
Tony, thanks for your help.

I discovered that the problem was caused by the lines:

au BufWinLeave * mkview
au BufWinEnter * silent loadview

Apparently the view file that is created contains a copy of the vimrc
settings. This prevents changes to the vimrc to be honored once a file
has been opened. The temporary fix was to clean up the "vimfiles/view"
directory. I think the right fix is to move these files to the very top
of the vimrc file, but I am skeptical that this will help at all. I wish
mkview only saved folds/marks/cursor position information instead of a
full vimrc copy. I also discovered an unrelated error caused by these
lines, which is fixed by using:

au BufWinLeave *.* mkview
au BufWinEnter *.* silent loadview

...instead.

Hope some of this helps someone else with similar problems (e.g. vimrc
changes being ignored for existing files).

-Robert
Reply | Threaded
Open this post in threaded view
|

Re: Apparent Vim 7.0 bug (re comments)

Yegappan Lakshmanan
Hello,

On 1/10/07, Robert Lee <[hidden email]> wrote:

>
> I discovered that the problem was caused by the lines:
>
> au BufWinLeave * mkview
> au BufWinEnter * silent loadview
>
> Apparently the view file that is created contains a copy of the vimrc
> settings. This prevents changes to the vimrc to be honored once a file
> has been opened. The temporary fix was to clean up the "vimfiles/view"
> directory. I think the right fix is to move these files to the very top
> of the vimrc file, but I am skeptical that this will help at all.

>
> I wish mkview only saved folds/marks/cursor position information
> instead of a full vimrc copy.
>

You can change the 'viewoptions' option to control the type of information
that gets saved in the view file.

   :help 'viewoptions'
   :help 'sessionoptions'

- Yegappan