# More tips on keyboard shortcut tricks for vim text objects and motions and vimari reminders plus brew –force

- Link: https://tongfamily.com/2021/08/05/more-tips-on-keyboard-shortcut-tricks-for-vim-text-objects-and-motions-and-vimari-reminders-plus-brew-force/
- Published: 2021-08-05T10:12:58-07:00
- Author: rich

Well, in the never-ending quest to be efficient, one this that is a pain is that
in normal vi, if you want to say change things inside a set of quotes, you have 
to go backward to the first quote with F” and then change to the next quote with
ct” which means Find backward to the first double quote and then Change To the next
quote.

But, it turns out that there is vim extension that makes it easier. I saw this in
a Medium tip and tricks and confirmed it today, but to review the syntax as [Carbon Hacks](https://blog.carbonfive.com/vim-text-objects-the-definitive-guide/)
does, the syntax for vim is:

    ```wp-block-code
    <number of times to run><command>[<movement action>|<text object>]
    ```

In the old vi, it was just an action, but vim introduces this idea of a text object
which look like

    ```wp-block-code
    <command> := [ d | c | v ]
    <text object> := [a | i ][ w | s | p | " | ' | ` | (  | ) | [ | ] | | { | } | B | b | < | > | t ]
    ```

So to explain this, you can select Around which means includes the surrounding white
space, so `daw` means Delete Around the Word where your cursor is, so all the white
spaces go away and Include the wood so `diw` means Delete in the current word so
it is the word where the cursor lives. And V means just select the entire object

And for completeness, there is also a movement that is `dw` where the normal w command
means to move from the current cursor to the end of the word, so a Delete word will
delete just from the current cursor to the end of the word.

So what are the other movements well then make sense, they would be Sentence and
Paragraph, so `cas` means change a sentence and all the white space around it.

And finally, there is a really convenient way to change a quoted string with `ci"`
which means change the entire string in double-quotes where the cursor is. Man is
this going to save me time. This also works for the backtick and the single quote
and also within parentheses with `di(`. You can also do the same with square brackets.
Not that both the right and left parentheses work. Also, you can use b for Block
the same way you can use parentheses. And curly braces work as well are equivalent
to a capital B. for big block I would guess.

And now for the advanced stuff, you can also do with HTML tags, so you can change
in and around angle brackets. Or just t for Tag.

## Adding New Text Motions which also work with about and inside

Finally, if you add some plug-ins then you get new motion keys which are pretty 
useful for moving around but really nice when you are trying to change things.

You can move across words that are in Camel or snake case with [CamelCaseMotion](https://github.com/bkad/CamelCaseMotion),
so suddenly a comma, `,` works so `ci,w` means change a complete camel or snake 
case word. And just `,w` means move across each Snake cased name part like `hello-
long-snake-case-variable` instead of skipping over the entire variable name.

And adding [VimTextObj](https://github.com/vim-scripts/argtextobj.vim) adds the `
a` text object so that `cia` means change in an argument and [Indent Object](https://github.com/michaeljsmith/vim-indent-object)
adds a text object that works for Python where indents matte so `dai` means delete
around an Indented object

## Finally, remembering vimari tab shortcuts w, q, r, x and t

This is a really nice keyboard shortcut thing and a reminder that you can go `f`
to follow and you get vi-like commands like `g` to go somewhere but some of the 
other useful things are tab command where:

 * `w` means next tab
 * `q` means previous and remember ⌘-W means close tab, so it is a little confusing
   but makes sense when you look at where the keys are, so q is to the right of 
   the the w key on a QWERTY keyboard
 * `r` for reload a tab
 * `x` to close a tab
 * `t` to open a new one

## Finally, Finally, when brew uninstall does not work

I have this problem every so often, for instance `brew reinstall --cask wireshark`
didn’t work because some uninstall was missing, so you can force an install with`
brew install --cask --force wireshark` and it all just works.

### Share this:

 * [  Mastodon ](https://tongfamily.com/2021/08/05/more-tips-on-keyboard-shortcut-tricks-for-vim-text-objects-and-motions-and-vimari-reminders-plus-brew-force/?share=mastodon)
 * [  LinkedIn ](https://tongfamily.com/2021/08/05/more-tips-on-keyboard-shortcut-tricks-for-vim-text-objects-and-motions-and-vimari-reminders-plus-brew-force/?share=linkedin)
 * [  Facebook ](https://tongfamily.com/2021/08/05/more-tips-on-keyboard-shortcut-tricks-for-vim-text-objects-and-motions-and-vimari-reminders-plus-brew-force/?share=facebook)
 * [  WhatsApp ](https://tongfamily.com/2021/08/05/more-tips-on-keyboard-shortcut-tricks-for-vim-text-objects-and-motions-and-vimari-reminders-plus-brew-force/?share=jetpack-whatsapp)
 * [  Email ](https://tongfamily.com/2021/08/05/more-tips-on-keyboard-shortcut-tricks-for-vim-text-objects-and-motions-and-vimari-reminders-plus-brew-force/?subject=%5BShared%20Post%5D%20More%20tips%20on%20keyboard%20shortcut%20tricks%20for%20vim%20text%20objects%20and%20motions%20and%20vimari%20reminders%20plus%20brew%20--force&body=https%3A%2F%2Ftongfamily.com%2F2021%2F08%2F05%2Fmore-tips-on-keyboard-shortcut-tricks-for-vim-text-objects-and-motions-and-vimari-reminders-plus-brew-force%2F&share=email)
 * [More](https://tongfamily.com/2021/08/05/more-tips-on-keyboard-shortcut-tricks-for-vim-text-objects-and-motions-and-vimari-reminders-plus-brew-force/#)

 * [  Telegram ](https://tongfamily.com/2021/08/05/more-tips-on-keyboard-shortcut-tricks-for-vim-text-objects-and-motions-and-vimari-reminders-plus-brew-force/?share=telegram)
 * [  Print ](https://tongfamily.com/2021/08/05/more-tips-on-keyboard-shortcut-tricks-for-vim-text-objects-and-motions-and-vimari-reminders-plus-brew-force/#print?share=print)
 * [  Pinterest ](https://tongfamily.com/2021/08/05/more-tips-on-keyboard-shortcut-tricks-for-vim-text-objects-and-motions-and-vimari-reminders-plus-brew-force/?share=pinterest)
 * [  Tumblr ](https://tongfamily.com/2021/08/05/more-tips-on-keyboard-shortcut-tricks-for-vim-text-objects-and-motions-and-vimari-reminders-plus-brew-force/?share=tumblr)
 * [  X ](https://tongfamily.com/2021/08/05/more-tips-on-keyboard-shortcut-tricks-for-vim-text-objects-and-motions-and-vimari-reminders-plus-brew-force/?share=twitter)

### Like this:

Like Loading…
