3 ms·
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 g
by latortuga 17y ago
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.
- nostrademons 17y agoYeah, I use 'dt,' or 'dt)' all the time to move single arguments of functions around, and 'd%' to move the function calls themselves.
- puffythefish 17y agoyi' will also work in this example.