安裝javascript
sudo apt-getinstall vim// Ubuntu
其餘平臺,能夠自行谷歌/百度css
# hjkl# 2w 向前移動兩個單詞# 3e 向前移動到第 3 個單詞的末尾# 0 移動到行首# $ 當前行的末尾# gg 文件第一行# G 文件最後一行# 行號+G 指定行# <ctrl>+o 跳轉回以前的位置# <ctrl>+i 返回跳轉以前的位置
# <esc> 進入正常模式# :q! 不保存退出# :wq 保存後退出
# x 刪除當前字符# dw 刪除至當前單詞末尾# de 刪除至當前單詞末尾,包括當前字符# d$ 刪除至當前行尾# dd 刪除整行# 2dd 刪除兩行
# i 插入文本# A 當前行末尾添加# r 替換當前字符# o 打開新的一行並進入插入模式
# u 撤銷# <ctrl>+r 取消撤銷複製粘貼剪切# v 進入可視模式# y 複製# p 粘貼# yy 複製當前行# dd 剪切當前行
#<ctrl>+g 顯示當前行以及文件信息查找# / 正向查找(n:繼續查找,N:相反方向繼續查找)# ? 逆向查找# % 查找配對的 {,[,(# :set ic 忽略大小寫# :set noic 取消忽略大小寫# :set hls 匹配項高亮顯示# :set is 顯示部分匹配
# :s/old/new 替換該行第一個匹配串# :s/old/new/g 替換全行的匹配串# :%s/old/new/g 替換整個文件的匹配串
# zc 摺疊# zC 摺疊全部嵌套# zo 展開摺疊# zO 展開全部摺疊嵌套
# :!shell 執行外部命令
.vimrc 是 Vim 的配置文件,須要咱們本身建立:html
cd Home // 進入 Home 目錄touch .vimrc // 配置文件# Unix# vim-plug# Vimcurl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim# Neovimcurl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
其餘平臺,能夠查看 vim-plug。前端
set nobackupset noswapfile
setencoding=utf-8
setnumber
setnowrap
setruler
set cindentset tabstop=2set shiftwidth=2
setcursorline
set icset hlsset is
setshowmode
#啓動 vim 時關閉摺疊代碼set nofoldenable
syntax enableset background=darkcolorscheme solarized
◈ altercation/vim-colors-solarized
◈ Anthony25/gnome-terminal-colors-solarized
html5
Plug 'scrooloose/nerdtree'Plug 'jistr/vim-nerdtree-tabs'Plug 'Xuyuanp/nerdtree-git-plugin'autocmd vimenter * NERDTreemap <C-n> :NERDTreeToggle<CR>let NERDTreeShowHidden=1let g:NERDTreeShowIgnoredStatus = 1let g:nerdtree_tabs_open_on_console_startup=1let g:NERDTreeIndicatorMapCustom = { \ "Modified" : "✹", \ "Staged" : "✚", \ "Untracked" : "✭", \ "Renamed" : "➜", \ "Unmerged" : "═", \ "Deleted" : "✖", \ "Dirty" : "✗", \ "Clean" : "✔︎", \ 'Ignored' : '☒', \ "Unknown" : "?" \ }# o 打開關閉文件或目錄# e 以文件管理的方式打開選中的目錄# t 在標籤頁中打開# T 在標籤頁中打開,但光標仍然留在 NERDTree# r 刷新光標所在的目錄# R 刷新當前根路徑# X 收起全部目錄# p 小寫,跳轉到光標所在的上一級路徑# P 大寫,跳轉到當前根路徑# J 到第一個節點# K 到最後一個節點# I 顯示隱藏文件# m 顯示文件操做菜單# C 將根路徑設置爲光標所在的目錄# u 設置上級目錄爲根路徑# ctrl + w + w 光標自動在左右側窗口切換# ctrl + w + r 移動當前窗口的佈局位置# :tabc 關閉當前的 tab# :tabo 關閉全部其餘的 tab# :tabp 前一個 tab# :tabn 後一個 tab# gT 前一個 tab# gt 後一個 tab
◈ scrooloose/nerdtree
◈ vim-nerdtree-tabs
◈ nerdtree-git-plugin
java
Plug 'Valloric/YouCompleteMe'Plug 'Raimondi/delimitMate'Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
◈ Valloric/YouCompleteMe
◈ Raimondi/delimitMate
◈ Shougo/deoplete.nvim
css3
Plug 'sheerun/vim-polyglot'Plug 'w0rp/ale'let g:ale_linters = {\ 'javascript': ['eslint'],\ 'css': ['stylelint'],\}let g:ale_fixers = {\ 'javascript': ['eslint'],\ 'css': ['stylelint'],\}let g:ale_fix_on_save = 1let g:ale_sign_column_always = 1let g:ale_sign_error = '●'let g:ale_sign_warning = '▶'nmap <silent> <C-k> <Plug>(ale_previous_wrap)nmap <silent> <C-j> <Plug>(ale_next_wrap)
◈ w0rp/ale
◈ sheerun/vim-polyglot
git
Plug 'rking/ag.vim'Plug 'kien/ctrlp.vim'
◈ kien/ctrlp.vim
◈ ggreer/the_silver_searcher
◈ rking/ag.vim
github
Plug 'vim-airline/vim-airline'Plug 'vim-airline/vim-airline-themes'let g:airline_theme='papercolor'
◈ vim-airline/vim-airline
◈ vim-airline/vim-airline-themes
typescript
Plug 'scrooloose/nerdcommenter'# <leader>cc // 註釋# <leader>cm 只用一組符號註釋# <leader>cA 在行尾添加註釋# <leader>c$ /* 註釋 */# <leader>cs /* 塊註釋 */# <leader>cy 註釋並複製# <leader>c<space> 註釋/取消註釋# <leader>ca 切換 // 和 /* */# <leader>cu 取消註釋let g:NERDSpaceDelims = 1let g:NERDDefaultAlign = 'left'let g:NERDCustomDelimiters = { \ 'javascript': { 'left': '//', 'leftAlt': '/**', 'rightAlt': '*/' }, \ 'less': { 'left': '/**', 'right': '*/' } \ }
◈ scrooloose/nerdcommenter
Plug 'airblade/vim-gitgutter'Plug 'tpope/vim-fugitive'
◈ airblade/vim-gitgutter
◈ tpope/vim-fugitive
Plug 'suan/vim-instant-markdown'let g:instant_markdown_slow = 1let g:instant_markdown_autostart = 0# :InstantMarkdownPreview
◈ suan/vim-instant-markdown
Plug 'mattn/emmet-vim'let g:user_emmet_leader_key='<Tab>'let g:user_emmet_settings = { \ 'javascript.jsx' : { \ 'extends' : 'jsx', \ }, \ }
◈ mattn/emmet-vim
Plug'othree/html5.vim'
◈ othree/html5.vim
Plug 'hail2u/vim-css3-syntax'Plug 'ap/vim-css-color'augroup VimCSS3Syntax autocmd! autocmd FileType css setlocal iskeyword+=-augroup END
◈ hail2u/vim-css3-syntax
◈ ap/vim-css-color
Plug 'pangloss/vim-javascript'let g:javascript_plugin_jsdoc = 1let g:javascript_plugin_ngdoc = 1let g:javascript_plugin_flow = 1set foldmethod=syntaxlet g:javascript_conceal_function = "ƒ"let g:javascript_conceal_null = "ø"let g:javascript_conceal_this = "@"let g:javascript_conceal_return = "⇚"let g:javascript_conceal_undefined = "¿"let g:javascript_conceal_NaN = "ℕ"let g:javascript_conceal_prototype = "¶"let g:javascript_conceal_static = "•"let g:javascript_conceal_super = "Ω"let g:javascript_conceal_arrow_function = "⇒"let g:javascript_conceal_noarg_arrow_function = " "let g:javascript_conceal_underscore_arrow_function = " "set conceallevel=1
◈ pangloss/vim-javascript
(注:上述腳本中存在特殊字符,有的狀況下顯示不正確,請直接用上述連接的內容。)
Plug 'mxw/vim-jsx'let g:jsx_ext_required = 0
◈ mxw/vim-jsx
Plug 'prettier/vim-prettier', { \ 'do': 'yarn install', \ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql'] }let g:prettier#config#bracket_spacing = 'true'let g:prettier#config#jsx_bracket_same_line = 'false'let g:prettier#autoformat = 0autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql PrettierAsync# :Prettier
◈ prettier/vim-prettier
最後,呈上參考配置 .vimrc
[1]: https://github.com/junegunn/vim-plug [2]: https://github.com/altercation/vim-colors-solarized [3]: https://github.com/Anthony25/gnome-terminal-colors-solarized [4]: https://github.com/scrooloose/nerdtree [5]: https://github.com/jistr/vim-nerdtree-tabs [6]: https://github.com/Xuyuanp/nerdtree-git-plugin [7]: https://github.com/Valloric/YouCompleteMe [8]: https://github.com/Raimondi/delimitMate [9]: https://github.com/Shougo/deoplete.nvim [10]: https://github.com/w0rp/ale [11]: https://github.com/sheerun/vim-polyglot [12]: https://github.com/kien/ctrlp.vim [13]: https://github.com/ggreer/the_silver_searcher [14]: https://github.com/rking/ag.vim [15]: https://github.com/vim-airline/vim-airline [16]: https://github.com/vim-airline/vim-airline-themes [17]: https://github.com/scrooloose/nerdcommenter [18]: https://github.com/airblade/vim-gitgutter [19]: https://github.com/tpope/vim-fugitive [20]: https://github.com/suan/vim-instant-markdown [21]: https://github.com/mattn/emmet-vim [22]: https://github.com/othree/html5.vim [23]: https://github.com/hail2u/vim-css3-syntax [24]: https://github.com/ap/vim-css-color [25]: https://github.com/pangloss/vim-javascript [26]: https://github.com/mxw/vim-jsx [27]: https://github.com/prettier/vim-prettier [28]: https://github.com/FengShangWuQi/to-vim/blob/master/.vimrc