# More Vim magic and moving to VSCode

- Link: https://tongfamily.com/2022/08/10/more-vim-magic-and-moving-to-vscode/
- Published: 2022-08-10T10:02:50-07:00
- Author: rich

OK, some more crazy Vim tricks. I have vi sets so that a window pops up with lint
errors and this can be annoying. Turns out there is a hack to close windows quickly.
Normally I do a CTRL-W CTRL-W to get to the window and then can do a `zz` to close
it. but it turns out that you can do a `:2q` to close the second window in addition
the regular `:q`

Another crazy trick is matching things and then replacing them. I had this problem
that someone was using three backquotes around everything and the markdownlint just
hated it, so how to remove everything around something? The easiest way turns out
to use the idea of a context and then search for one or more characters, so here
are some tricks:

 1. The normal thing to do is to search for `.*` but this matches zero characters. 
    Since the triple backquotes can also be part of a quote block, you want at least
    [one character before the string](http://www.vimregex.com), so you want `.\+` which
    is the more usual `.+` but the plus itself needs an escape as the + could just 
    be a character to search so the first part is the search for lines
 2. Then you want to capture that for later, then you need a grouping expression where
    you wrap what you want to later emit with `\(` and `\)` where the backslashes are
    again to tell vim that these are control characters
 3. Then in the replace, you just put the second call of the stuff in the middle with\
    1

    ```wp-block-code
    :/.\+```/s/```\(.*\)```/\1/
    ```

## Time to move to VSCode with Vim mode

And finally, as Alex said it’s probably time to move to VSCode, it is getting better
and better and all these plugins are cranky. For instance, Deon found a plugin for
docker, so you can just directly edit into a container. Got to start using that 
and start with VSCodium which removes the instrumentation from VSCode and then start
the plugin wars by enabling [Vim mode](https://oliviac.dev/blog/vim-with-vscode/).
The main thing here is reaching down into VSCode and extracting the json that controls
it.

### Share this:

 * [  Mastodon ](https://tongfamily.com/2022/08/10/more-vim-magic-and-moving-to-vscode/?share=mastodon)
 * [  LinkedIn ](https://tongfamily.com/2022/08/10/more-vim-magic-and-moving-to-vscode/?share=linkedin)
 * [  Facebook ](https://tongfamily.com/2022/08/10/more-vim-magic-and-moving-to-vscode/?share=facebook)
 * [  WhatsApp ](https://tongfamily.com/2022/08/10/more-vim-magic-and-moving-to-vscode/?share=jetpack-whatsapp)
 * [  Email ](https://tongfamily.com/2022/08/10/more-vim-magic-and-moving-to-vscode/?subject=%5BShared%20Post%5D%20More%20Vim%20magic%20and%20moving%20to%20VSCode&body=https%3A%2F%2Ftongfamily.com%2F2022%2F08%2F10%2Fmore-vim-magic-and-moving-to-vscode%2F&share=email)
 * [More](https://tongfamily.com/2022/08/10/more-vim-magic-and-moving-to-vscode/#)

 * [  Telegram ](https://tongfamily.com/2022/08/10/more-vim-magic-and-moving-to-vscode/?share=telegram)
 * [  Print ](https://tongfamily.com/2022/08/10/more-vim-magic-and-moving-to-vscode/#print?share=print)
 * [  Pinterest ](https://tongfamily.com/2022/08/10/more-vim-magic-and-moving-to-vscode/?share=pinterest)
 * [  Tumblr ](https://tongfamily.com/2022/08/10/more-vim-magic-and-moving-to-vscode/?share=tumblr)
 * [  X ](https://tongfamily.com/2022/08/10/more-vim-magic-and-moving-to-vscode/?share=twitter)

### Like this:

Like Loading…
