Ⅰ. 插件描述
Vim plugin for jsfmt. Auto format js code on save.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'mephux/vim-jsfmt'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'mephux/vim-jsfmt'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'mephux/vim-jsfmt'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/mephux/vim-jsfmt
Ⅳ. 文档说明
# vim-jsfmt
vim-jsfmt is a vim plugin for the formatiting tool jsfmt. vim-jsfmt is based on the
go-fmt vimscript that ships with the vim-go plugin.
Installation
** Note: You have to have jsfmt install for this to work. npm install -g jsfmt >= version 0.5.3
To install using Vundle:
" add this line to your .vimrc file
Plugin 'mephux/vim-jsfmt'
To install using pathogen.vim:
cd ~/.vim/bundle
git clone https://github.com/mephux/vim-jsfmt.git
To checkout the source from repository:
cd ~/.vim/bundle
git clone https://github.com/mephux/vim-jsfmt.git
Settings
By default vim-jsfmt shows errors for the jsfmt command, to disable it:
let g:js_fmt_fail_silently = 1Enable auto fmt on save:
let g:js_fmt_autosave = 1Set the command to use for formating.
let g:js_fmt_command = "jsfmt"Configure jsfmt cli options.
let g:js_fmt_options = '--no-format'Self-Promotion
Like vim-jsfmt.vim? Follow the repository on
GitHub and if
you would like to stalk me, follow mephux on
Twitter and
GitHub.