On Tue, 9 May 2006, Peter Slizik wrote:

or change these lines

   if a:mode[1] == "T"
   ...
   elseif a:mode[1] == "t"

to

   if a:mode[1] ==# "T"
   ...
   elseif a:mode[1] ==# "t"

Well, yes, after this correction, the script has became my good friend ;-)

What I like most is it's ability to recognize (), [], {}, and /* */.

To make it perfect, I would suggest it should behave reasonably if the user
changes his mind (or makes a mistake) and only hits enter or esc when he is
expected to enter the opening tag.

Something like

if opentag == ""

This has already been taken care of in the script, at the very top. It
handles the situation where Enter and Esc is typed for an empty prompt
input, whereby it does nothing.

However, I'll take whitespace as a valid tag ;)

or maybe

if opentag ==~ "[\s\r\e]*"

This is handled already, except for "\s*" that I disagree. See above.

should do. (I didn't test the regexp, it's only my first idea. Maybe \r's and
\e's are handled differently.)

When this works OK, I think the script should be entered into Vim's script
database.

Oh I don't know :) There are already many scripts like this available.
TagWrap needs to be polished up and commented if it were to be released.
Some day, but not now.

Well, this makes me wonder how many scripts I've written/posted with the
assumption that 'ignorecase' is not set :)

Do most of you script writers keep this in mind?

Well, in my opinion, Vim should take care about this and run the scripts
downloaded from the Internet (typically scripts in the plugin directory) in
some kind of 'standardized' environment. It would alleviate the plugin
writers from taking care about cpoptions and like. If the plugin writer
changes an option, the change should be local to the script. It's just what I
think would be best, I have in fact no idea how easy/difficult this would be
to implement.

In the case of the 'ignorecase' option, it really is very subjective.
For example,

  if variable =~ "regex"

Sometimes, plugins are written to take into account whether the user
wishes to have the case ignored, by respecting the user's 'ignorecase'
option setting.

Sometimes, it just has to be enforced:

  if variable =~# "regex"

when the case match is vital to the plugin's proper operation. TagWrap
is one such example.

--
Gerald

Reply via email to