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

This is especially powerful when trying to move small chunks of code around. Say you have something like

document.getElementById('asweetid')

and you want to grab just the id for use elsewhere. In command mode pressing f' will move your cursor to the quote, yf' will put 'asweetid' into your yank register and a p anywhere else will paste it. I also make heavy use of ctx where x is a character on a line that I want to replace up to. The best part about vim, I think, is how I think about the commands in my head and they just kind of flow out of my fingers.

"Hmm I want to change (press c) to (press t) that closing paren (press shift 0)."

Even just typing that my left hand instinctively moved toward the caps lock to go to command mode.



Yeah, I use 'dt,' or 'dt)' all the time to move single arguments of functions around, and 'd%' to move the function calls themselves.


yi' will also work in this example.




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

Search: