{"id":18498298,"url":"https://github.com/elm-tooling/elm-vim","last_synced_at":"2025-04-09T00:31:11.480Z","repository":{"id":84195314,"uuid":"192939331","full_name":"elm-tooling/elm-vim","owner":"elm-tooling","description":"How to setup Vim tooling for working with Elm","archived":false,"fork":false,"pushed_at":"2021-03-10T23:01:07.000Z","size":50,"stargazers_count":70,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-04-14T06:52:45.852Z","etag":null,"topics":["elm","hacktoberfest","vim","vim-plugins","vimrc"],"latest_commit_sha":null,"homepage":"","language":"Vim script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elm-tooling.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-06-20T14:55:27.000Z","updated_at":"2024-02-02T09:05:59.000Z","dependencies_parsed_at":"2023-09-29T13:51:45.158Z","dependency_job_id":null,"html_url":"https://github.com/elm-tooling/elm-vim","commit_stats":{"total_commits":51,"total_committers":3,"mean_commits":17.0,"dds":"0.039215686274509776","last_synced_commit":"cf16ba9e352b719212753b2b074ba05be4439f84"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elm-tooling%2Felm-vim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elm-tooling%2Felm-vim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elm-tooling%2Felm-vim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elm-tooling%2Felm-vim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elm-tooling","download_url":"https://codeload.github.com/elm-tooling/elm-vim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247949823,"owners_count":21023397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elm","hacktoberfest","vim","vim-plugins","vimrc"],"created_at":"2024-11-06T13:38:31.929Z","updated_at":"2025-04-09T00:31:06.469Z","avatar_url":"https://github.com/elm-tooling.png","language":"Vim script","funding_links":[],"categories":[],"sub_categories":[],"readme":"# elm-vim\n\nInstructions to get started with [Elm](https://elm-lang.org) tooling in [Vim](https://www.vim.org).\n\n- [Setup](#setup)\n- [Configuration examples](#configuration-examples)\n- [FAQ](#faq)\n\n## Setup\n\n### Language Server\n\nInstall [`elm-language-server`](https://github.com/elm-tooling/elm-language-server) and its [dependencies](https://github.com/elm-tooling/elm-language-server#requirements). It provides most features, e.g. diagnostics (`elm make`), linting, jump to definition, formatting ([`elm-format`](https://github.com/avh4/elm-format)) and more. It is a standalone implementation of the language server protocol (LSP). There exist multiple language server client implementations (e.g. CoC or ale).\n\n* **CoC.nvim _(recommended)_:** Install [`CoC`](https://github.com/neoclide/coc.nvim). Look into [elm-language-server README](https://github.com/elm-tooling/elm-language-server#cocnvim) or [`CoC` wiki](https://github.com/neoclide/coc.nvim/wiki/Language-servers#elm) for setup and usage instructions.\n* **ale:** Install [`ale`](https://github.com/dense-analysis/ale) and use `elm_ls` linter. See [`elm-language-server` README](https://github.com/elm-tooling/elm-language-server#ale), [`ale` README](https://github.com/dense-analysis/ale#usage) and [`ale` docs](https://github.com/dense-analysis/ale/blob/master/doc/ale-elm.txt) for usage instructions.\n* **LanguageClient-neovim:** Install [`LanguageClient-neovim`](https://github.com/autozimu/LanguageClient-neovim) and see [elm-language-server README](https://github.com/elm-tooling/elm-language-server#languageclient).\n\n### Syntax highlighting\n\nIf you have Vim\u003e 8.2 patch 929 or neovim, Elm syntax is already [included in Vim](https://github.com/vim/vim/blob/master/runtime/syntax/elm.vim)!\n\n(Alternatively install [`elm-vim-syntax`](https://github.com/andys8/vim-elm-syntax) to add syntax highlighting and indentation.)\n\n### Code formatting\n\n[`elm-format`](https://github.com/avh4/elm-format) is used by `elm-language-server` to format code. An alternative is [`ale`](https://github.com/dense-analysis/ale)'s [`elm-format` fixer](https://github.com/w0rp/ale/blob/8768a309b8ef1c2e819dcb6f4630f73acab59792/doc/ale-elm.txt#L6-L29).\n\n[`vim-sleuth`](https://github.com/tpope/vim-sleuth) will set `shiftwidth` and `expandtab` according to your current file (or other similar files in your project). It is a great addition to `elm-format` and a Elm syntax.\n\n### Snippets\n\n`elm-language-server` provides snippets (e.g. with `CoC`).\n\nAn alternative is to install [`Ultisnips`](https://github.com/SirVer/ultisnips) for snippet functionality. Install [`honza/vim-snippets`](https://github.com/honza/vim-snippets) which contains [`elm.snippets`](https://github.com/honza/vim-snippets/blob/master/snippets/elm.snippets)\n\n### Tests\n\nInstall [`vim-test`](https://github.com/janko/vim-test) to run tests. It contains [`elmtest.vim`](https://github.com/janko/vim-test/blob/master/autoload/test/elm/elmtest.vim). `:TestFile` will execute `elm-test`.\n\n### Tagbar\n\nInstall [`majutsushi/tagbar`](https://github.com/majutsushi/tagbar) and configure content displayed in the tagbar.\n\n```vim\nlet g:tagbar_type_elm = {\n      \\ 'kinds' : [\n      \\ 'f:function:0:0',\n      \\ 'm:modules:0:0',\n      \\ 'i:imports:1:0',\n      \\ 't:types:1:0',\n      \\ 'a:type aliases:0:0',\n      \\ 'c:type constructors:0:0',\n      \\ 'p:ports:0:0',\n      \\ 's:functions:0:0',\n      \\ ]\n      \\}\n```\n\n## Configuration examples\n\nThere is an [example configuration](./vim-config-example/README.md) to showcase a small Vim setup for Elm.\n\n### User configurations\n\nIt's a good idea to take a look how others are configuring their environments. Here are some examples:\n\n- [`andys8/dotfiles`](https://github.com/andys8/dotfiles)\n- [`Augustin82/vim`](https://github.com/Augustin82/vim)\n- [`antoine-atmire/vim-elmc`](https://github.com/antoine-atmire/vim-elmc)\n- [`pehota/dotfiles`](https://github.com/pehota/dotfiles/blob/master/vimrc)\n- [`hulufei/dotfiles`](https://github.com/hulufei/dotfiles)\n- [`Miaxos/Home-`](https://github.com/Miaxos/Home-/blob/master/.vimrc)\n- [`leojpod/dotfiles`](https://github.com/leojpod/dotfiles)\n\n## FAQ\n\nFrequently asked questions. Feel free to contribute.\n\n### \"How do I configure CoC and set up keybindings?\"\n\nStart with the official [`CoC example configuration`](https://github.com/neoclide/coc.nvim#example-vim-configuration). Then start to look into our [example configuration](./vim-config-example/README.md) and [user configurations](#user-configurations). It'll take some time and tweaking until you find a configuration that's perfect for you.\n\n### \"How can I format files on save with CoC?\"\n\nAdd `\"coc.preferences.formatOnSaveFiletypes\": [\"elm\"]` to `coc-settings.json`.\n\n### \"CoC or the language server is not working. How can I debug?\"\n\nWith CoC you can use `:CocInfo` to see all client/server messages or `:CocOpenLog` to show the log. Set [`elmLS.trace.server`](https://github.com/elm-tooling/elm-language-client-vscode#extension-settings) to `verbose`. Make sure you're using a valid elm project with an `elm.json` file or verify behavior with [`elm-spa-example`](https://github.com/rtfeldman/elm-spa-example/).\n\n### \"CoC shows only first lines of error message in floating window\"\n\nCoC uses floating windows to display diagnostics (error messages). By default only the first 8 lines are shown.\n\n- Raise maximum number of error lines displayed with [`diagnostic.maxWindowHeight`](https://github.com/neoclide/coc.nvim/blob/2bd1385d9d443948d06d5bce82cadfdac185fcc1/doc/coc.txt#L379)\n- [Disable floating window](https://github.com/neoclide/coc.nvim/wiki/F.A.Q#how-could-i-disable-floating-window) and use `diagnostic.messageTarget` `\"echo\"` instead\n- Look into how to [scroll inside the floating window](https://github.com/elm-tooling/elm-vim/issues/3).\n\n### \"How can I disable a linter rule?\"\n\nAdd a `elm-analyse.json` config file like this and add [check names](https://stil4m.github.io/elm-analyse/#/messages).\nWe're not using elm-analyse anymore, but this should still work for most rules.\n\n```json\n{\n  \"checks\": {\n    \"UnusedTypeAlias\": false\n  }\n}\n```\n\n### \"What about `ElmCast/elm-vim` and `Zaptic/elm-vim`?\"\n\n`ElmCast/elm-vim` is an older vim plugin people used before there existed a language server implementation. We're grateful it existed in the past, but the plugin [seems to be unmaintained](https://github.com/ElmCast/elm-vim/issues/189) and isn't necessary anymore.\n\n[`Zaptic/elm-vim`](https://github.com/Zaptic/elm-vim) is a maintained fork. It can be a simple alternative to the `elm-language-server` with fewer features and easier setup.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felm-tooling%2Felm-vim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felm-tooling%2Felm-vim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felm-tooling%2Felm-vim/lists"}