Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One thing i miss in languages like python that don't enclose blocks in {} is the convenience of using % to find the matching beginning/end of the block.


I use "vii" in normal mode to do that. It basically selects the block.

http://vim.wikia.com/wiki/Indent_text_object


That, and the lack of constant constants (class workarounds don't do it for me) are the only two "complaints" for me.

On the whole I really like significant white space (despite my suspicions before taking up the language). With a brace-blocked language like C, indentation can fool you into thinking there's a block when there really isn't.

This is very unlikely to happen in Python. A section of code that looks like a block due to indentation is virtually certain to be a single coherent block. I love that.


I haven't tried it in Python, but it's worth checking out matchit.

http://www.vim.org/scripts/script.php?script_id=39

matchit generally seems to do a good job at identifying beginning/end pairs in a variety of languages.


In my years of experience, I've found that huge ass blocks of code where % is useful in finding the beginning/end of a block are usually in need of massive amounts of refactoring.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: