Daniel Wu
Daniel Wu

Reputation: 6003

Make % working on "begin" or "end" in a SQL block

In TSQL, we are using BEGIN END to embrace a block instead of {}. We can use % to go the beginning or ending of a block if using {}, but I want to go the beginning or ending of a block even if using BEGIN, END, how could that be done?

Upvotes: 4

Views: 260

Answers (1)

mhinz
mhinz

Reputation: 3361

That's what the shipped matchit plugin is for! :)

:set filetype=sql
:runtime macros/matchit.vim

Afterwards I could use % on begin/end, too.

See :help sql-matchit and :echo b:match_words (after you set the filetype to sql) to get a list of all word pairs % is working on.

Thus, assuming b:match_words woudn't include begin/end by default, you would add a new pair like this:

:let b:match_words .= ',\<begin\>:\<end\>'

Upvotes: 7

Related Questions