Ⅰ. 插件描述
Reload flutter automatically when saving a dart fileⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'hankchiutw/flutter-reload-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'hankchiutw/flutter-reload-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'hankchiutw/flutter-reload-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/hankchiutw/flutter-reload.vim
Ⅳ. 文档说明
# flutter-reload.vim
Reload flutter when saving a dart file without using --pid-file option.
Installation
Via Plugin Manager (Recommended)
Vim-Plug
- Add
Plug 'hankchiutw/flutter-reload.vim'to your vimrc file. - Reload your vimrc or restart
- Run
:PlugInstall
Vundle or similar
- Add
Plugin 'hankchiutw/flutter-reload.vim'to your vimrc file. - Reload your vimrc or restart
- Run
:BundleInstall
NeoBundle
- Add
NeoBundle 'hankchiutw/flutter-reload.vim'to your vimrc file. - Reload your vimrc or restart
- Run
:NeoUpdate
Pathogen
cd ~/.vim/bundle
git clone https://github.com/hankchiutw/flutter-reload.vim.gitManual Installation
Unix
(For Neovim, change ~/.vim/ to ~/.config/nvim/.)
curl -fLo ~/.vim/plugin/reload.vim --create-dirs \
https://raw.githubusercontent.com/hankchiutw/flutter-reload.vim/master/plugin/reload.vim
curl -fLo ~/.vim/ftplugin/dart.vim --create-dirs \
https://raw.githubusercontent.com/hankchiutw/flutter-reload.vim/master/ftplugin/dart.vimWindows (PowerShell)
md ~\vimfiles\plugin
md ~\vimfiles\doc
$pluguri = 'https://raw.githubusercontent.com/hankchiutw/flutter-reload.vim/master/plugin/reload.vim'
$ftpluguri = 'https://raw.githubusercontent.com/hankchiutw/flutter-reload.vim/master/ftplugin/dart.vim'
(New-Object Net.WebClient).DownloadFile($pluguri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\vimfiles\plugin\reload.vim"))
(New-Object Net.WebClient).DownloadFile($ftpluguri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\vimfiles\ftplugin\dart.vim"))Usage
In your flutter project, you will exectue flutter run (or flutter run -d {DEVICE_NAME} to specify the device you want).
NO NEED to use --pid-file to specify a pid file.
Make some changes to your project's *.dart files and you will see flutter reload automatically.
How it works
Simply sending SIGUSR1 to the flutter process in vim's BufWritePost.
(inspired from reisub0/hot-reload.vim)