On nie gru 3 2006, vim@vim.org wrote:
> Hi,
> It you should give one (or more) tips to a person who was going to
> start creating scripts for vim, then what would it be?
> (besides "know your :help" :-) )
>
> ideas could be:
> Do's and dont's

Keep ff=unix . In other case your scripts won't be working under non
windows systems.

Always supply modeline to make sure basic editing things will be working
for others.

When changing options use setlocal not set - be polite to user
environment.

Try to cut on g:variables (see above).

Try to maintain documentation, not only for use of script but also for
messing with it.

> best util script

Each script covers only part of Vim functionality. It is hard to say
which one is best for learning.

> often used functions

It depends on what are you want to achieve.

> ways of optimization

Avoid \| in complex regexps, often two, separate substite() are
faster than one substite() with \|.

Avoid * whenever possible, try to use \+ if appropriate.

\x class is faster than [collection]

When doing complex substitutions it is often faster to check if some
part of pattern already exists and only if this is true execute
substitution.

m.
-- 
I am social scientist - I don't know the difference between good and
bad, only the difference between difference.

Reply via email to