Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unkindpartition/vim-hs-module-name
Vim plugin to infer and insert Haskell module name
https://github.com/unkindpartition/vim-hs-module-name
Last synced: about 1 month ago
JSON representation
Vim plugin to infer and insert Haskell module name
- Host: GitHub
- URL: https://github.com/unkindpartition/vim-hs-module-name
- Owner: UnkindPartition
- Created: 2012-11-06T09:46:05.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-11-07T09:55:05.000Z (about 12 years ago)
- Last Synced: 2024-10-22T04:21:24.182Z (3 months ago)
- Language: VimL
- Size: 117 KB
- Stars: 12
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hs-module-name Vim plugin
This vim plugin can automatically figure out and insert the name of a Haskell
module based on the filename.## Installation
This plugin is [pathogen][pathogen]-compatible. If you use pathogen, just clone
or copy this repo under `~/.vim/bundle`.Otherwise, use something like
cp -r vim-hs-module-name/* ~/.vim/
## Usage
### Automatic insertion
When you create a new `.hs` file, the headermodule Foo.Bar where
is automatically inserted, where `Foo.Bar` is the module name inferred from the
file name.Set the `g:hs_module_no_auto` variable to disable this.
### Manual insertion
When you are in a buffer with the `haskell` filetype, press `M` to insert the
module header as described above.To use a different key sequence instead of `M`, set the `g:hs_module_mapping`
variable to the desired key sequence.Set the `g:hs_module_no_mappings` variable to disable this.
### Command
If you want to set up other bindings or hooks, use the
`:InsertHaskellModuleName` command.## How the inference works
The components of the module name are assumed to be the largest
prefix of the file path components where all the components start with
capital letters.E.g. for the file
/home/User/project/src/Foo/Bar.hs
the module name is inferred to be `Foo.Bar`. This works pretty well in
practice.[pathogen]: https://github.com/tpope/vim-pathogen