Summarize some of the instructions and considerations you have to understand during the process of using Vim

Vim is an ancient artifact. This article mainly summarizes some of the instructions and considerations that you have to understand during the process of using Vim, and continues to share some plug-ins that a front-end worker has to install. About Vim's introduction, the choice of topics And why use vim-plug to manage plugins and other content, interested students can come and understand and compare

installation

Sudo apt-get install vim // Ubuntu

Other platforms, you can google yourself

Beginner's guide

Vimtutor // vim tutorial

The above is the simplest and most comprehensive Vim basic tutorial in history.

The following is the author based on the above induction

Moving the cursor

# hjkl

# 2w Move two words forward

# 3e Move forward to the end of the 3rd word

# 0 Move to the beginning of the line

# $ at the end of the current line

# gg file first line

# G file last line

#行号+G Specify the line

# +o Jump back to the previous position

# +i Return to the position before the jump

drop out

# Enter normal mode

# :q! Do not save and exit

# :wq Exit after saving

delete

# x delete current character

# dw delete to the end of the current word

# de Delete to the end of the current word, including the current character

# d$ Delete to the end of the current line

# dd Delete the entire line

# 2dd Delete two lines

modify

# i insert text

# A Add at the end of the current line

# r replace the current character

# o Open a new line and enter insert mode

Cancel

# u revoke

# +r Cancel cancellation

Copy paste cut

# v Enter visual mode

# y 复制

# p paste

# yy Copy the current line

# dd Cut the current line

status

# +g Display current line and file information

Find

# / Forward lookup (n: continue to find, N: continue to search in the opposite direction)

# ? Reverse lookup

# % Find paired {,[,(

# :set ic ignore case

# :set noic Cancel ignoring case

# :set hls Match highlighting

# :set is show partial matches

replace

# :s/old/new Replace the first matching string of the line

# :s/old/new/g Replace the matching string of the entire line

# :%s/old/new/g Replace the matching string of the entire file

Execute external commands

# :!shell Execute external commands

.vimrc

.vimrc is Vim's configuration file, we need to create it ourselves

Cd Home // Go to the Home directory

Touch.vimrc // configuration file

# Unix

# vim-plug

# Vim

Curl -fLo ~/.vim/autoload/plug.vim --create-dirs

Https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

# Neovim

Curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs

Https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Other platforms, you can view vim-plug

basic configuration

Cancel backup

Set nobackup

Set noswapfile

file encoding

Set encoding=utf-8

Display line number

Set number

Cancel line break

Set nowrap

Display the current position of the cursor

Set ruler

Set indentation

Set cindent

Set tabstop=2

Set shiftwidth=2

Highlight current line

Set cursorline

Find

Set ic

Set hls

Set is

The current vim mode is displayed in the lower left corner

Set showmode

Code folding

# Close the collapse code when starting vim

Set nofoldenable

theme

Syntax enable

Set background=dark

Colorscheme solarized

Plugin configuration

Tree directory

Plug'scrooloose/nerdtree'

Plug'jistr/vim-nerdtree-tabs'

Plug'Xuyuanp/nerdtree-git-plugin'

Autocmd vimenter *NERDTree

Map :NERDTreeToggle

Let NERDTreeShowHidden=1

Letg:NERDTreeShowIgnoredStatus = 1

Letg:nerdtree_tabs_open_on_console_startup=1

Letg:NERDTreeIndicatorMapCustom = {

"Modified" : "✹",

"Staged" : "✚",

"Untracked" : "✭",

"Renamed" : "➜",

"Unmerged" : "═",

"Deleted" : "✖",

"Dirty" : "✗",

"Clean" : "✔︎",

'Ignored' : '☒',

"Unknown" : "?"

}

# o Open a closed file or directory

# e Open the selected directory in file management mode

# t Open in tabs

# T opens in the tab, but the cursor remains in NERDTree

# r Refresh the directory where the cursor is located

# R Refresh the current root path

# X Collapse all directories

# p Lowercase, jump to the previous path where the cursor is located

# P uppercase, jump to the current root path

# J to the first node

# K to the last node

# I Show hidden files

# m Display file operation menu

# C Set the root path to the directory where the cursor is located

# u Set the parent directory as the root path

# ctrl + w + w The cursor automatically switches between the left and right windows

# ctrl + w + r Move the layout position of the current window

# :tabc Close the current tab

# :tabo close all other tabs

# :tabp Previous tab

# :tabn After a tab

# gT Previous tab

# gt后一个tab

Code, quotes, path completion

Plug'Valloric/YouCompleteMe'

Plug'Raimondi/delimitMate'

Plug'Shougo/deoplete.nvim',{'do': ':UpdateRemotePlugins'}

Syntax highlighting, check

Plug'sheerun/vim-polyglot'

Plug'w0rp/ale'

Letg:ale_linters = {

'javascript': ['eslint'],

'css': ['stylelint'],

}

Letg:ale_fixers = {

'javascript': ['eslint'],

'css': ['stylelint'],

}

Letg:ale_fix_on_save = 1

Letg:ale_sign_column_always = 1

Letg:ale_sign_error = '●'

Letg:ale_sign_warning = 'â–¶'

Nmap

Nmap

File, code search

Plug'rking/ag.vim'

Plug'kien/ctrlp.vim'

Enhanced status bar

Plug'vim-airline/vim-airline'

Plug'vim-airline/vim-airline-themes'

Letg:airline_theme='papercolor'

Code comment

Plug'scrooloose/nerdcommenter'

# cc // Comments

# cm Only use a set of symbol comments

# cA Add a comment at the end of the line

# c$ /* Comments */

# cs /* Block Comments*/

# cy comments and copy

# c Comments / Uncomment

# ca Switch / / and / * * /

# cu Uncomment

Letg:NERDSpaceDelims = 1

Letg:NERDDefaultAlign = 'left'

Letg:NERDCustomDelimiters = {

'javascript': {'left': '//', 'leftAlt': '/**', 'rightAlt': '*/'},

'less': {'left': '/**', 'right': '*/'}

}

Git

Plug'airblade/vim-gitgutter'

Plug'tpope/vim-fugitive'

Markdown

Plug'suan/vim-instant-markdown'

Letg:instant_markdown_slow = 1

Letg:instant_markdown_autostart = 0

# :InstantMarkdownPreview

Emmet

Plug'mattn/emmet-vim'

Letg:user_emmet_leader_key=''

Letg:user_emmet_settings = {

'javascript.jsx' : {

'extends' : 'jsx',

},

}

Html 5

Plug 'othree/html5.vim'

Css 3

Plug'hail2u/vim-css3-syntax'

Plug'ap/vim-css-color'

Augroup VimCSS3Syntax

Autocmd!

Autocmd FileType css setlocal iskeyword+=-

Augroup END

JavaScipt

Plug'pangloss/vim-javascript'

Letg:javascript_plugin_jsdoc = 1

Letg:javascript_plugin_ngdoc = 1

Letg:javascript_plugin_flow = 1

Set foldmethod=syntax

Letg:javascript_conceal_function = "Æ’"

Letg:javascript_conceal_null = "ø"

Letg:javascript_conceal_this = "@"

Letg:javascript_conceal_return = "⇚"

Letg:javascript_conceal_undefined = "¿"

Letg:javascript_conceal_NaN = "N"

Letg:javascript_conceal_prototype = "¶"

Letg:javascript_conceal_static = "•"

Letg:javascript_conceal_super = "Ω"

Letg:javascript_conceal_arrow_function = "⇒"

Letg:javascript_conceal_noarg_arrow_function = ""

Letg:javascript_conceal_underscore_arrow_function = ""

Set conceallevel=1

React

Plug'mxw/vim-jsx'

Letg:jsx_ext_required = 0

Prettier

Plug'prettier/vim-prettier',{

'do': 'yarn install',

'for': ['javascript','typescript','css','less','scss','json','graphql']}

Letg:prettier#config#bracket_spacing = 'true'

Letg:prettier#autoformat = 0

Autocmd BufWritePre *.js, *.jsx, *.mjs, *.ts, *.tsx, *.css, *.less, *.scss, *.json, *.graphql PrettierAsync

Mr Fog Vape

Mr Fog Vape,Mr Fog Max Pro,Mr Fog Max Pro Disposable Vape,Mr Fog Max Pro Vape

Nanning Nuoxin Technology Co., LTD , https://www.nx-vapes.com

Posted on