Syntax highlighting for Dart in Vim
Vim script
Switch branches/tags
Nothing to show
Clone or download
natebosch Avoid changes if the buffer is already formatted (#66)
Prevents vim from thinking the file is modified and needs to be saved
after a format which doesn't change anything.

The `[:-2]` is because the `dartfmt` output includes a trailing newline
while the `join` omits it.
Latest commit 940adde Apr 23, 2018

README.md

Dart Support for Vim

dart-vim-plugin provides filetype detection, syntax highlighting, and indentation for Dart code in Vim.

Looking for auto-complete, diagnostics as you type, jump to definition and other intellisense features? Try dart_language_server and a vim plugin for the Language Server Protocol such as vim-lsc.

Looking for an IDE experience? See the Dart Tools page.

Commands

You can use following vim commands:

:Dart2Js

:DartAnalyzer

:DartFmt

Installation

Install as a typical vim plugin using your favorite approach. If you don't have a preference vim-plug is a good place to start. Below are examples for common choices, be sure to read the docs for each option.

vim-plug

call plug#begin()
"... <snip other plugins>
Plug 'dart-lang/dart-vim-plugin'

call plug#end()

Then invoke :PlugInstall to install the plugin.

pathogen

Clone the repository into your pathogen directory.

mkdir -p ~/.vim/bundle && cd ~/.vim/bundle && \
git clone https://github.com/dart-lang/dart-vim-plugin

Ensure your .vimrc contains the line execute pathogen#infect()

vundle

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"... <snip other plugins>
Plugin 'dart-lang/dart-vim-plugin'

call vundle#end()

Configuration

Enable HTML syntax highlighting inside Dart strings with let dart_html_in_string=v:true (default false).

Disable highlighting of core library classes with let dart_corelib_highlight=v:false (default true).

Enable Dart style guide syntax (like 2-space indentation) with let dart_style_guide = 2

Enable DartFmt execution on buffer save with let dart_format_on_save = 1