美文网首页开源技术
让Vim 支持Javascript 语法高亮显示

让Vim 支持Javascript 语法高亮显示

作者: 番茄晓蛋 | 来源:发表于2017-11-05 03:30 被阅读17次

    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
    

    相关文章

      网友评论

        本文标题:让Vim 支持Javascript 语法高亮显示

        本文链接:https://www.haomeiwen.com/subject/qbqcmxtx.html