Ⅰ. 插件描述
Elm plugin for VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'elmcast/elm-vim-sparks-fly'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'elmcast/elm-vim-sparks-fly'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'elmcast/elm-vim-sparks-fly'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/elmcast/elm-vim
Ⅳ. 文档说明
# elm-vim

Features
- Syntax highlighting
- Automatic indentation
- Function completion
- Build and package commands
- Code formatting and linting
- Documentation lookup
- REPL integration
Check out this ElmCast video for more detail.
Installation
If you don't have a preferred installation method, I recommend installing vim-plug, and then simply add Plug 'elmcast/elm-vim' to your plugin section:
NOTE: If you are using vim-polyglot, you need to disable its default elm plugin by adding let g:polyglot_disabled = ['elm'] to your config file.
Requirements
First, make sure you have the Elm Platform installed. The simplest method to get started is to use the official npm package.
npm install -g elmIn order to run unit tests from within vim, install elm-test
npm install -g elm-testFor code completion and doc lookups, install elm-oracle.
npm install -g elm-oracleTo automatically format your code, install elm-format.
npm install -g elm-formatMappings
The plugin provides several <Plug> mappings which can be used to create custom
- The following keybindings are provided by default:
| Keybinding | Description |
|---|---|
| <LocalLeader>m | Compile the current buffer. |
| <LocalLeader>b | Compile the Main.elm file in the project. |
| <LocalLeader>t | Runs the tests of the current buffer or 'tests/TestRunner'. |
| <LocalLeader>r | Opens an elm repl in a subprocess. |
| <LocalLeader>e | Shows the detail of the current error or warning. |
| <LocalLeader>d | Shows the type and docs for the word under the cursor. |
| <LocalLeader>w | Opens the docs web page for the word under the cursor. |
You can disable these mappings if you want to use your own.
let g:elm_setup_keybindings = 0Integration
Ale
The preferred linter to use with elm-vim is Ale. It should work out of the box.
Syntastic
Syntastic support should work out of the box, but we recommend the following settings:
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:elm_syntastic_show_warnings = 1YouCompleteMe
let g:ycm_semantic_triggers = {
\ 'elm' : ['.'],
\}Neocomplete
call neocomplete#util#set_default_dictionary(
\ 'g:neocomplete#sources#omni#input_patterns',
\ 'elm',
\ '\.')Usage
:help elm-vimlet g:elm_jump_to_error = 0
let g:elm_make_output_file = "elm.js"
let g:elm_make_show_warnings = 0
let g:elm_syntastic_show_warnings = 0
let g:elm_browser_command = ""
let g:elm_detailed_complete = 0
let g:elm_format_autosave = 1
let g:elm_format_fail_silently = 0
let g:elm_setup_keybindings = 1:ElmMake [filename]callselm-makewith the given file. If no file is given it uses the current file being edited.:ElmMakeMainattempts to callelm-makewith "Main.elm".:ElmTestcallselm-testwith the given file. If no file is given it runs it in the root of your project.:ElmReplrunselm-repl, which will return to vim on exiting.:ElmErrorDetailshows the detail of the current error in the quickfix window.:ElmShowDocsqueries elm-oracle, then echoes the type and docs for the word under the cursor.:ElmBrowseDocsqueries elm-oracle, then opens docs web page for the word under the cursor.:ElmFormatformats the current buffer with elm-format.
Screenshots

Credits
- Other vim-plugins, thanks for inspiration (elm.vim, ocaml.vim, haskell-vim)
- Contributors of elm-vim
License
Copyright © Joseph Hager. See LICENSE for more details.