Friday, October 26, 2012

Re: 'pattern' from file

Bee wrote:
>
> I thought of creating wordlists in files for, such as, changing case of application specific keywords.

Been there, done that.

The :s approach doesn't cope well with comments and quoted strings. Particularly, the SQL keywords "and" and "or" are common.

Using vim's abbreviations can work well, f.ex.

:abbr select SELECT

On several projects where the coding standards called for reserved words in upper case, I've used an awk script that knew about comments and quoted strings, processing character by character with a simple state machine. As an exercise I translated it to VimL but it was slower than piping to awk, if I recall correctly.

(I hate such misrules. I've campaigned against them, to no avail, then used my script to find my code the only stuff to comply 100%. The stupid rule was too hard for its backers to keep.)

I'm sure there's vim plugins for this sort of thing.

Regards, John

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: