4 ms·
Vim's keymap has a wide variety of 'text objects'. Reiterating point 3 from the article: e.g. if the cursor is at | in: printf("Hello |World\n"); With vim,
by rgoulter 5y ago
Vim's keymap has a wide variety of 'text objects'.
Reiterating point 3 from the article: e.g. if the cursor is at | in:
printf("Hello |World\n");
With vim, you could manipulate the text in different ways by using different motions, e.g.:
`db` would give `printf("World\n");` (b for backwards),
`de` would give `printf("Hello \n");` (e for end-of-word),
`di"` would give `printf("");` (inside `"`),
`di(` would give `printf();` (inside `(`),
or instead of deleting, some actions could be useful, like changing to uppercase: e.g.
`gUi"` would give `printf("HELLO WORLD\n");`
- szszrk 5y agoDidn't realize I could do `di"`... that's so neat. I always at least whip through such articles about vim as there may be something I don't use daily, but could. There always is such a thing. I love to use all the zero-configuration things that are already present in Vi/Vim at work. IDE's are cool for devs or people who do everything from a stable workstation. I rarely have such comfort, jumping from one server to another, from one image to another. And Vi or Vim are always there. Thanks for all those hints.
- WithinReason 5y agoFor VSCode users: ctrl+backspace: `printf("World\n");` ctrl+delete: `printf("Hello \n");` alt+shift+right, alt+shift+right, delete: `printf();`
- totony 5y agoOr install the vim emulator plugin. It's not perfect but it does a lot