On 1/3/20 8:17 AM, Bram Moolenaar wrote:
Ken Takata wrote:

2020/1/3 Fri 19:02:13 UTC+9 Bram Moolenaar wrote:

Yasuhiro Matsumoto wrote:

Why you don't use { ?
I know this will trigger a discussion.  Nearly all languages use blocks
ending with "}".  It's much easier to see where a block ends that way
than using "endif", "endwhile", etc., it stands out.

Since we already have the start of the block without extra punctuation,
there is no need to add a "{" there.  It would be pointless to add it.

Text objects like "a{" or "i{" don't work well without the starting "{".
That never worked for "for" / "endfor", right?

Also "%" may not work well.
With some adjustments to b:match_words it works.

b:match_words sequences between if/else/endif and function/return/endfunction tuples not just if/endif function/endfunction pairs.  Adjusting b:match_words to handle '}' ends breaks this.  There is no way to handle this with b:match_words (do you know of one?)

Consider:

function A() | if x | return | endif | endfunction

vs:

function A() | if x | return | } | }

One of the nicer things about vimscript (with respect to %) is 'return' can only match with 'endfunction', 'break' with 'endwhile'/'endfor', 'else' with 'endif', etc.


And when "%" works you can select a block from "if"/"while"/"for" until
the matching "}" with "v%".


--
--
You received this message from the "vim_dev" 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

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20e57d56-2572-3d54-2c58-584b09c36270%40gmail.com.

Raspunde prin e-mail lui