让Vim 支持Javascript 语法高亮显示

Installation

Download plug.vim
and put it in the "autoload" directory.
Ref: vim-plug

Vim

Unix
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Windows (PowerShell)
md ~\vimfiles\autoload
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
(New-Object Net.WebClient).DownloadFile(
  $uri,
  $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
    "~\vimfiles\autoload\plug.vim"
  )
)

Usage

Add a vim-plug section to your ~/.vimrc (or ~/.config/nvim/init.vim for Neovim):

  1. Begin the section with call plug#begin()
  2. List the plugins with Plug commands
  3. call plug#end() to update &runtimepath and initialize plugin system
    • Automatically executes filetype plugin indent on and syntax enable.
      You can revert the settings after the call. e.g. filetype indent off, syntax off, etc.

Example

" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')

" Make sure you use single quotes

" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'

" Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git'

" Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'

" On-demand loading
Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }

" Using a non-master branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }

" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' }

" Plugin options
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }

" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }

" Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin'

" Initialize plugin system
call plug#end()

Reload .vimrc and :PlugInstall to install plugins.

JavaScript

JavaScript bundle for vim, this bundle provides syntax highlighting and improved indentation.

  git clone https://github.com/pangloss/vim-javascript.git ~/.vim/bundle/vim-javascript
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 安装依赖库(支持Python 3、Lua、Ruby) sudo apt-get install libncurse...
    Cyfeng阅读 2,148评论 0 2
  • 我清楚知道自己特别特别长的地方在哪里,并不是说其它地方有多短,而是兴趣点不同,以及想做更有价值更有意义也更有趣的事情
    极润阅读 320评论 0 0
  • 动物作为群体,处在某个食物链中的一环,有不可忽视的意义,但作为个体的一只大象、一只狐獴存在的意义是什么?纪录...
    _青松阅读 700评论 0 1