Vim Series tutorial Contents:

  • Vim 1 basic use
  • Vim 2 Advanced usage
  • Vim 3 vimrc
  • Vim 4 common plugins
  • Vim 5 Vim plug-in for other editors

Because the editing mode of Vim is really excellent, and the popularity of programmers is relatively high. , so many editors/ides also have plug-ins that mimic Vim. My main development tool is VSCode/IDE + Vim plug-in, which can not only use Vim editing function, but also use IDE’s powerful code prompt, reconstruction, debugging and other functions.

Here are a few Vim plug-ins for common editors/ides.

VS Code

You can use VSCodeVim in VSCode and install it in the VSCode marketplace.

Once installed, some configuration needs to be done:

  1. In VSCodesettings.jsonIn:
/* ---- Vim start ---- */ // highlight search"vim.hlsearch": true, / / line width"vim.textwidth": 120,
    // leader key
    "vim.leader": ";"// Do not use Vim Ctrl-related shortcuts"vim.useCtrlKeys": false// Use the system clipboard"vim.useSystemClipboard": true."vim.insertModeKeyBindings": [{"before": [
                "k"."k"]."after": [
                "<Esc>"]}],"vim.visualModeKeyBindingsNonRecursive"[// visual mode paste without replacing register {"before": [
                "p",]."after": [
                "p"."g"."v"."y"]}],"vim.normalModeKeyBindingsNonRecursive": [{"before": [
                "leader"."w"]."after": []."commands": [{"command": ""."args": []}]}, {"before": [":"]."commands": [
                "workbench.action.showCommands",]}, {"before": ["k"]."after": ["g"."k"] {},"before": ["j"]."after": ["g"."j"]
    /* ---- Vim end ---- */
Copy the code
  1. I used to set ctrl-h /j/k/l in insert mode to bottom left, top right. This can be done in VSCodekeybindings.jsonTo configure:
    /* ---- Vim begin ---- */
        "key": "ctrl+h"."command": "cursorLeft"."when": "editorTextFocus"
        "key": "ctrl+l"."command": "cursorRight"."when": "editorTextFocus"
        "key": "ctrl+j"."command": "cursorDown"."when": "editorTextFocus"
        "key": "ctrl+j"."command": "selectNextSuggestion"."when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
        "key": "ctrl+j"."command": "showNextParameterHint"."when": "editorTextFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
        "key": "ctrl+k"."command": "cursorUp"."when": "editorTextFocus"
        "key": "ctrl+k"."command": "selectPrevSuggestion"."when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
        "key": "ctrl+k"."command": "showPrevParameterHint"."when": "editorTextFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
    /* ---- Vim end ---- */
Copy the code

JetBrains buckets

The IdeaVim plugin is available for the JetBrains family bucket and can be installed in any IDE in the JetBrains family bucket.

Ideavimrc has its own vIMrc file, named:. Ideavimrc, which needs to be placed in the user directory, most of the configuration is the same as Vim, see… , here is a list of my common configurations:

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -"Highlight matching parenthesesset showmatch
"Highlight search keyword set hlSearch"Instant searchset incsearch
"Smartcase sensitive, as long as one letter is uppercase, it is case sensitive, otherwise not. Set ignorecase smartcase" ----------------

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -"Inoremap kk <Esc>"Prevent multiple lines from jumping at once nnoremap k gk nnoremap j gj"Vnoremap p does not replace register contents when using p paste in visual mode"_dP "Configure the leader as;let mapleader=";"
       w to save file nnoremap 
        w :w
      In visual mode, press <leader>y to write the content to the system register vnoremap <leader>y"+y
"Press <leader>p to paste the contents of the system register nnoremap <leader>p"+p
" ----------------
Copy the code

In addition, in the IDE, left, Down, up, and right are mapped to Ctrl-H/J/K/L, which can also be moved in insert mode.

Also note: in the IDE, if the IDE shortcut used is in conflict with the Vim shortcut, the IDE will prompt you to use the one you choose. It can also be set uniformly in the IDE Settings.


In Eclipse, you can use vrapper and install it through the Eclipse Marketplace. If not, download it from the Eclipse website and install it manually.

Vrapper also has its own vimrc file: _vrapperrc, also need to put in the user directory, the configuration way with reference to the official document:…

My usual configuration:

inoremap kk <Esc>
let mapleader=";"
nmap <leader>w :w<CR>
vnoremap p "_dP
"In visual mode, press <leader>y to write the content to the system register vnoremap <leader>y"+y
"Press <leader>p to paste the contents of the system register nnoremap <leader>p"+p
Copy the code

Similarly, in Eclipse, map previous column, Down, next column, up to Ctrl-H /j/ K/L.


This is the end of the Vim series, and you may be saying: You haven’t covered how to use Vim for C/C++/Java/Python/Web development.

Vim is great, but in today’s environment, it is not practical to use Vim as a development tool. Even I use Vim now, I use it more for editing functions, and I rely on other IDES for development. Making Vim an IDE is too much hassle, and there’s no guarantee that other ides will work. Learn the basics of Vim, install the Vim plug-in in other ides, and you can use it comfortably. For Vim itself, I prefer to use it as a text editor to write notes, check logs, and change configurations.

Sometimes I wonder if Vim was the hero of the ancient world of software that programmers created using it (Emacs: Don’t I deserve a name?). .

But times are moving on, and even though Vim is a miracle, in some ways it will be overtaken by new tools, which is not a sad thing, but a good thing for us programmers, and we should embrace new things. On the other hand, some of the ideas and uses of Vim are still excellent, and for people who are used to regular editors, Vim is new and worth recognizing and learning. So I hope you can understand it, try to use it, believe that it can improve your efficiency, to help you.