| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Consider this made-up (shortened from a real world case) example for paren matching: response.write("funct1(x,funct2(){") response.write("})") Number the paren: 1 2 34 5 response.write("funct1(x,funct2(){") response.write("})") 6 7 8 (which will probably not be aligned properly after posting, but you get the idea.) Now when I place the cursor over paren 7 in Vim, it indicates, incorrectly, that paren 6 matches it. In Emacs, it correctly identifies paren 2. Not meaning to start a holy war, but am I doing something wrong in Vim? |
|
#2
| |||
| |||
| On 2008-08-26 00:02, Charles M wrote: > Now when I place the cursor over paren 7 in Vim, it indicates, incorrectly, that > paren 6 matches it. In Emacs, it correctly identifies paren 2. Just out of interest, how is matching a closing parenthesis from one string to an opening parenthesis in another string correct? In your example it would be, obviously, but unless the strings are parsed for syntax, how could an editor know if their contents are significant? For example, how does Emacs match the parens in this case? response.write("funct1(x,funct2(){"); log.write("I feel sad :-("); response.write("})"); or response.write("funct1(x,funct2(){"); log.write("I feel sad :-({"); response.write("})"); On the other hand, I'm always amazed at what cleverly designed editors can do, and Emacs's behavior here is certainly worse than Vim's. FWIW, if you use the % key on paren 7 in your example, the cursor doesn't jump anywhere, which is what I would expect. But you're right, the highlighting is off. Stefan PS: I have "let loaded_matchparen = 1" in my .vimrc, because paren matching confused me more than it helped, and I don't write much LISP :-) |
|
#3
| |||
| |||
| On 2008-08-26 01:00, Stefan Weiss wrote: > and Emacs's behavior here is certainly worse than Vim's. I'm very sorry, that should have read "Emacs's behaviour is certainly *better* than Vim's". I honestly don't want to start or participate in any flame wars either... I didn't use Emacs much in the past 8 years, but in this case it looks like Emacs did a better job (even though I don't understand how). I would also be interested in more opinions on this topic. stefan |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.