{"id":13898905,"url":"https://github.com/eagletmt/ghcmod-vim","last_synced_at":"2025-04-09T09:03:53.131Z","repository":{"id":2483756,"uuid":"3457255","full_name":"eagletmt/ghcmod-vim","owner":"eagletmt","description":"Happy Haskell programming on Vim, powered by ghc-mod","archived":false,"fork":false,"pushed_at":"2018-08-30T19:08:46.000Z","size":230,"stargazers_count":434,"open_issues_count":42,"forks_count":59,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-02T03:39:19.376Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.vim.org/scripts/script.php?script_id=4473","language":"VimL","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/eagletmt.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-02-16T05:24:31.000Z","updated_at":"2024-12-21T05:12:09.000Z","dependencies_parsed_at":"2022-09-09T06:23:31.474Z","dependency_job_id":null,"html_url":"https://github.com/eagletmt/ghcmod-vim","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eagletmt%2Fghcmod-vim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eagletmt%2Fghcmod-vim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eagletmt%2Fghcmod-vim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eagletmt%2Fghcmod-vim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eagletmt","download_url":"https://codeload.github.com/eagletmt/ghcmod-vim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008628,"owners_count":21032556,"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":[],"created_at":"2024-08-06T18:04:31.600Z","updated_at":"2025-04-09T09:03:53.104Z","avatar_url":"https://github.com/eagletmt.png","language":"VimL","funding_links":[],"categories":["Vim Script"],"sub_categories":[],"readme":"# ghcmod.vim\n[![Build Status](https://api.travis-ci.org/eagletmt/ghcmod-vim.svg)](https://travis-ci.org/eagletmt/ghcmod-vim)\n[![Gitter chat](https://badges.gitter.im/eagletmt/ghcmod-vim.png)](https://gitter.im/eagletmt/ghcmod-vim)\n\nHappy Haskell programming on Vim, powered by [ghc-mod](https://github.com/kazu-yamamoto/ghc-mod)\n\n- [http://www.vim.org/scripts/script.php?script\\_id=4473](http://www.vim.org/scripts/script.php?script_id=4473)\n- https://github.com/eagletmt/ghcmod-vim/releases\n\n## Features\n\n- Displaying the type of sub-expressions (`ghc-mod type`)\n- Displaying error/warning messages and their locations (`ghc-mod check` and `ghc-mod lint`)\n- Displaying the expansion of splices (`ghc-mod expand`)\n- Insert split function cases (`ghc-mod split`)\n\nCompletions are supported by another plugin.\nSee [neco-ghc](https://github.com/eagletmt/neco-ghc) .\n\n## Requirements\n\n### Vim\nghcmod.vim contains ftplugin.\nPlease make sure that filetype plugin is enabled.\nTo check it, type `:filetype` and you would see something like this: `filetype detection:ON  plugin:ON  indent:ON`.\nYou can enable it by `:filetype plugin on`.\nI highly recommend adding `filetype plugin indent on` to your vimrc.\nSee `:help :filetype-overview` for more details.\n\n### vimproc\nhttps://github.com/Shougo/vimproc\n\n### ghc-mod \u003e= 5.0.0\n```sh\ncabal install ghc-mod\n```\n\n## Details\nIf you'd like to give GHC options, set `g:ghcmod_ghc_options`.\n\n```vim\nlet g:ghcmod_ghc_options = ['-idir1', '-idir2']\n```\n\nAlso, there's buffer-local version `b:ghcmod_ghc_options`.\n\n```vim\nautocmd BufRead,BufNewFile ~/.xmonad/* call s:add_xmonad_path()\nfunction! s:add_xmonad_path()\n  if !exists('b:ghcmod_ghc_options')\n    let b:ghcmod_ghc_options = []\n  endif\n  call add(b:ghcmod_ghc_options, '-i' . expand('~/.xmonad/lib'))\nendfunction\n```\n\n### :GhcModType, :GhcModTypeClear\nType `:GhcModType` on a expression, then the sub-expression is highlighted and its type is echoed.\nIf you type `:GhcModType` multiple times, the sub-expression changes.\n\n1. ![type1](http://cache.gyazo.com/361ad3652a412f780106ab07ad11f206.png)\n2. ![type2](http://cache.gyazo.com/0c884849a971e367c75a6ba68bed0157.png)\n3. ![type3](http://cache.gyazo.com/3644d66a3c5fbc51c01b5bb2053864cd.png)\n4. ![type4](http://cache.gyazo.com/ece85e8a1250bebfd13208a63679a3db.png)\n5. ![type5](http://cache.gyazo.com/71e4c79f9b42faaaf81b4e3695fb4d7f.png)\n\nSince ghc-mod 1.10.8, not only sub-expressions but name bindings and sub-patterns are supported.\n\n- ![type-bind](http://cache.gyazo.com/cee203adbf715f00d2dbd82c5cff3eaa.png)\n- ![type-pat](http://cache.gyazo.com/7a22068b73442e8447a4081d5ddffd31.png)\n\nType `:GhcModTypeClear` to clear sub-expression's highlight.\n\nSub-expressions are highlighted as `Search` by default.\nYou can customize it by setting `g:ghcmod_type_highlight` .\n\n```vim\nhi ghcmodType ctermbg=yellow\nlet g:ghcmod_type_highlight = 'ghcmodType'\n```\n\n### :GhcModCheck, :GhcModLint\nYou can get compiler errors/warnings by `:GhcModCheck` and they are available in quickfix window.\n\n![check](http://cache.gyazo.com/c09399b2fe370ce9d328b8ed12118de8.png)\n\nSimilarly, type `:GhcModLint` to get suggestions by `ghc-mod lint`.\n\nIf you'd like to pass options to hlint, set `g:ghcmod_hlint_options`.\n\n```vim\nlet g:ghcmod_hlint_options = ['--ignore=Redundant $']\n```\n\n![lint](http://cache.gyazo.com/3b64724ce2587e03761fe618457f1c2e.png)\n\nIf you'd like to open in another way the quickfix, set `g:ghcmod_open_quickfix_function`.\n\n```vim\nlet g:ghcmod_open_quickfix_function = 'GhcModQuickFix'\nfunction! GhcModQuickFix()\n  \" for unite.vim and unite-quickfix\n  :Unite -no-empty quickfix\n\n  \" for ctrlp\n  \":CtrlPQuickfix\n\n  \" for FuzzyFinder\n  \":FufQuickfix\nendfunction\n```\n\n### :GhcModCheckAsync, :GhcModLintAsync, :GhcModCheckAndLintAsync\nYou can run check and/or lint asynchronously.\n\nThis would be useful when you'd like to run check and/or lint automatically (especially on `BufWritePost`).\nSee Customize wiki page for more detail.\n\n### :GhcModExpand\nYou can see the expansion of splices by `:GhcModExpand` and they are available in quickfix window.\n\n![expand](http://cache.gyazo.com/bcbee2b84f956a87b636a67b5d5af488.png)\n\nThis feature was introduced since ghc-mod 1.10.10.\n\n### GhcModSplitFunCase\nSplit the function case by examining a type's constructors.\n\n```haskell\nf :: [a] -\u003e a\nf x = _body\n```\n\nWhen you type `:GhcModSplitFunCase` at the `x` position, ghcmod-vim will replace it with:\n\n```haskell\nf :: [a] -\u003e a\nf [] = _body\nf (x:xs) = _body\n```\n\n### GhcModSigCodegen\nInsert initial code from the given signature.\n\n```haskell\nfunc :: [a] -\u003e Maybe b -\u003e (a -\u003e b) -\u003e (a,b)\n```\n\nghcmod-vim will insert initial code using typed holes.\n\n```haskell\nfunc x y z f = _func_body\n```\n\nInstance declarations are also supported.\n\n```haskell\nnewtype D = D (Int,String)\n\nclass C a where\n    cInt :: a -\u003e Int\n    cString :: a -\u003e String\n\ninstance C D where\n```\n\nghcmod-vim will insert:\n\n```haskell\n    cInt x = _cInt_body\n    cString x = _cString_body\n```\n\n## Customize\nSee wiki page [Customize](https://github.com/eagletmt/ghcmod-vim/wiki/Customize).\n\n## License\n[BSD3 License](http://www.opensource.org/licenses/BSD-3-Clause), the same license as ghc-mod.\n\nCopyright (c) 2012-2013, eagletmt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feagletmt%2Fghcmod-vim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feagletmt%2Fghcmod-vim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feagletmt%2Fghcmod-vim/lists"}