Vim plug-in collection (create your own cool IDE)

Vim plug-in collection

This article mainly introduces how to use Vim's plug-in function to build Vim into a cool and multifunctional Ide, so that you can write Python Go with Vim, and so on.. Instead of heavy advanced ides such as pycham

design sketch

Pre knowledge

vim mapping: mapping your own shortcut keys to the corresponding operations. If you don't understand this, you can learn it later without affecting this article

1. Install Vim plug-in manager VimPlug

vim provides plug-in functions by default, but if you integrate plug-ins manually, it will be too cumbersome and inefficient. Therefore, it will be more convenient and efficient to have vim plug-in manager to manage the plug-ins we need. Let's install vim plug-in manager first

github address: https://github.com/junegunn/vim-plug

#Installation method: directly execute the following commands on the terminal
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

#windows powershell
Windows (PowerShell)
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
    ni $HOME/vimfiles/autoload/plug.vim -Force

1.1 configure ~/.vimrc

Don't worry so much, just know that the plug-ins you need are placed between call plug\begin() and call plug\end()

The Plug-in needs to be specified with single quotation mark Plug 'Plug-in'

After the Plug-in Plug is the suffix of github, such as https://github.com/scrooloose/nerdtree

call plug#begin()
" The default plugin directory will be as follows:
"   - Vim (Linux/macOS): '~/.vim/plugged'
"   - Vim (Windows): '~/vimfiles/plugged'
"   - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the argument
"   - e.g. `call plug#begin('~/.vim/plugged')`
"   - Avoid using standard Vim directory names like 'plugin'

" Make sure you use single quotes #Make sure to use single quotation marks!!!

" On-demand loading
Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }

call plug#end()

1.2 reload ~/.vimrc and: PlugInstall

  1. You can use the command line mode directly: source ~ / Vimrc or wq! Re enter the file after exiting
  2. : PlugInstall installation
  3. The completion will be displayed after the installation is successful

2. Plug in VIM startify

The plug-in provides some auxiliary functions when vim starts, such as displaying recently opened files and a nice icon

github : https://github.com/mhinz/vim-startify

call plug#begin()

Plug 'mhinz/vim-startify'

call plug#end()

Execute: PlugInstall

  1. Open vim again to get the following interface to show your recently opened files
  2. The basic operation of vim jk can move up and down, and enter the file where the cursor is located

3. * plug in nerdtree side tree menu

This plug-in shows the current status when vim opens the file. This plug-in is a mandatory plug-in if you use vim as the ide

github : https://github.com/preservim/nerdtree

call plug#begin()

Plug 'mhinz/vim-startify'
Plug 'scrooloose/nerdtree'

call plug#end()

Execute: PlugInstall

  1. vim opens a file, which can be a project file
  2. : NERDTree type to expand the sidebar tree structure
  3. : NERDTreeToggle triggers opening and closing
  4. : NERDTreeFind locates the sidebar to the current file
  5. The following shortcut keys are mapped. When I, + t, I directly open the sidebar, and press it again to close it

4. Tokyonight VIM Tokyo Night theme

You can change the theme of vim. The tokyonight VIM theme I chose

github vim topic : https://github.com/topics/vim-colorscheme There are many topics related to vim

tokyonight-vim github : https://github.com/ghifarit53/tokyonight-vim

Plug 'ghifarit53/tokyonight-vim'

Set the following two themes: ngiht and storm

set termguicolors

let g:tokyonight_style = 'night' " available: night, storm
let g:tokyonight_enable_italic = 1

colorscheme tokyonight

4.1 * transparent setting

The transparent background setting is provided. Here, I set the transparency to keep the same color as my terminal

let g:tokyonight_transparent_background = 1 

5. * plug in fzf quick search file

This plug-in is a fast search file and must be installed. It is faster than Ctrl P

github https://github.com/junegunn/fzf.vim

Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
  1. :Files [PATH]
  2. :Ag [PATTERN]
  3. My shortcut key mapped

Press control + p to search quickly

Press control + g to quickly perform global fuzzy search (above is to search only files)

6. * plug in FZF funky

Does this plug-in cooperate with fzf to search in the file

Used to replace the CTRL plug-in

https://github.com/kien/ctrlp.vim

ctrlp-funky

github https://github.com/tracyone/fzf-funky

Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'tracyone/fzf-funky',{'on': 'FzfFunky'}

Map the leader fu

nnoremap <Leader>fu :FzfFunky<Cr>

7. Bottom bar of plug-in VIM airline

The plug-in is to add some logos at the bottom to make you more aware of the current operation

github https://github.com/vim-airline/vim-airline

Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'

8. * plug in indentLine split line

The plug-in is to add some split lines. For example, when you write python, the format alignment can be seen intuitively through this split line

github https://github.com/Yggdroot/indentLine

Plugin 'Yggdroot/indentLine'

9. Plug in easymotion

This plug-in allows you to quickly move the cursor to your visible area in vim

github https://github.com/easymotion/vim-easymotion

Plugin 'easymotion/vim-easymotion'

Map ss as shortcut key

When I press ss and input a prefix of 2 characters, the following view will appear (I press cr)

Just press the corresponding letter to jump to the corresponding place

10. * plug in tagbar

This plug-in is also one of the required plug-ins, which is used to display the overall structure view of the file on the right

github : https://github.com/preservim/tagbar

Plugin 'preservim/tagbar'

Set Control + u as the mapping shortcut

vim operation can be carried out inside, and then the left side of the Enter key will jump to the corresponding code

Welcome to personal blog Johnny cottage
Welcome to follow personal official account

Tags: Java Spring Spring Boot

Posted by etully on Sat, 06 Aug 2022 01:56:43 +0930