Skip to content

Commit

Permalink
git subrepo clone [email protected]:ElmCast/elm-vim.git pack/elm/start/e…
Browse files Browse the repository at this point in the history
…lm-vim

subrepo:
  subdir:   "pack/elm/start/elm-vim"
  merged:   "ae531539"
upstream:
  origin:   "[email protected]:ElmCast/elm-vim.git"
  branch:   "master"
  commit:   "ae531539"
git-subrepo:
  version:  "0.4.0"
  origin:   "???"
  commit:   "???"
  • Loading branch information
lilydjwg committed Mar 20, 2018
1 parent 6e5f9b1 commit 21b7f86
Show file tree
Hide file tree
Showing 17 changed files with 1,326 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pack/elm/start/elm-vim/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
doc/tags
12 changes: 12 additions & 0 deletions pack/elm/start/elm-vim/.gitrepo
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
;
[subrepo]
remote = [email protected]:ElmCast/elm-vim.git
branch = master
commit = ae5315396cd0f3958750f10a5f3ad9d34d33f40d
parent = 6e5f9b1f2b773e22ebde43ed770f2e3ada042a47
method = merge
cmdver = 0.4.0
27 changes: 27 additions & 0 deletions pack/elm/start/elm-vim/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright (c) 2015, Joseph Hager
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of elm-vim nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
149 changes: 149 additions & 0 deletions pack/elm/start/elm-vim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# elm-vim

![logo](https://raw.github.com/elmcast/elm-vim/master/screenshots/logo.png)

## Features

1. Syntax highlighting
1. Automatic indentation
1. Function completion
1. Build and package commands
1. Code formatting and linting
1. Documentation lookup
1. REPL integration

Check out this [ElmCast video](https://vimeo.com/132107269) for more detail.

## Installation

If you don't have a preferred installation method, I recommend installing [vim-plug](https://github.com/junegunn/vim-plug), and then simply add `Plug 'elmcast/elm-vim'` to your plugin section:

*NOTE:* If you are using [vim-polyglot](https://github.com/sheerun/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](http://elm-lang.org/install) installed. The simplest method to get started is to use the official [npm](https://www.npmjs.com/package/elm) package.

```
npm install -g elm
```

In order to run unit tests from within vim, install [elm-test](https://github.com/rtfeldman/node-elm-test)

```
npm install -g elm-test
```

For code completion and doc lookups, install [elm-oracle](https://github.com/elmcast/elm-oracle).

```
npm install -g elm-oracle
```

To automatically format your code, install [elm-format](https://github.com/avh4/elm-format).

```
npm install -g elm-format
```

## Mappings

The plugin provides several `<Plug>` mappings which can be used to create custom
mappings. The following keybindings are provided by default:

| Keybinding | Description |
| ---------------------- | ------------------------------------------------------------------- |
| \<Leader>m | Compile the current buffer. |
| \<Leader>b | Compile the Main.elm file in the project. |
| \<Leader>t | Runs the tests of the current buffer or 'tests/TestRunner'. |
| \<Leader>r | Opens an elm repl in a subprocess. |
| \<Leader>e | Shows the detail of the current error or warning. |
| \<Leader>d | Shows the type and docs for the word under the cursor. |
| \<Leader>w | Opens the docs web page for the word under the cursor. |

You can disable these mappings if you want to use your own.

```vim
let g:elm_setup_keybindings = 0
```

## Integration

### [Ale](https://github.com/w0rp/ale)

The preferred linter to use with elm-vim is Ale. It should work out of the box.

### [Syntastic](https://github.com/scrooloose/syntastic)

Syntastic support should work out of the box, but we recommend the following settings:

```vim
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:elm_syntastic_show_warnings = 1
```

### [YouCompleteMe](https://github.com/Valloric/YouCompleteMe)

```vim
let g:ycm_semantic_triggers = {
\ 'elm' : ['.'],
\}
```

### [Neocomplete](https://github.com/Shougo/neocomplete.vim)

```vim
call neocomplete#util#set_default_dictionary(
\ 'g:neocomplete#sources#omni#input_patterns',
\ 'elm',
\ '\.')
```

## Usage

```vim
:help elm-vim
```

```vim
let 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]` calls `elm-make` with the given file. If no file is given it uses the current file being edited.

* `:ElmMakeMain` attempts to call `elm-make` with "Main.elm".

* `:ElmTest` calls `elm-test` with the given file. If no file is given it runs it in the root of your project.

* `:ElmRepl` runs `elm-repl`, which will return to vim on exiting.

* `:ElmErrorDetail` shows the detail of the current error in the quickfix window.

* `:ElmShowDocs` queries elm-oracle, then echoes the type and docs for the word under the cursor.

* `:ElmBrowseDocs` queries elm-oracle, then opens docs web page for the word under the cursor.

* `:ElmFormat` formats the current buffer with elm-format.

## Screenshots

![errors and completion](https://raw.github.com/elmcast/elm-vim/master/screenshots/syntax_highlighting.png)

## Credits

* Other vim-plugins, thanks for inspiration (elm.vim, ocaml.vim, haskell-vim)
* [Contributors](https://github.com/elmcast/elm-vim/graphs/contributors) of elm-vim

## License

Copyright © Joseph Hager. See `LICENSE` for more details.
6 changes: 6 additions & 0 deletions pack/elm/start/elm-vim/addon-info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "elm-vim",
"description": "Full featured Elm (elm-lang) support for Vim.",
"author": "Joseph Hager <[email protected]>",
"repository" : {"type": "git", "url": "https://github.com/ajhager/elm-vim.git"}
}
Loading

0 comments on commit 21b7f86

Please sign in to comment.