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

It's interesting that it's hard to explain, because the fingers will play the chord by themselves and I need to stop and think to know what I am actually typing.

C-x r k to cut a rectangle, and C-x r t to add one filled with, for example, the comment symbol:

(C-space)this

to comment

C-x r t #

#this

#to comment



I find cua-mode's rectangle support superior. http://trey-jackson.blogspot.com/2008/10/emacs-tip-26-cua-mo...


Holy crap, thank you very much! Looks like cua-mode rectangle select might actually be the equal of Visual Studio's very straightforward rectangle selections...


You can also use the M-x comment-region and M-x uncomment region to comment stuff. If you use it a lot, just bind them to a convenient key stroke.


Don't forget M-; is comment-dwim which usually does... what you mean (uncomments the region if it looks commented, comments it otherwise)


This was my contribution to the SO thread! Super handy feature. I also use the - highlight block - then 'C shift -' to undo in region


and/or M-x comment-box




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: