`daw` and `diw` deletes a whole word (unlike `dw` which only deletes forward). They differ in what they do with whitespace; `aw` also trims trailing whitespace (or leading whitespace if there's no trailing) while `iw` leaves the whitespace alone. These two are text objects that can be combined with other commands and quantifiers, so that `yaw` copies a word without deleting it, or `d2aw` deletes two words.
Wrapping in parens requires the vim-surround plugin, but with that installed you can do `ysaw(` and `ysaw)` to wrap in parens (also works with brackets and curlies and such), either with spaces inside the parens (the former) or snugly around the word (the latter).
You can use the same pattern for any selection you have visually highlighted, such is the wonderful power of vim.
`cs"'` change surrounding double quotes to single
`dst` delete surrounding HTML tag pair
`ysiptp>` wrap this paragraph in <p></p>
:help text-objects
Text Objects are really the best thing about vim after the command grammar itself.
> insert parantesis around the word im on
Install surround.vim and add the following to your .vimrc (I think s duplicates c too closely for the prime keyboard position. Therefore, s is for surround):
nmap s ysi
nmap S ysa
nmap s$ ys$
nmap sv gvs
You can then surround whatever text object you want. Surround the current word with `sw(`, surround the current braces with `s{(`, etc. The `sv` prefix lets you surround the thing you just surrounded: `sw"sv(` turns `wo|rd` -> `("wo|rd")`.
example of my vimimprove.md:
- 5 deleting word while curser is in the middle of that word
- 2 insert parantesis around the word im on
....
when something reaches 10, I google it and write it on a note. Then the first thing I do in the morning is doing that thing 10 times. Before I leave work, I do it again. And of coarse if you use it while working you might just have it in your muscles or you look at your little note. Then after a while your finger get that ninja stile of doing stuff you brain just things about.
Like ying and yang