Vscode VIM setup

Automatic formatting

Vim JK Operation TAB instead of gt GT shortcut key

{
  "window.zoomLevel": 0."git.path": "/user/bin/git"."files.exclude": {
    "**node_modules**": true
  },
  "editor.formatOnSave": true."files.autoSave": "afterDelay"."[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  // gt Gt takes effect
  "vim.normalModeKeyBindingsNonRecursive": [{"before": [
        "K"]."after": [
        "g"."t"] {},"before": [
        "J"]."after": [
        "g"."T"]]}}Copy the code

Not available in the new Snippet TSX

Solution:

Try using the javascriptreact and typescriptreact scopes for jsx and tsx respectively. These are treated as separate languages for legacy reasons

"scope": "javascript,typescript,reacttypescript,javascriptreact,typescriptreact".Copy the code

Vim HJKL holding can’t move cursor continuously?

The solution

defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false         # For VS Code
defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false # For VS Code Insider
defaults delete -g ApplePressAndHoldEnabled
Copy the code

After executing the above code, restart vscode

Problem solved in MacOS

Vscode TAB switching Chinese input method problem

Github.com/daipeihust/…

In setting the json add vim. AutoSwitchInputMethod. “enable” : true, “vim. AutoSwitchInputMethod. DefaultIM” : “com.apple.keylayout.US”, “vim.autoSwitchInputMethod.obtainIMCmd”: “/usr/local/bin/im-select”, “vim.autoSwitchInputMethod.switchIMCmd”: “/usr/local/bin/im-select {im}”

Macos IM-select failed to download and install

The curl – Ls raw.githubusercontent.com/daipeihust/… | sh after execution, without any effect

The solution

Check the raw.githubusercontent.com/daipeihust/…

#!/bin/sh

# if im-select already exist, delete it and download it again
if [ -e /usr/local/bin/im-select ]
then
    rm -f /usr/local/bin/im-select
fi

echo "* Downloading im-select..."

curl -Ls -o /usr/local/bin/im-select https://github.com/daipeihust/im-select/raw/master/im-select-mac/out/im-select

chmod 777 /usr/local/bin/im-select

echo "* im-select is installed!"
echo "*"
echo "*"
echo "*"
echo "* now run \"im-select\" in your terminal!"
Copy the code

Know it is downloaded github.com/daipeihust/… The links;

  1. Access the above connection
  2. After the download is complete, run the following command
sudo mv /Users/$USER/Downloads/im-select /usr/local/bin/
sudo chmod 777  /usr/local/bin/im-select
Copy the code

MacOS supports the code. Command

Install code:

Open VSCode – > command+ Shift + P – > enter shell command – > Click prompt shell command: Install ‘code’ command in PATH to run

Use:

Open the terminal, CD to the folder you want to open with VSCode, and then type the command code. You can open

Mac fast switch between two vscode Windows

All app switching Windows on the MAC are CMD + ‘

To switch between applications: CMD + TAB

Easy to use vscode plug-in

Cost prompt import cost

The Import Cost extension is amazing to me. I didn’t pay much attention to the Import package size when I was writing code. Only consider these issues during post-optimization. But this plugin can tell you how big a package is when you import it.

Effect:

Quokka.js

Support NODEJS scenario JS, TS debugging; Very convenient to use;

Actual use:

GitLens

The Git experience in VS Code strikes a good balance between ease of use and completeness, allowing most users to get their work done without being overwhelmed by too many features. But many hardcore Git users will surely find the functionality inadequate. Including but not limited to:

You cannot view code changes in a COMMIT. You can’t compare two Commits or branches and see code changes; Cannot view code history. GitLens, however, makes up the difference.

Node_modules package search tool

Search node_modules

Marketplace.visualstudio.com/items?itemN…