flutter-reload.vim


Ⅰ. 插件描述

Reload flutter automatically when saving a dart file

Ⅱ. 基本信息

创建日期:  2018-12-11
使用用户:  1
Github星:  8
插件作者:  Hank Chiu

Ⅲ. 安装方法

使用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

  1. Add Plug 'hankchiutw/flutter-reload.vim' to your vimrc file.
  2. Reload your vimrc or restart
  3. Run :PlugInstall

Vundle or similar

  1. Add Plugin 'hankchiutw/flutter-reload.vim' to your vimrc file.
  2. Reload your vimrc or restart
  3. Run :BundleInstall

NeoBundle

  1. Add NeoBundle 'hankchiutw/flutter-reload.vim' to your vimrc file.
  2. Reload your vimrc or restart
  3. Run :NeoUpdate

Pathogen

cd ~/.vim/bundle
git clone https://github.com/hankchiutw/flutter-reload.vim.git

Manual 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.vim

Windows (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)

添加新评论