• Stars
    star
    411
  • Rank 103,149 (Top 3 %)
  • Language
    Vim Script
  • License
    GNU General Publi...
  • Created over 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Vim commands for Flutter, including hot-reload-on-save and more. 🦋

vim-flutter

Vim commands for Flutter, including hot-reload-on-save and more.

Demo usage GIF

Usage

Usage documentation can be found both in this README, as well as via calling :h flutter.

Installation

vim-flutter is a Vimscript-only plugin, and makes heavy use of Vim8's async jobs. It can be installed with a package manager like vim-plug , for example.

Though this package doesn't depend on it, having dart-vim-plugin available is recommended, for a better experience.

You may also consider combining package:dart_language_server with a Language Server Protocol client, like ale.

Plug 'dart-lang/dart-vim-plugin'
Plug 'thosakwe/vim-flutter'

" Run :PlugInstall to install the plugin.

Ultimately, installation is up to you.

Options

  • g:flutter_command - The Flutter executable path/name; defaults to 'flutter'.
  • g:flutter_hot_reload_on_save - Whether to auto hot-reload when dart files are saved; defaults to 1.
  • g:flutter_hot_restart_on_save - Whether to auto hot-restart when dart files are saved; defaults to 0.
  • g:flutter_show_log_on_run - Automatically open __Flutter_Output__ when starting flutter using :FlutterRun; it can have one of the following values:
    • "split" or 1: Open the log in a split, this is the default.
    • "tab": Open the log in a new tab.
    • "hidden" or 0: Do not open the log by default, can be opened later with FlutterSplit etc.
  • g:flutter_show_log_on_attach - Identical to g:flutter_show_log_on_run but affecting the :FlutterAttach command.
  • g:flutter_autoscroll - Autoscroll the flutter log when 1, defaults to 0.
  • g:flutter_use_last_run_option - When set to 1 then :FlutterRun will use the arguments from the previous call when no arguments are specified.
  • g:flutter_use_last_attach_option - Identical to g:flutter_use_last_run_option but affecting the :FlutterAttach command.

Provided Commands

  • :FlutterRun <args> - calls flutter run <args>
  • :FlutterAttach <args> - calls flutter attach <args>
  • :FlutterHotReload - triggers a hot reload on the current Flutter process
  • :FlutterHotRestart - triggers a hot restart on the current Flutter process
  • :FlutterScreenshot - takes a screenshot of the current Flutter application and saves it in the project directory
  • :FlutterQuit - quits the current Flutter process
  • :FlutterDevices - opens a new buffer, and writes the output of flutter devices to it
  • :FlutterSplit - opens Flutter output in a horizontal split
  • :FlutterEmulators - Executes a flutter emulators process.
  • :FlutterEmulatorsLaunch - Executes a flutter emulators --launch process, with any provided arguments.
  • :FlutterVisualDebug - Toggles visual debugging in the running Flutter process.

The following are self-explanatory:

  • :FlutterVSplit
  • :FlutterTab

Menu Support

If you are using a GUI Vim Variant, you can add a Flutter menu by calling call FlutterMenu().

Hot Reload on Save

A convenient feature to have when working with Flutter is to automatically hot-reload an app once a file is saved. By default, whenever a dart file is saved, if and only if a Flutter process is running, it will be hot-reloaded.

You can disable this by setting g:hot_reload_on_save=0, before vim-flutter is loaded.

Example .vimrc

Plug 'thosakwe/vim-flutter'
call plug#end()

" Enable Flutter menu
call FlutterMenu()

" Some of these key choices were arbitrary;
" it's just an example.
nnoremap <leader>fa :FlutterRun<cr>
nnoremap <leader>fq :FlutterQuit<cr>
nnoremap <leader>fr :FlutterHotReload<cr>
nnoremap <leader>fR :FlutterHotRestart<cr>
nnoremap <leader>fD :FlutterVisualDebug<cr>

More Repositories

1

t2b

A wicked-powerful text macro language for building binary files.
C++
375
star
2

flutter_music_player

A music player component for Flutter (i.e. Spotify, Apple Music, etc.) [AGPL/example/no longer maintaining]
Dart
224
star
3

bullseye

[WIP] A pure functional language that compiles to Dart.
Dart
76
star
4

tensorflow.dart

Dart bindings for Tensorflow.
Dart
74
star
5

feathers-seeder

Straightforward data seeder for Feathers.js services. Promise-based.
JavaScript
38
star
6

prompts

Rich, simple, synchronous command-line prompt library for Dart.
Dart
37
star
7

samurai

JS Interpreter in Dart.
Dart
34
star
8

dart_electron_starter_kit

Boilerplate project for building Electron apps with Dart.
JavaScript
31
star
9

immutable_state

🎯 A lightweight framework for stateless UI in Flutter and Dart, and an alternative to Redux.
Dart
30
star
10

shell

Wrapper over dart:io [Process] API's that supports features like environment management, user switches, and more.
Dart
16
star
11

blm-blackout

Spread awareness of American police brutality - change your landing page to this blackout until justice is served. #BLMBlackout
HTML
15
star
12

dart_scripts

Run commands upon installing Dart packages, and more.
Dart
14
star
13

http2_client

A `package:http` `BaseClient` that speaks HTTP/2, and can maintain connections between requests.
Dart
12
star
14

pub_mediator

[ARCHIVED] Diagnoses version conflicts between dependencies in Dart packages.
Dart
12
star
15

feathers-validator

WIP. A validator for Feathers services, or any service.
JavaScript
11
star
16

combinator

Parser combinators that support static typing, file spans, and more.
Dart
10
star
17

instagram_dart

Dart Instagram client library.
Dart
6
star
18

polymer-semantic-ui

[WIP] Native Polymer elements for Semantic UI
HTML
4
star
19

fray

Interpreter/compiler with an emphasis on code transformation and reflection. Compiles to JS + JVM.
Java
2
star
20

paypal_dart

Unofficial Dart bindings for the PayPal REST API.
Dart
2
star
21

shrub

🌳 (Yet another) compile-to-WebAssembly language.
Dart
2
star
22

dartmonit

Monitor Dart scripts, and run them on startup.
Dart
2
star
23

graphql_schema

Moved to angel-dart/graphql mono-repo
Dart
1
star
24

hello_haskell

Haskell beginner projects and practice
Haskell
1
star
25

cassandra

Cassandra driver for the Dart VM.
Dart
1
star
26

arriba

Instant file transfer. Won best Newbie submission at FSU's MakeBuild 2019.
Dart
1
star